From 88466c6a49880a22a132295b900570c518b27786 Mon Sep 17 00:00:00 2001 From: vlakoff <544424+vlakoff@users.noreply.github.com> Date: Tue, 27 May 2025 07:58:35 +0200 Subject: [PATCH] Simplify GIF magic number detection (#1446) Removed unnecessary bin2hex() conversion. --- src/Drivers/AbstractDecoder.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Drivers/AbstractDecoder.php b/src/Drivers/AbstractDecoder.php index 029761ba..cdf94352 100644 --- a/src/Drivers/AbstractDecoder.php +++ b/src/Drivers/AbstractDecoder.php @@ -24,10 +24,7 @@ abstract class AbstractDecoder implements DecoderInterface { $head = substr($input, 0, 6); - return 1 === preg_match( - "/^47494638(37|39)61/", - strtoupper(bin2hex($head)) - ); + return $head === 'GIF87a' || $head === 'GIF89a'; } /**