Respect numerical keys in `add_query_arg()`, use `array_replace()` instead of `array_merge()`.

Adds unit test.

Props tyxla.
Fixes #31306.

Built from https://develop.svn.wordpress.org/trunk@31966


git-svn-id: http://core.svn.wordpress.org/trunk@31945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-04-01 19:15:31 +00:00
parent 8ec192ce1f
commit c113cb5130
2 changed files with 2 additions and 2 deletions

View File

@ -782,7 +782,7 @@ function add_query_arg() {
$qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
if ( is_array( $args[0] ) ) { if ( is_array( $args[0] ) ) {
$kayvees = $args[0]; $kayvees = $args[0];
$qs = array_merge( $qs, $kayvees ); $qs = array_replace( $qs, $kayvees );
} else { } else {
$qs[ $args[0] ] = $args[1]; $qs[ $args[0] ] = $args[1];
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-beta3-31965'; $wp_version = '4.2-beta3-31966';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.