Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

PHPUnit tests fail on 32bit systems due to out-of-bounds integer. #84

Open
lcts opened this issue Aug 4, 2021 · 0 comments
Open

PHPUnit tests fail on 32bit systems due to out-of-bounds integer. #84

lcts opened this issue Aug 4, 2021 · 0 comments

Comments

@lcts
Copy link
Contributor

lcts commented Aug 4, 2021

Hi,
when running the test suite on 32bit systems (I tested on ARM & x86), tests fail with

There were 2 errors:

1) FG\Test\ASN1\Universal\BitStringTest::testContent
TypeError: dechex(): Argument #1 ($num) must be of type int, float given

/builddir/build/BUILDROOT/php-fgrosse-phpasn1-2.3.0-1.fc35.arm/usr/share/php/FG/ASN1/Universal/OctetString.php:28
/builddir/build/BUILDROOT/php-fgrosse-phpasn1-2.3.0-1.fc35.arm/usr/share/php/FG/ASN1/Universal/BitString.php:32
/builddir/build/BUILD/PHPASN1-20299033c35f4300eb656e7e8e88cf52d1d6694e/tests/ASN1/Universal/BitStringTest.php:45

2) FG\Test\ASN1\Universal\OctetStringTest::testContent
TypeError: dechex(): Argument #1 ($num) must be of type int, float given

/builddir/build/BUILDROOT/php-fgrosse-phpasn1-2.3.0-1.fc35.arm/usr/share/php/FG/ASN1/Universal/OctetString.php:28
/builddir/build/BUILD/PHPASN1-20299033c35f4300eb656e7e8e88cf52d1d6694e/tests/ASN1/Universal/OctetStringTest.php:45

I think what happens here is that the number used for testing, 0xA01200C3, exceeds PHP_INT_MAX on 32bit and so gets cast to float before being passed to dechex().

Is the library supposed to be able to deal with larger ints in there or is this just an error in the tests?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant