[wp-trac] [WordPress Trac] #54385: Fatal error uploading media on PHP8
WordPress Trac
noreply at wordpress.org
Tue Nov 23 17:24:45 UTC 2021
#54385: Fatal error uploading media on PHP8
-------------------------------------------------+-------------------------
Reporter: stevegs | Owner:
| adamsilverstein
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.9
Component: Media | Version: 2.5
Severity: normal | Resolution:
Keywords: php8 has-patch needs-dev-note has- | Focuses:
unit-tests commit |
-------------------------------------------------+-------------------------
Comment (by jrf):
After discussion with @adamsilverstein and with his permission, I've added
a few commits to the [https://github.com/WordPress/wordpress-
develop/pull/1841 draft PR on GitHub] to stabilize the proposed solution
further.
The solution I propose:
* Maintains BC for ''valid'' inputs.
* Fixes handling of ''invalid'' inputs to be in line with the documented
(original) return type of `int|float` by returning `0`.
* Safeguards the behaviour via tests for all possible ways code could flow
through the function.
* Safeguards the BC of the `wp_read_image_metadata()` by adding some
defensive coding around the calls to the `wp_exif_frac2dec()` function.
Let me know what you all think of the current proposed solution.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54385#comment:42>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list