[wp-trac] [WordPress Trac] #54385: Fatal error uploading media on PHP8
WordPress Trac
noreply at wordpress.org
Tue Nov 23 14:42:42 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 adamsilverstein):
> So should we step back and consider what we are trying to achieve with
this function? Trying to be 'all things to all men' adds huge
complication. But if image.php is just being used to generate various
sizes of images for quicker downloading to web browsers (as it is in my
case), no EXIF info is needed at all.
The main purpose of this function is handle image uploads by normalizing
EXIF data. The main point of this ticket is to address the issue with
images that cause PHP 8 to throw a fatal error.
The original function was written to return the passed value when it
didn't look like a fraction and we probably need to stick to that behavior
because in many cases EXIF data comes in an unexpected form.
> Just allowing a string to be returned will not, on its own, fix the
original error I reported: namely line 844 of image.php expects a numeric.
So it would become the responsibility of the calling function to cast
appropriately.
Good point! I dove so deep into fixing the function I removed that bit. I
think the fix here is just casting the return to a float before rounding
it.
> Though I suspect cameras that return (eg.) 0/0 have not recorded shutter
speed, in which case a return of 0 would be appropriate (but certainly not
a string or a NULL).
Passing "0/0" will return "0/0" - the stored exif value. I don't think we
should change that, at this point it es expected behavior.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54385#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list