Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Catch Throwable instead of Exception as it would cover more cases
Signed-off-by: luxifr <[email protected]>
  • Loading branch information
luxifr authored Jan 1, 2023
commit 8d09145de3b9a2ea2d31416aed605157e41b8c3c
2 changes: 1 addition & 1 deletion lib/private/Metadata/Provider/ExifProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function execute(File $file): array {
if (!$data) {
try {
$sizeResult = getimagesizefromstring($file->getContent());
} catch (\Exception $ex) {
} catch (\Throwable $ex) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work:

php > try {getimagesize('foobar');} catch(\Throwable $e){}
PHP Warning:  getimagesize(foobar): Failed to open stream: No such file or directory in php shell code on line 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably same reason as in #36420 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would work from scan command because scan command converts warning into Exception, but that’s really ugly. It should be handled in Scan command as it is the one doing the conversion.

$this->logger->warning("Couldn't get image for ".$file->getId(), ['exception' => $ex]);
$sizeResult = false;
}
Expand Down