Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix protocol-relative URLs in Url::to() (#13156) #13157

Merged
merged 2 commits into from
Dec 11, 2016

Conversation

rob006
Copy link
Contributor

@rob006 rob006 commented Dec 7, 2016

Q A
Is bugfix? yes
New feature? no
Breaks BC? no
Tests pass? yes
Fixed issues #13156

Fix #13156.

if (
substr($url, 0, 2) !== '//'
&& (($pos = strpos($url, ':')) === false || !ctype_alpha(substr($url, 0, $pos)))
) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why we're not using static::isRelative() here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because isRelative() method was added after this line. You can use it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if (
substr($url, 0, 2) !== '//'
&& (($pos = strpos($url, ':')) === false || !ctype_alpha(substr($url, 0, $pos)))
) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because isRelative() method was added after this line. You can use it

Copy link
Member

@samdark samdark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add changelog.

@rob006
Copy link
Contributor Author

rob006 commented Dec 10, 2016

@samdark This bug is not released, it is related to #13067.

@SilverFire SilverFire self-assigned this Dec 11, 2016
@SilverFire SilverFire merged commit 8e0af24 into yiisoft:master Dec 11, 2016
@SilverFire
Copy link
Member

Thank you!~

@rob006 rob006 deleted the issue-13156 branch December 11, 2016 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating url using yii\helpers\Url::to
4 participants