Skip to content

64-bit integers are not supported by 32-bit builds of PHP at src/MysqlDataType.php:479 #135

@person004

Description

@person004

PHP 8.2 on 32-bit machine using DietPi(https://dietpi.com).

  1. I met following message when I used prepared statement($db->prepare). This did not happen when I used $db->query.
    server.error : '64-bit integers are not supported by 32-bit builds of PHP at src/MysqlDataType.php:479'

  2. I changed code like below at src/MysqlDataType.php

478 /*
479 if (\PHP_INT_SIZE <= 4) {
480 throw new \RuntimeException('64-bit integers are not supported by 32-bit builds of>
481 }
482 */
483
484 //$result = \unpack("P", $bytes, $offset)[1];
485 $result = \unpack("V", $bytes, $offset)[1];

the reason I changed from P to V.

V unsigned long (always 32 bit, little endian byte order)
P unsigned long long (always 64 bit, little endian byte order)

at https://www.php.net/manual/en/function.pack.php

It works well now, I can not propose something like pull request cause I do not know well about unpack function and amphp/mysql.

I just hope amphp/mysql supports 32-bit machine too!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions