[wp-trac] [WordPress Trac] #60003: PHP error in wp_match_mime_types()
WordPress Trac
noreply at wordpress.org
Mon Dec 4 18:19:27 UTC 2023
#60003: PHP error in wp_match_mime_types()
-------------------------------+------------------------------
Reporter: argaliano15 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.4
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by argaliano15):
When the status of this very bad change to the php engine goes from
'deprecated' to 'in effect', the result is going to be disastrous. This is
going to needlessly break code everywhere, it is basically sabotage.
It does not matter where the null comes from, it only matters that it
snuck through. You can either try to stop an unknown number of shooters
over which you have no control, or protect the target. This is simple
logic. Every instance of preg_match now needs to be checked against a null
input, every one in the entire WP codebase! This will be a very serious
problem.
PROFESSIONAL programmers would call this 'code hardening', and also
'proactive', 'responsible' and 'doing their job'. And the official
WordPress response to my warning - nitpick, and blame the messenger. This
is why I rarely bother reporting bugs in WordPress, I just hack them
myself. I guess I'll just add this one to my list.
Replying to [ticket:60003 argaliano15]:
> PHP ERROR:
>
> `Deprecated: preg_match(): Passing null to parameter #2 ($subject) of
type string is deprecated in /.../wp-includes/post.php on line 3308`
>
> FIX:
>
> change LINE 3308 to:
>
> {{{
> if ( $real && preg_match( "#$pattern#", $real )
> ^^^^^^^^^
> }}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60003#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list