|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81265 getimagesize returns 0 for 256px ICO images
Submitted: 2021-07-16 00:40 UTC Modified: -
From: george at dietrich dot app Assigned:
Status: Closed Package: GetImageSize related
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 + 16 = ?
Subscribe to this entry?

 [2021-07-16 00:40 UTC] george at dietrich dot app
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 and

> 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, so I just with with irrelevant as it's been an issue since 5.3.0.

Test script:

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/"

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/"


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-16 01:06 UTC] george at dietrich dot app
The following pull request has been associated:

Patch Name: Fix bug 81265: Set ICO height/width to 256 if 0
On GitHub:
 [2021-07-16 08:08 UTC]
Automatic comment on behalf of Blacksmoke16 (author) and nikic (committer)
Log: Fix bug #81265: getimagesize returns 0 for 256px ICO images
 [2021-07-16 08:08 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 12:01:28 2024 UTC