Make WordPress Core

Opened 8 months ago

Closed 6 months ago

#59940 closed defect (bug) (duplicate)

PHP Deprecated Errors In Core

Reported by: jmorti's profile jmorti Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.4
Component: General Keywords:
Focuses: php-compatibility Cc:

Description (last modified by sabernhardt)

Hi, I updated my server to PHP 8 and started getting errors in the debug log that you might want to look into. WordPress is updated so I'm afraid these bugs were missed. You can't pass NULL to these two functions anymore. Thanks.

PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /wp-includes/functions.php on line 7241
PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /wp-includes/functions.php on line 2187

Change History (3)

#1 @sabernhardt
8 months ago

  • Description modified (diff)
  • Keywords reporter-feedback added

Hi and welcome to WordPress Core Trac!

#57580, #57581 and #59757 have similar reports about the wp_normalize_path() function (line 2187), which also involves wp_is_stream() (line 7241). The $path parameter has needed to be a string since the function was introduced.

Can you determine what code is incorrectly trying to use null with wp_normalize_path()? If that is in a plugin, the error will need to be reported to its author(s).

#2 @jorbin
6 months ago

#60223 was marked as a duplicate.

#3 @sabernhardt
6 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

#57580 was an earlier ticket with reports about the deprecated warnings for wp_normalize_path() and wp_is_stream().

The four causes identified there were all plugins that had added null in the add_submenu_page() function. Those four plugins have been updated for newer PHP, but a directory search still finds many plugins doing it wrong.

If you identify the issue in a plugin, please report it to the plugin's author. If you also would like to share details about the source of the problem, you could comment on #57580.

Note: See TracTickets for help on using tickets.