[wp-trac] [WordPress Trac] #54385: Fatal error uploading media on PHP8

WordPress Trac noreply at wordpress.org
Tue Nov 9 08:43:44 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:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by TobiasBg):

 Wouldn't it be better to make `wp_exif_frac2dec()` always return an int or
 float, as inline-documented, and as the name indicates?

 For the first `if`, a type conversion like
 `return 0 + $str; // Cast to int or float.`
 or
 `return (float) $str;`
 should be sufficient.

 For fallback after the second `if`, I would lean to
 `return 0;`
 as that's what a
 `(float) wp_exif_frac2dec( '0/0' );`
 as in the suggested patch would result in, too.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54385#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list