|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: george at dietrich dot app
New email:
PHP Version: OS:


 [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: Thu Jun 20 20:01:30 2024 UTC