Changes between Initial Version and Version 1 of Ticket #54385, comment 16
- Timestamp:
- 11/16/2021 09:29:27 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #54385, comment 16
initial v1 7 7 8 8 Old line 844: 9 $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); 9 `$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );` 10 10 New line 844: 11 $meta['aperture'] = round( (float) wp_exif_frac2dec( $exif['FNumber'] ), 2 ); 11 `$meta['aperture'] = round( (float) wp_exif_frac2dec( $exif['FNumber'] ), 2 );` 12 12 13 13 and the original image now loads fine. 14 14 15 I've noticed wp_exif_frac2dec() appears in 2 other locations in image.php: in both cases the return is locally cast to a string. From my relatively newbie point of view, since this is an arithmetic function, it should always return a float. It should then be the responsibility of anything that calls it to recast to a string (or whatever else) to suit its own purpose. But then, as others have pointed out here, there is the risk something elsewhere that calls the function will break under PHP8 if it hasn't done any recasting required. Happy grepping!15 I've noticed wp_exif_frac2dec() appears in 2 other locations in image.php: in both these cases the return is locally cast to a string. From my relatively newbie point of view, since this is an arithmetic function, it should always return a float. It should then be the responsibility of anything that calls it to recast to a string (or whatever else) to suit its own purpose. But then, as others have pointed out here, there is the risk something elsewhere that calls the function will break under PHP8 if it hasn't done any recasting required. Happy grepping! 16 16 17 17 Meanwhile, I have advised our photographer to bring her photos into Paintshop Pro, which strips out all the EXIF info, before uploading.