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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 16:01:36 2024 UTC