php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33933 64bit signed integer support
Submitted: 2005-07-31 01:33 UTC Modified: 2016-12-30 22:57 UTC
Votes:13
Avg. Score:4.5 ± 1.2
Reproduced:11 of 12 (91.7%)
Same Version:5 (45.5%)
Same OS:7 (63.6%)
From: detonator316 at gmail dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 5.1.0b3 OS: Any 32bit platform
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-07-31 01:33 UTC] detonator316 at gmail dot com
Description:
------------
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:43 UTC] ajf@php.net
The bigints RFC would resolve this on 32-bit platforms: http://wiki.php.net/rfc/bigint
 [2016-12-30 22:57 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC