Skip to content

Commit 9445e61

Browse files
author
Fabio Bas
committed
fix: avoid warning from exif_imagetype() on corrupted png images
1 parent 1eb05d9 commit 9445e61

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/HTMLPurifier/URIScheme/data.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ public function doValidate(&$uri, $config, $context)
9393
}
9494
file_put_contents($file, $raw_data);
9595
if (function_exists('exif_imagetype')) {
96+
set_error_handler(array($this, 'muteErrorHandler'));
9697
$image_code = exif_imagetype($file);
98+
restore_error_handler();
9799
unlink($file);
98100
} elseif (function_exists('getimagesize')) {
99101
set_error_handler(array($this, 'muteErrorHandler'));

0 commit comments

Comments
 (0)