|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33933 64bit signed integer support on 32bit platforms
Submitted: 2005-07-31 01:33 UTC Modified: 2020-02-07 20:25 UTC
Avg. Score:4.5 ± 1.2
Reproduced:11 of 12 (91.7%)
Same Version:5 (45.5%)
Same OS:7 (63.6%)
From: php at aornis dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.0b3 OS: Any 32bit platform
Private report: No CVE-ID: None
 [2005-07-31 01:33 UTC] php at aornis dot com
Better support for 64bit integers would be very nice, for example when performing this operation:

$val = 0x1 << 32;
echo $val;

The value "1" is returned, due to the 32bit wrapping applied to the integer. Even when using type casts to float or double it doesn't extend beyond 32bits.

An extra type such as Int64 would be very useful.

Reproduce code:
$val = 0x1 << 32;
echo $val."\n";

(float)$val = (float)0x1 << 32;
echo $val;

Expected result:
It should output "4294967296" for both

Actual result:
It outputs "1" due to 32bit wrapping


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:43 UTC]
The bigints RFC would resolve this on 32-bit platforms:
 [2016-12-30 22:57 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2020-02-07 05:46 UTC]
Is this one still valid? Looks like it was already fixed:
 [2020-02-07 05:52 UTC]
-Summary: 64bit signed integer support +Summary: 64bit signed integer support on 32bit platforms
 [2020-02-07 05:52 UTC]
I think we can wontfix this: 64-bit is the norm, and bc/gmp are available to anyone who needs numbers larger than their system supports.
 [2020-02-07 20:25 UTC] php at aornis dot com
-: detonator316 at gmail dot com +: php at aornis dot com -Status: Open +Status: Closed
 [2020-02-07 20:25 UTC] php at aornis dot com
I filed this 15 years ago, it was a different time :) Closed.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 31 22:01:23 2021 UTC