wp-cli / media-command

Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
MIT License
44 stars 41 forks source link

Fix read error detection in EXIF discovery #162

Closed schlessera closed 2 years ago

schlessera commented 2 years ago

Try to detect a read error while discovering EXIF properties in an image file.

On older PHP versions, the detection just fails returning anything for $metadata. However, with newer PHP versions, it returns an array with only a 'filesize' key.

This PR adapts the logic to account for this and to fix a test failure on bad JPGs that was introduced by that new behavior. Testing · wp-cli_automated-tests@9e9164f - Google Chrome 2022-09-02 at 11 29 09 AM