php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1088 occasional failure of bitwise &
Submitted: 1999-01-21 16:44 UTC Modified: 1999-02-05 07:57 UTC
From: jda at dct dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.5 OS: Solaris 2.6
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: jda at dct dot com
New email:
PHP Version: OS:

 

 [1999-01-21 16:44 UTC] jda at dct dot com
if (!$z) { $z = 0; }
if (($z != 1) && ($z != 2) && ($z != 4) && ($z != 8) && ($z != 16) && 
    ($z !=32)) { $z = 0; }
if ($z == ($z & $thiscookie)) { $z = 0; }
$thiscookie += $z;

Tracing the value of $z through the above results in strange errors on the third line, where the following has occurred:
(a) $z=4, $thiscookie=59, if statement evaluated true and reset $z to 0.
(b) $z=1, $thiscookie=58, if statement evaluated true and reset $z to 0.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-02-05 07:57 UTC] zeev
Either something really weird about your Solaris 2.6 box, or you
haven't been tracing the value of $z properly.  When $z equals
4, the if expression evaluates to 4 == (0b100 & 0b111011), or
4 == 0, which is false, and thus the statements inside the if
block aren't executed.  The value of $z at the end of the script
is 4, and $thiscookie is 59+4 or 63.
I've tested this both under Solaris 2.5.1 and Linux.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 11:01:34 2025 UTC