icofileloader icon indicating copy to clipboard operation
icofileloader copied to clipboard

Getting some warnings

Open oscarotero opened this issue 5 years ago • 4 comments
trafficstars

Hi, thanks for this great library. I'm getting some repetitive errors with some icons. Each time a icon fails, I get the following 5 warnings consecutively:

PHP Warning:  unpack(): Type L: not enough input, need 4, have 3 in .../vendor/lordelph/icofileloader/src/IcoParser.php on line 43
PHP Notice:  Trying to access array offset on value of type bool in .../vendor/lordelph/icofileloader/src/IcoParser.php on line 44
PHP Warning:  unpack(): Type S: not enough input, need 2, have 1 in .../vendor/lordelph/icofileloader/src/IcoParser.php on line 30
PHP Notice:  Trying to access array offset on value of type bool in .../vendor/lordelph/icofileloader/src/IcoParser.php on line 31
PHP Notice:  Trying to access array offset on value of type bool in .../vendor/lordelph/icofileloader/src/IcoParser.php on line 31

Maybe adding some conditions to avoid these errors or silence them with @ and throw an exception would be very helpful.

oscarotero avatar Jan 04 '20 23:01 oscarotero

Can you send the ico file this happens with?

lordelph avatar Jan 05 '20 11:01 lordelph

Not sure, is a cron process that handle hundred of icons. These errors are in the log file. I'm going to investigate.

oscarotero avatar Jan 05 '20 17:01 oscarotero

Ok, seems like some favicons are not ico or png files, but jpg or gif and this library does not handle these formats. I fixed it using this library only for ico files and gd functions for any other format.

oscarotero avatar Jan 07 '20 12:01 oscarotero

thanks for checking - I'll leave this issue open and either add support for loading jpg/gif or make it throw a more obvious exception

lordelph avatar Jan 07 '20 12:01 lordelph