Skip to content

[Routing] Generate URLs in compliance with PHP_QUERY_RFC3986 #19639

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

Closed
wants to merge 3 commits into from

Conversation

jameshalsall
Copy link
Contributor

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no?
Deprecations? no
Tests pass? yes
Fixed tickets #19625
License MIT
Doc PR

@@ -268,7 +268,17 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
return $a == $b ? 0 : 1;
});

if ($extra && $query = http_build_query($extra, '', '&')) {
// extract fragment
$fragment = isset($extra['_fragment']) ? $extra['_fragment'] : '';
Copy link

Choose a reason for hiding this comment

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

variable $fragment is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove, bad upstream merge

@Tobion
Copy link
Contributor

Tobion commented Aug 17, 2016

This is not a bug fix but a new feature to me as it changes the bahavior.
So it should be done against master, which then also means you do not need the defined('PHP_QUERY_RFC3986') check as it always exist in php >=5.5

@jameshalsall
Copy link
Contributor Author

Yeah I opened this against master originally as I wasn't 100% sure whether it would break BC, technically it shouldn't because both URL variations are valid, but it there may be people running assertions on generated URL formats which it could break.

@jameshalsall
Copy link
Contributor Author

Other PR for reference (ignore the number of commits, I switched target branch by mistake) #19637

@fabpot
Copy link
Member

fabpot commented Aug 18, 2016

Thank you @jameshalsall.

@fabpot fabpot closed this in 885c388 Aug 18, 2016
@@ -325,18 +325,24 @@ public function testGenerateWithSpecialRouteName()

public function testUrlEncoding()
{
if (defined('PHP_QUERY_RFC3986')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was it merged with this that is not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is needed, that was only added in PHP 5.4

Copy link
Contributor

Choose a reason for hiding this comment

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

it was merged in master which requires 5.5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was merged to 2.7

Copy link
Contributor Author

@jameshalsall jameshalsall Aug 18, 2016

Choose a reason for hiding this comment

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

oh, well it was targeted at 2.7 - I can see Fabien merged to master instead - I will send another PR shortly to remove the defined() checks

Copy link
Member

Choose a reason for hiding this comment

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

Because I made the change after the merge.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

oops, sorry about that. fixed now. Good catch as always :)

@xabbuh
Copy link
Member

xabbuh commented Sep 6, 2016

What about documenting this in the upgrade file? It may break some users' functional tests.

@fabpot fabpot mentioned this pull request Oct 27, 2016
fabpot added a commit that referenced this pull request Dec 10, 2016
…ery strings (ogizanagi)

This PR was merged into the 3.2 branch.

Discussion
----------

[Routing] Mention minor BC break about UrlGenerator & query strings

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no, mention one
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

---

Refs:

- https://github.com/javiereguiluz/EasyAdminBundle/pull/1421#issuecomment-266201441
- #19639
- http://php.net/manual/en/function.http-build-query.php
- https://www.ietf.org/rfc/rfc3986.txt

Commits
-------

9e73887 [Routing] Mention minor BC break about UrlGenerator & query strings
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.

7 participants