[wp-trac] [WordPress Trac] #57580: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in functions.php
WordPress Trac
noreply at wordpress.org
Thu Mar 16 00:18:35 UTC 2023
#57580: strpos(): Passing null to parameter #1 ($haystack) of type 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 | Focuses:
--------------------------+---------------------
Comment (by SergeyBiryukov):
Replying to [comment:5 hellofromTonya]:
> I don't think type validation though should exist to only duplicate
reporting type mismatches. It should instead exist when needed within the
context of the code it's being applied to.
>
> In this specific report, PHP is reporting the type mismatch. The
function expects a `string` type. Passing a non-string is doing it wrong.
The fix should be in the plugins, not in Core.
Yeah, 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 an experienced developer, and the PHP notice it 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57580#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list