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

[Laravel5] Don't duplicate associative array fields #4414

Merged
merged 1 commit into from Aug 1, 2017

Conversation

Projects
None yet
4 participants
@guidocella
Contributor

guidocella commented Jul 20, 2017

Using the Laravel5 module I have the issue that associative array inputs are duplicated, for example <input name="foo[bar]"> results in both the foo and foo[bar] keys in the request. I added a check in getFormPhpValues to remove the spurious keys and leave the actual array only.

This issue doesn't occur in the framework modules which call remapRequestParameters (Phalcon, Universal, Yii, Yii2. Symfony and Zend may have the same issue) which then calls http_build_query on the request parameters and then parse_str on the query string. Same for PhpBrowser since Guzzle calls http_build_query on the form_params and query you pass to it. This has the side effect of leaving only the correct key since "foo[bar]" = '' and 'foo' = ['bar' => ''] have the same representation in a query string. However http_build_query removes parameters with a value of null (or an empty array) and with Laravel it's reasonable to submit null values directly since it has a middleware that converts empty string inputs to null.

@guidocella guidocella changed the title from [Laravel5Don't duplicate associative array fields to [Laravel5] Don't duplicate associative array fields Jul 20, 2017

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Jul 31, 2017

Member

Please remove tests/app/data/db from this PR. Tests seem to be failing because of that

Member

DavertMik commented Jul 31, 2017

Please remove tests/app/data/db from this PR. Tests seem to be failing because of that

@guidocella

This comment has been minimized.

Show comment
Hide comment
@guidocella

guidocella Aug 1, 2017

Contributor

Done.

Contributor

guidocella commented Aug 1, 2017

Done.

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Aug 1, 2017

Member

Thanks!

Member

DavertMik commented Aug 1, 2017

Thanks!

@DavertMik DavertMik merged commit 758dd0d into Codeception:2.3 Aug 1, 2017

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
wercker/build Wercker pipeline passed
Details

@guidocella guidocella deleted the guidocella:dont-duplicate-associative-arrays branch Aug 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment