Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#60223 closed defect (bug) (duplicate)

Depricated in PHP 8.1.26

Reported by: opajaap's profile opajaap Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

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

Happens on all dashboard pages

Change History (7)

#1 @benniledl
11 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Hey there!

No worries, those deprecated warnings are pretty common and not an issue. They're just notifications that certain parts of the code are a bit outdated (they will be solved before they even can cause any problems).

To get rid of them, you can do this:

Turn off Debug Mode:

Open your wp-config.php file.
Look for define( 'WP_DEBUG', true ); and change it to define( 'WP_DEBUG', false );.

Remember, these warnings are more like gentle reminders and do not cause troubles.

#2 @opajaap
11 months ago

I know it is not harmfull, but i am a developer myself (hence WP_DEBUG) and it is nice when i should know that any error/warning is originated in one of my own plugins, makes debugging easier. Besides, if no-one reports it, it might be overlooked.

Last edited 11 months ago by opajaap (previous) (diff)

#3 @jorbin
11 months ago

  • Resolution changed from invalid to duplicate

I don't think this is invalid, It has been reported previously though, so I'm going to change this to be a duplicate of #59940 where there has been a request for more information on what is incorrectly trying to use null with wp_normalize_path(), which would be great to add to that ticket.

#4 @jorbin
11 months ago

  • Milestone Awaiting Review deleted
  • Version 6.4.2 deleted

#5 @sabernhardt
11 months ago

  • Description modified (diff)

#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. Because your deprecation notices occur on all dashboard pages, add_submenu_page() is quite likely where the problem starts in your case too.

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.

#6 @opajaap
11 months ago

add_submenu_page() should itsself test the validity of the args it is caled with

#7 @sabernhardt
11 months ago

#57580 is reopened. I did not want to add type checks and a translatable error message just to tell people they did it wrong, but the function needs to be fixed for plugin authors who followed instructions (which were incorrect).

Note: See TracTickets for help on using tickets.