Bug #70255 [NEW]: Bitwise AND behaviour in if statement

From: Date: Thu, 13 Aug 2015 00:17:37 +0000
Subject: Bug #70255 [NEW]: Bitwise AND behaviour in if statement
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195173@lists.php.net to get a copy of this message
From: cattyv10 at gmail dot com Operating system: Linux, (Windows maybe?) PHP version: 5.4.44 Package: *General Issues Bug Type: Bug Bug description:Bitwise AND behaviour in if statement Description: ------------ Strange behaviour with bitwise AND when used in if statements. Test script: --------------- <?php if(1&1 == 1&1) { echo "equal\n"; }else{ echo "not equal\n"; } //equal 0001 & 0001 if(1&3 == 1&3) { echo "equal\n"; }else{ echo "not equal\n"; } //not equal???? 0001 & 0011 if(2&2 == 2&2) { echo "equal\n"; }else{ echo "not equal\n"; } //not equal???? 0010 & 0010 ?> Expected result: ---------------- equal equal equal Actual result: -------------- equal not equal not equal -- Edit bug report at https://bugs.php.net/bug.php?id=70255&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70255&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70255&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70255&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70255&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70255&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70255&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70255&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70255&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70255&r=support Expected behavior: https://bugs.php.net/fix.php?id=70255&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70255&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70255&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70255&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70255&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70255&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70255&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70255&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70255&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70255&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70255&r=mysqlcfg

« previous php.bugs (#195173) next »