Skip to content
This repository was archived by the owner on Apr 23, 2023. It is now read-only.
This repository was 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

Description

@lcts

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?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions