BUGFIX Use array_merge_recursive() when merging $_GET+$_POST or $_POST+$... #144

Merged
merged 1 commit into from Dec 23, 2011

Projects

None yet

2 participants

@simonwelsh

..._FILES so it handles nested keys properly.

@chillu
SilverStripe Ltd. member

Hey Simon, could you create an ArrayLibTest as well? Can have the same input/output combination, but test the method explicitly, rather than through a dozen layers of abstraction in HTTPRequestTest. Two reasons: Its clear that the method is indeed tested, and it removes uncertainty around side effects outside of ArrayLib influencing the behaviour.

Also, can you confirm that the method behaves the same way as the native $_REQUEST when it comes to merging arrays? I've looked at the docs but can't find anything helpful (http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple, http://www.php.net/manual/en/language.variables.external.php)

@simonwelsh

Hey Ingo

I've added the tests to ArrayLibTest as well, and run equivalent tests using curl and print_r($_REQUEST). The only discrepancy between the $_REQUEST results and my method was the handling of numeric keys. $_REQUEST overrode them whereas the method appended them. I've updated the method to account for this and added an additional test case that covers this behaviour.

@chillu chillu merged commit dd546a9 into silverstripe:master Dec 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment