[wp-trac] [WordPress Trac] #63107: two deprecated warnings in /wp-includes/functions.php

WordPress Trac noreply at wordpress.org
Sat Mar 15 16:51:28 UTC 2025


#63107: two deprecated warnings in /wp-includes/functions.php
--------------------------+------------------------------
 Reporter:  rpayne7264    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by sabernhardt):

 * keywords:  changes-requested has-patch => has-patch
 * version:  6.7.2 =>


Old description:

> two deprecated warnings in /wp-includes/functions.php:
>
> '''1)''' Backtrace from warning 'strpos(): Passing null to parameter #1
> ($haystack) of type string is deprecated' at /wp-includes/functions.php
> 7329:
>
> this is the code causing the error: {{{$scheme_separator = strpos( $path,
> '://' );}}}
>
> this is the adjusted code to fix it: {{{$scheme_separator = strpos($path
> ?? '', '://');}}}
>
> '''2)''' Backtrace from warning 'str_replace(): Passing null to parameter
> #3 ($subject) of type array|string is deprecated' at
> /home/rdptechs/homebasedlife.com/wp-includes/functions.php 2189:
>
> here is the code causing the error: {{{$path = str_replace( '\\', '/',
> $path );}}}
>
> this the adjusted code to fix it: {{{$path = str_replace('\\', '/', $path
> ?? '');}}}

New description:

 two deprecated warnings in /wp-includes/functions.php:

 '''1)''' Backtrace from warning `strpos(): Passing null to parameter #1
 ($haystack) of type string is deprecated at /wp-includes/functions.php
 7329`:

 this is the code causing the error: {{{$scheme_separator = strpos( $path,
 '://' );}}}

 this is the adjusted code to fix it: {{{$scheme_separator = strpos($path
 ?? '', '://');}}}

 '''2)''' Backtrace from warning `str_replace(): Passing null to parameter
 #3 ($subject) of type array|string is deprecated at /wp-
 includes/functions.php 2189`:

 here is the code causing the error: {{{$path = str_replace( '\\', '/',
 $path );}}}

 this the adjusted code to fix it: {{{$path = str_replace('\\', '/', $path
 ?? '');}}}

--

Comment:

 Hi! Please look further back in the backtrace to discover which function
 sends a `null` value through `wp_normalize_path()`. Both
 `wp_normalize_path()` and `wp_is_stream()` require a string, and anything
 else could cause issues that are bigger than a deprecation notice.

 According to #57580, a number of plugins have added `null` as the first
 parameter in `add_submenu_page()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63107#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list