WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#30138 new defect (bug)

Problem of getting the size (width and height) for .ico file

Reported by: solidcolour Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.0
Component: Media Keywords: 2nd-opinion
Focuses: Cc:

Description

Trying to use wp_get_attachment_metadata() or wp_get_attachment_image_src() functions to get .ico image size, but it always returns wrong values.

wp_get_attachment_metadata() returns 0, 0 (width, height) wp_get_attachment_image_src() returns 1, 1 (width, height)

And the Twenty Fourteen theme gets an error, when viewing the file (click View via Media Library).

Warning: Illegal string offset... Notice: Uninitialized string offset...

Change History (2)

This ticket was mentioned in Slack in #core by jorbin. View the logs.


3 years ago

#2 @jorbin
3 years ago

  • Keywords 2nd-opinion added

Thanks for the report solidcolour. The issue is that the underlying php function getimagesize only supports ico files in php 5.3.0.

I think what core should do in this situation is:

1) check if IMAGETYPE_ICO is not defined 2) return false if it is not and we are presented with an ico file 3) add some documentation around this (and use it as further encouragement to get off 5.2)

Note: See TracTickets for help on using tickets.