From 9445e616bc255e06c669c22ce7a436f4756071fe Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 1 Oct 2025 12:05:45 +0200 Subject: [PATCH] fix: avoid warning from exif_imagetype() on corrupted png images --- library/HTMLPurifier/URIScheme/data.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/HTMLPurifier/URIScheme/data.php b/library/HTMLPurifier/URIScheme/data.php index 02e540cb..2648de4a 100644 --- a/library/HTMLPurifier/URIScheme/data.php +++ b/library/HTMLPurifier/URIScheme/data.php @@ -93,7 +93,9 @@ public function doValidate(&$uri, $config, $context) } file_put_contents($file, $raw_data); if (function_exists('exif_imagetype')) { + set_error_handler(array($this, 'muteErrorHandler')); $image_code = exif_imagetype($file); + restore_error_handler(); unlink($file); } elseif (function_exists('getimagesize')) { set_error_handler(array($this, 'muteErrorHandler'));