Skip to content

Ignore warnings about float to int casting on tcpdf_fonts#857

Open
renanrodrigo wants to merge 1 commit intotecnickcom:mainfrom
renanrodrigo:fix-armhf-cast-warning
Open

Ignore warnings about float to int casting on tcpdf_fonts#857
renanrodrigo wants to merge 1 commit intotecnickcom:mainfrom
renanrodrigo:fix-armhf-cast-warning

Conversation

@renanrodrigo
Copy link

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 :)

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
@CLAassistant
Copy link

CLAassistant commented Feb 25, 2026

CLA assistant check
All committers have signed the CLA.

*/

// Suppress warning about casting on armhf
set_error_handler(function($errno, $errstr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing: once we agree on a good patch I can send it in salsa too (:

@williamdes
Copy link
Contributor

(by wrapping it in a check on PHP_INT_SIZE

Good idea indeed
Plus moving your patch around the problematic lines would be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test fails on armhf with PHP 8.5 due to warning about casting values to int

3 participants