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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: talk at apfeldot dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Nov 01 13:00:01 2025 UTC