Changeset 27686
- Timestamp:
- 03/24/2014 06:54:38 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r27633 r27686 2269 2269 if ( ! empty( $q['posts_per_rss'] ) ) { 2270 2270 $q['posts_per_page'] = $q['posts_per_rss']; 2271 } else { 2271 } else { 2272 2272 $q['posts_per_page'] = get_option( 'posts_per_rss' ); 2273 2273 } … … 3206 3206 $this->set_found_posts( $q, $limits ); 3207 3207 3208 return $this->posts;3208 return array_map( 'intval', $this->posts ); 3209 3209 } 3210 3210 … … 3215 3215 3216 3216 $r = array(); 3217 foreach ( $this->posts as $post ) 3218 $r[ $post->ID ] =$post->post_parent;3219 3217 foreach ( $this->posts as $post ) { 3218 $r[ (int) $post->ID ] = (int) $post->post_parent; 3219 } 3220 3220 return $r; 3221 3221 } -
trunk/tests/phpunit/tests/query/results.php
r27395 r27686 47 47 $this->parent_two = $this->factory->post->create( array( 'post_title' => 'parent-two', 'post_date' => '2007-01-01 00:00:00' ) ); 48 48 $this->parent_three = $this->factory->post->create( array( 'post_title' => 'parent-three', 'post_date' => '2007-01-01 00:00:00' ) ); 49 $this-> factory->post->create( array( 'post_title' => 'child-one', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:01' ) );50 $this-> factory->post->create( array( 'post_title' => 'child-two', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:02' ) );51 $this-> factory->post->create( array( 'post_title' => 'child-three', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:03' ) );52 $this-> factory->post->create( array( 'post_title' => 'child-four', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:04' ) );49 $this->child_one = $this->factory->post->create( array( 'post_title' => 'child-one', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:01' ) ); 50 $this->child_two = $this->factory->post->create( array( 'post_title' => 'child-two', 'post_parent' => $this->parent_one, 'post_date' => '2007-01-01 00:00:02' ) ); 51 $this->child_three = $this->factory->post->create( array( 'post_title' => 'child-three', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:03' ) ); 52 $this->child_four = $this->factory->post->create( array( 'post_title' => 'child-four', 'post_parent' => $this->parent_two, 'post_date' => '2007-01-01 00:00:04' ) ); 53 53 54 54 unset( $this->q ); … … 371 371 } 372 372 373 /** 374 * @ticket 27252 375 */ 376 function test_query_fields_integers() { 377 378 $parents = array( 379 (int) $this->parent_one, 380 (int) $this->parent_two 381 ); 382 $posts1 = $this->q->query( array( 383 'post__in' => $parents, 384 'fields' => 'ids', 385 'orderby' => 'post__in', 386 ) ); 387 388 $this->assertSame( $parents, $posts1 ); 389 390 $children = array( 391 (int) $this->child_one => (int) $this->parent_one, 392 (int) $this->child_two => (int) $this->parent_one 393 ); 394 395 $posts2 = $this->q->query( array( 396 'post__in' => array_keys( $children ), 397 'fields' => 'id=>parent', 398 'orderby' => 'post__in', 399 ) ); 400 401 $this->assertSame( $children, $posts2 ); 402 403 } 404 373 405 function test_exlude_from_search_empty() { 374 406 global $wp_post_types;
Note: See TracChangeset
for help on using the changeset viewer.