[wp-trac] [WordPress Trac] #62366: get_post_states() throws PHP warning
WordPress Trac
noreply at wordpress.org
Sat Nov 9 17:05:43 UTC 2024
#62366: get_post_states() throws PHP warning
-------------------------+-------------------------------------------------
Reporter: akramipro | Owner: (none)
Type: defect | Status: new
(bug) |
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post | Version: trunk
Types |
Severity: normal | Resolution:
Keywords: has-patch | Focuses: coding-standards, php-
close | compatibility
-------------------------+-------------------------------------------------
Comment (by knutsp):
Replying to [comment:2 akramipro]:
> We cannot hope that the user will enter the correct value.
User? I would think the developer. When a user enters somthing it sholud
be validated, bit fail to see the relvance here.
> We should not allow it to cause an error.
It's not a fatal error, it's a warning to developers.
> Why is it incorrect to check this?
How would developers otherwise see that they have made an error, passing
the wrong type argument to a function?
If strict types was, or will later be, enforced, and a type hint is put in
the function signature, this would cause the a error to be emitted while
referencing the ''caller'' file and line.
If this was common, due to misunderstanding a complex documentation and
guidelines, a "doing it wrong" could be emitted.
Suggestion: ''Trace'' the error and see where it comes from. If core,
investigate the cases it may happen, report here, then we can perhaps make
that code better. If theme/plugin inform the authors.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62366#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list