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

Check for duplicate secret parameter #15

Closed
wants to merge 2 commits into from
Closed

Check for duplicate secret parameter #15

wants to merge 2 commits into from

Conversation

alex-code
Copy link

If pjax receives data as an array you can end up with duplicate secret parameters _pjax=#container

Can occur with a filter on a GridView.

If pjax receives data as an array you can end up with duplicate secret parameters `_pjax=#container`

Can occur with a filter on a `GridView`.
@cebe
Copy link
Member

cebe commented Dec 15, 2014

can you explain a bit more how and why this can happen? and shouldn't we fix the cause then rather then working around it?

@alex-code
Copy link
Author

Say you have a GridView with a filter wrapped with PJax.

When you change the GridView filter Pjax catches the form submit and appends _pjax to the querystring.

Now in your action where you render the GridView it sets the filterUrl to Yii::$app->request->url which now includes the _pjax param.

If you change the filter again the applyFilter function in yii.gridView.js parses the querystring in filterUrl when building the hidden form.

Pjax then serializes that form into an array and adds the _pjax parameter again.

@SilverFire
Copy link
Member

Reproduced. The fix works fine

@SilverFire SilverFire added this to the 2.0.6 milestone Nov 23, 2015
@SilverFire
Copy link
Member

I think it's better to solve this problem on js side than touch PHP part of Yii

@SilverFire
Copy link
Member

Merged 18a9183

@SilverFire SilverFire closed this Nov 23, 2015
@SilverFire
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants