Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#54009 closed defect (bug) (duplicate)

Image upload fails with ambiguous error.

Reported by: quantumzen's profile quantumzen Owned by: adamsilverstein's profile adamsilverstein
Milestone: Priority: normal
Severity: normal Version: 5.8
Component: Media Keywords: php8
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Error message:
Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.

ajax error content:

  Fatal error:  Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float,
  string given in C:\***\wp-admin\includes\image.php:844
  Stack trace:
  #0 C:\***\wp-admin\includes\image.php(844): round()
  #1 C:\***\wp-admin\includes\media.php(380): wp_read_image_metadata()
  #2 C:\***\wp-admin\includes\ajax-actions.php(2549): media_handle_upload()
  #3 C:\***\wp-admin\async-upload.php(33): wp_ajax_upload_attachment()
  #4 {main} thrown in C:\***\wp-admin\includes\image.php on line 844

line 844:

$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );

Images with a meta > camera > aperture of 0 seem to cause this error.
An aperture value of 0 can occur if the camera is using a manual lens with no connector pins, for example an adapted vintage lens.

Attachments (2)

photo-meta-example.PNG (24.8 KB) - added by quantumzen 3 years ago.
Sugarloaf Mountain.jpg (45.2 KB) - added by quantumzen 3 years ago.

Download all attachments as: .zip

Change History (8)

#1 follow-up: @adamsilverstein
3 years ago

Hi @quantumzen thanks for the detailed bug report. Can you provide a sample image that causes the error? That way we can reproduce the issue and test out proposed fixes.

#2 @SergeyBiryukov
3 years ago

  • Description modified (diff)
  • Keywords php8 added
  • Milestone changed from Awaiting Review to 5.9

Hi there, welcome to WordPress Trac! Thanks for the report.

This seems related to PHP 8.0, adding the keyword.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 1 @quantumzen
3 years ago

@adamsilverstein No problem. Please see the new attachment.

#4 @adamsilverstein
3 years ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

Hi @quantumzen - I started working on https://core.trac.wordpress.org/ticket/54385 and it looks like this is the same issue.

If possible, can you test the patch from that ticket to verify it fixes your upload issue? (it did in my testing) - https://core.trac.wordpress.org/attachment/ticket/54385/54385.2.diff

#5 @adamsilverstein
3 years ago

  • Milestone 5.9 deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Closing as a duplicate of #54385 where we are working on this issue.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.