[wp-trac] [WordPress Trac] #50913: PHP 8.0: various compatibility fixes
WordPress Trac
noreply at wordpress.org
Fri Sep 18 22:04:57 UTC 2020
#50913: PHP 8.0: various compatibility fixes
-------------------------------------------+-------------------------------
Reporter: jrf | Owner: SergeyBiryukov
Type: task (blessed) | Status: reviewing
Priority: normal | Milestone: 5.6
Component: General | Version:
Severity: normal | Resolution:
Keywords: php8 has-patch needs-dev-note | Focuses: coding-standards
-------------------------------------------+-------------------------------
Comment (by SergeyBiryukov):
Replying to [comment:10 SergeyBiryukov]:
> In [changeset:"48960" 48960]:
>
> Code Modernization: Correct the check for negative post IDs in
`WP_Query::parse_query()` to work as expected on PHP 8.
>
> PHP 8 changes the way string to number comparisons are performed:
https://wiki.php.net/rfc/string_to_number_comparison
>
> In particular, checking if an empty string is less than zero in PHP 8
evaluates to `true`, not `false`.
Just noting that I checked other instances of `< 0` in core to see if any
of them involve an empty string, but it doesn't look like they are
affected. Most of them already explicitly cast the left part to `(int)`,
and the rest are unlikely to contain a string either. If someone would
like to double-check that, please do :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50913#comment:34>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list