Make WordPress Core

Opened 5 months ago

Closed 2 months ago

#54009 closed defect (bug) (duplicate)

Image upload fails with ambiguous error.

Reported by: quantumzen Owned by: 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 5 months ago.
Sugarloaf Mountain.jpg (45.2 KB) - added by quantumzen 5 months ago.

Download all attachments as: .zip

Change History (7)

#1 follow-up: @adamsilverstein
5 months 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
5 months 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 5 months ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 1 @quantumzen
5 months ago

@adamsilverstein No problem. Please see the new attachment.

#4 @adamsilverstein
2 months 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
2 months 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.

Note: See TracTickets for help on using tickets.