[wp-trac] [WordPress Trac] #62845: Deprecated: str_replace() - Passing null as $subject in PHP 8.x

WordPress Trac noreply at wordpress.org
Thu Jan 23 08:26:20 UTC 2025


#62845: Deprecated: str_replace() - Passing null as $subject in PHP 8.x
-------------------------+-------------------------------------------------
 Reporter:  madum        |       Owner:  (none)
     Type:  defect       |      Status:  new
  (bug)                  |
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  major        |  Resolution:
 Keywords:  dev-         |     Focuses:  administration, template, php-
  feedback               |  compatibility
-------------------------+-------------------------------------------------

Comment (by knutsp):

 Since it is documented that $path must be a string, it's wrong to just
 silence out such error from the caller. Either the function should emit an
 error, throw exception itself, or let `str_replace` handle it.

 If some code calls a function with incorrect parameters, an error must be
 expected. If not serious errors may happen somewhere without being
 noticed.

 To avoid the error message, fix the code calling it with bad parameters.

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


More information about the wp-trac mailing list