mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-08 22:54:36 +00:00
Respect numerical keys in add_query_arg(), use array_replace() instead of array_merge().
Adds unit test. Props tyxla. Fixes #31306. git-svn-id: https://develop.svn.wordpress.org/trunk@31966 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -258,6 +258,20 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
$_SERVER['REQUEST_URI'] = $old_req_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 31306
|
||||
*/
|
||||
function test_add_query_arg_numeric_keys() {
|
||||
$url = add_query_arg( array( 'foo' => 'bar' ), '1=1' );
|
||||
$this->assertEquals('1=1&foo=bar', $url);
|
||||
|
||||
$url = add_query_arg( array( 'foo' => 'bar', '1' => '2' ), '1=1' );
|
||||
$this->assertEquals('1=2&foo=bar', $url);
|
||||
|
||||
$url = add_query_arg( array( '1' => '2' ), 'foo=bar' );
|
||||
$this->assertEquals('foo=bar&1=2', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 21594
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user