icofileloader
icofileloader copied to clipboard
Getting some warnings
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.
Can you send the ico file this happens with?
Not sure, is a cron process that handle hundred of icons. These errors are in the log file. I'm going to investigate.
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.
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