Ignore warnings about float to int casting on tcpdf_fonts#857
Ignore warnings about float to int casting on tcpdf_fonts#857renanrodrigo wants to merge 1 commit intotecnickcom:mainfrom
Conversation
The warning is being thrown in PHP 8.5, and it's breaking PDF generation in some cases, caught in tests executed on armhf systems. Fixes: tecnickcom#856
| */ | ||
|
|
||
| // Suppress warning about casting on armhf | ||
| set_error_handler(function($errno, $errstr) { |
There was a problem hiding this comment.
Okay, I was not expecting such a patch
it does not fix it but hides the warning
I guess some debuting is needed to fix it for real?
Or this error suppression could be done around the problematic lines?
There was a problem hiding this comment.
well yep.
This is ignoring the error just for the sake of the Ubuntu transition to PHP8.5, so we are not blocked, but the bug is still there - and it was there before, PHP is just complaining about it now...
I fear I don't have enough context to have a good solution for this issue soon, but I can look further in the future.
One thing I ended up doing for other packages is limiting it to 32bit PHP (by wrapping it in a check on PHP_INT_SIZE)
| // Suppress warning about casting on armhf | ||
| set_error_handler(function($errno, $errstr) { | ||
| return strpos($errstr, 'is not representable as an int') !== false; | ||
| }, E_WARNING); |
There was a problem hiding this comment.
Aside from that, I would prefer not to keep a diff in Ubuntu
can you send your patch in Debian salsa?
so you can sync the version afterwards
There was a problem hiding this comment.
Sure thing: once we agree on a good patch I can send it in salsa too (:
Good idea indeed |
The warning is being thrown in PHP 8.5, and it's breaking PDF generation in some cases, caught in tests executed on armhf systems.
Fixes: #856
If you think masking this error may be dangerous or mask real situations which should be taken care of, feel free to reject/modify the approach.
I think this is safe because it's a warning which happens only in 32bit systems, where the cast is already present anyway and the overflows are happening already :)