Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #55753


Ignore:
Timestamp:
05/18/2022 04:45:41 AM (3 years ago)
Author:
dd32
Comment:

Hi @lagiosdi,

The provided input to the function is invalid in this case, as it's not a value which can be parsed as a URL by PHP, and as a result is unlikely to generate a valid return value.

> parse_url( 'www.example.com/article' );
array(1) {
  'path' =>
  string(23) "www.example.com/article"
}

The function should probably bail early with invalid input like this though, rather than attempting to continue, as it'll return on the line after this deprecated notice anyway.

https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/rewrite.php#L498-L507

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #55753

    • Property Summary changed from parse_url at url_to_postid to PHP deprecated notice from parse_url() in url_to_postid()
  • Ticket #55753 – Description

    initial v1  
    33url = "www.example.com/article"
    44
    5 $url_host      = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) );
     5`$url_host      = str_replace( 'www.', '', parse_url( $url, PHP_URL_HOST ) );`
    66
    77make warning:
    8 b>Deprecated</b>:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in <b>/var/www/vhosts/example.com/httpdocs/wp-includes/rewrite.php</b> on line <b>500</b><br />
    9 
     8Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in wp-includes/rewrite.php on line 500