Bug #81265 [NEW]: getimagesize returns 0 for 256px ICO images

From: Date: Fri, 16 Jul 2021 00:40:11 +0000
Subject: Bug #81265 [NEW]: getimagesize returns 0 for 256px ICO images
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235072@lists.php.net to get a copy of this message
From: george at dietrich dot app Operating system: All PHP version: Irrelevant Package: GetImageSize related Bug Type: Bug Bug description:getimagesize returns 0 for 256px ICO images Description: ------------ Using getimagesize on a .ico file that is 256px wide or 256px high will result in that value being returned at 0 due to the value being stored as 0 in the header as per https://devblogs.microsoft.com/oldnewthing/20101022-00/?p=12473 and https://en.wikipedia.org/wiki/ICO_(file_format): > The value 0 is accepted as representing a width or height of 256. > Can be any number between 0 and 255. Value 0 means 256 pixels. Wasn't sure what version to pick as the bug is like 14 years old (introduced via https://github.com/php/php-src/commit/c76e8e03a1cc67d695b1fa024924a462ca897434), so I just with with irrelevant as it's been an issue since 5.3.0. Test script: --------------- var_dump(getimagesize("https://raw.githubusercontent.com/toy/image_size/master/spec/images/ico/32x256.ico")); Expected result: ---------------- array(6) { [0]=> int(32) [1]=> int(256) [2]=> int(17) [3]=> string(21) "width="32" height="256"" ["bits"]=> int(8) ["mime"]=> string(24) "image/vnd.microsoft.icon" } Actual result: -------------- array(6) { [0]=> int(32) [1]=> int(0) [2]=> int(17) [3]=> string(21) "width="32" height="0"" ["bits"]=> int(8) ["mime"]=> string(24) "image/vnd.microsoft.icon" } -- Edit bug report at https://bugs.php.net/bug.php?id=81265&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81265&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81265&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81265&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81265&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81265&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81265&r=support Expected behavior: https://bugs.php.net/fix.php?id=81265&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81265&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81265&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81265&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81265&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81265&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81265&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81265&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81265&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81265&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81265&r=mysqlcfg

« previous php.bugs (#235072) next »