Changeset 39087
- Timestamp:
- 11/02/2016 05:52:12 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-request.php
r39027 r39087 452 452 $params = array(); 453 453 foreach ( $order as $type ) { 454 $params = array_merge( $params, (array) $this->params[ $type ] ); 454 // array_merge / the "+" operator will mess up 455 // numeric keys, so instead do a manual foreach. 456 foreach ( (array) $this->params[ $type ] as $key => $value ) { 457 $params[ $key ] = $value; 458 } 455 459 } 456 460 -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r38601 r39087 283 283 'has_body_params' => true, 284 284 'has_default_params' => true, 285 ); 286 $this->assertEquals( $expected, $this->request->get_params() ); 287 } 288 289 public function test_parameter_merging_with_numeric_keys() { 290 $this->request->set_query_params( array( 291 '1' => 'hello', 292 '2' => 'goodbye', 293 ) ); 294 $expected = array( 295 '1' => 'hello', 296 '2' => 'goodbye', 285 297 ); 286 298 $this->assertEquals( $expected, $this->request->get_params() );
Note: See TracChangeset
for help on using the changeset viewer.