[wp-trac] [WordPress Trac] #57581: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in functions.php

WordPress Trac noreply at wordpress.org
Fri Mar 24 09:31:28 UTC 2023


#57581: str_replace(): Passing null to parameter #3 ($subject) of type array|string
is deprecated in functions.php
-------------------------------------+---------------------
 Reporter:  ipajen                   |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  6.3
Component:  General                  |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  PHP81 close 2nd-opinion  |     Focuses:
-------------------------------------+---------------------

Comment (by SergeyBiryukov):

 For visibility, re-posting [comment:6:ticket:57580 my comment] from
 #57580:
 > I agree we should not duplicate PHP notices. My thinking was more along
 the lines of trying to improve developer experience by providing a more
 comprehensible message where possible, as an extender may not always be a
 seasoned developer, and the PHP notice may not always be clear in context,
 especially if the function is not called directly and the incorrect
 parameter is somewhere in the call stack.

 That said, there are pretty good arguments above that adding
 `_doing_it_wrong()` notices on a case-by-case basis may not be the
 preferable approach in the long run, so I'm fine with closing in favor of
 a more structural approach if that's the consensus here :)

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


More information about the wp-trac mailing list