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

Replace GET parameters when changed in form #14010

Merged
merged 1 commit into from Mar 23, 2015
Merged

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Mar 21, 2015

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

$query = parse_url($uri, PHP_URL_QUERY);
$currentParameters = array();
if ($query) {
foreach (explode('&', $query) as $param) {
Copy link
Member

Choose a reason for hiding this comment

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

Could it be possible to replace these two combined explode functions + foreach by a call to the PHP parse_str() function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, as said on PHP.net:

Parses str as if it were the query string passed via a URL and sets variables in the current scope.

There is no easy (nor quick) way to find out which variables were added in the current scope IRCC

Copy link
Member

Choose a reason for hiding this comment

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

But if you use the second optional argument of the function, the variables are stored in an array, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, I've updated the PR.

@fabpot
Copy link
Member

fabpot commented Mar 23, 2015

Thank you @wouterj.

@fabpot fabpot merged commit fa9fb5c into symfony:2.3 Mar 23, 2015
fabpot added a commit that referenced this pull request Mar 23, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

Replace GET parameters when changed in form

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13962
| License       | MIT
| Doc PR        | -

Commits
-------

fa9fb5c Replace GET parameters when changed
@wouterj wouterj deleted the issue_13962 branch March 23, 2015 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants