IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
389 | 389 | $this->assertInternalType( 'array', $rewrite_rules ); |
390 | 390 | $this->assertNotEmpty( $rewrite_rules ); |
391 | 391 | } |
| 392 | |
| 393 | /** |
| 394 | * @ticket 39373 |
| 395 | */ |
| 396 | public function test_url_to_postid_from_external_url(){ |
| 397 | $this->set_permalink_structure( '/%category%/%postname%/' ); |
| 398 | $cat1 = wp_create_category( 'something' ); |
| 399 | self::factory()->post->create( array( 'post_title' => 'External URL', 'post_type' => 'post', 'post_name' => 'external-url', 'post_category' => array( $cat1 ) ) ); |
| 400 | |
| 401 | $test_external = 'http://www.external-domain.com/something/external-url/'; |
| 402 | $this->assertSame( 0, url_to_postid( $test_external ) ); |
| 403 | } |
392 | 404 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
517 | 517 | if ( !$wp_rewrite->using_index_permalinks() ) |
518 | 518 | $url = str_replace( $wp_rewrite->index . '/', '', $url ); |
519 | 519 | |
| 520 | // Before we truncate $url, we temporary store it |
| 521 | $temporary_url = $url; |
520 | 522 | if ( false !== strpos( trailingslashit( $url ), home_url( '/' ) ) ) { |
521 | 523 | // Chop off http://domain.com/[path] |
522 | 524 | $url = str_replace(home_url(), '', $url); |
… |
… |
|
527 | 529 | $url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) ); |
528 | 530 | } |
529 | 531 | |
| 532 | // If the $url is not truncated, that means the $url is not from our current domain. Bail. @ticket 39373 |
| 533 | if( false !== strpos( $url, $temporary_url ) ){ |
| 534 | return 0; |
| 535 | } |
| 536 | |
530 | 537 | // Trim leading and lagging slashes |
531 | 538 | $url = trim($url, '/'); |
532 | 539 | |