Changeset 35195
- Timestamp:
- 10/15/2015 06:48:22 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp.php
r34903 r35195 210 210 if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { 211 211 // This is a verbose page match, let's check to be sure about it. 212 if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) ) 212 $page = get_page_by_path( $matches[ $varmatch[1] ] ); 213 if ( ! $page ) { 213 214 continue; 215 } 216 217 $post_status_obj = get_post_status_object( $page->post_status ); 218 if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private ) { 219 continue; 220 } 214 221 } 215 222 -
trunk/src/wp-includes/rewrite-functions.php
r35121 r35195 398 398 if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) { 399 399 // This is a verbose page match, let's check to be sure about it. 400 if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) ) 400 $page = get_page_by_path( $matches[ $varmatch[1] ] ); 401 if ( ! $page ) { 401 402 continue; 403 } 404 405 $post_status_obj = get_post_status_object( $page->post_status ); 406 if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private ) { 407 continue; 408 } 402 409 } 403 410 -
trunk/tests/phpunit/tests/rewrite.php
r34890 r35195 307 307 $this->assertFalse( is_home() ); 308 308 } 309 310 /** 311 * @ticket 21970 312 */ 313 function test_url_to_postid_with_post_slug_that_clashes_with_a_trashed_page() { 314 $this->set_permalink_structure( '/%postname%/' ); 315 316 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) ); 317 $post_id = $this->factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 318 319 $this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) ); 320 321 $this->set_permalink_structure(); 322 } 323 324 /** 325 * @ticket 21970 326 */ 327 function test_parse_request_with_post_slug_that_clashes_with_a_trashed_page() { 328 $this->set_permalink_structure( '/%postname%/' ); 329 330 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) ); 331 $post_id = $this->factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 332 333 $this->go_to( get_permalink( $post_id ) ); 334 335 $this->assertTrue( is_single() ); 336 $this->assertFalse( is_404() ); 337 338 $this->set_permalink_structure(); 339 } 340 309 341 }
Note: See TracChangeset
for help on using the changeset viewer.