php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50083 Bit shift
Submitted: 2009-11-04 23:27 UTC Modified: 2010-12-20 09:29 UTC
From: talk at apfeldot dot de Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.3.0 OS: Win 7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-11-04 23:27 UTC] talk at apfeldot dot de
Description:
------------
I think there is an integer overflow, which should be prevented.

Reproduce code:
---------------
<?php

var_dump(1 << 33);

?>

Expected result:
----------------
There should be int(0), because the 1 was shifted out of the integer representation and the binary code should be 00000...00000.

Actual result:
--------------
int(2)
Binary represantation: 00...0010

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-20 09:29 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-12-20 09:29 UTC] jani@php.net
http://www.php.net/manual/en/language.operators.bitwise.php

There's big warning with note:

"Use functions from the gmp extension for bitwise manipulation on numbers beyond PHP_INT_MAX."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 13:01:32 2024 UTC