Ticket #31194: 31194.patch
| File 31194.patch, 1.7 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/query.php
3420 3420 3421 3421 if ( 'ids' == $q['fields'] ) { 3422 3422 $this->posts = $wpdb->get_col( $this->request ); 3423 $this->posts = array_map( 'intval', $this->posts ); 3423 3424 $this->post_count = count( $this->posts ); 3424 3425 $this->set_found_posts( $q, $limits ); 3425 3426 3426 return array_map( 'intval', $this->posts );3427 return $this->posts; 3427 3428 } 3428 3429 3429 3430 if ( 'id=>parent' == $q['fields'] ) { … … 3432 3433 $this->set_found_posts( $q, $limits ); 3433 3434 3434 3435 $r = array(); 3435 foreach ( $this->posts as $post ) { 3436 foreach ( $this->posts as $key => $post ) { 3437 $this->posts[ $key ]->ID = (int) $post->ID; 3438 $this->posts[ $key ]->post_parent = (int) $post->post_parent; 3439 3436 3440 $r[ (int) $post->ID ] = (int) $post->post_parent; 3437 3441 } 3442 3438 3443 return $r; 3439 3444 } 3440 3445 -
tests/phpunit/tests/query/results.php
387 387 388 388 /** 389 389 * @ticket 27252 390 * @ticket 31194 390 391 */ 391 392 function test_query_fields_integers() { 392 393 … … 401 402 ) ); 402 403 403 404 $this->assertSame( $parents, $posts1 ); 405 $this->assertSame( $parents, $this->q->posts ); 404 406 405 407 $children = array( 406 408 (int) self::$child_one => (int) self::$parent_one, … … 415 417 416 418 $this->assertSame( $children, $posts2 ); 417 419 420 foreach ( $this->q->posts as $post ) { 421 $this->assertInternalType( 'int', $post->ID ); 422 $this->assertInternalType( 'int', $post->post_parent ); 423 } 424 418 425 } 419 426 420 427 /**