From: Operating system: Linux version 2.6.35-22-generic- PHP version: 5.3.3 Package: Unknown/Other Function Bug Type: Bug Bug description:'or' and '?:' operators has diferent behaviors
Description: ------------ The test script returns the following: 0 or 2 or 1 => 1 0 ?: 2 ?: 1 => 2 0 or 2 ?: 1 => 1 0 ?: 2 or 1 => 1 Is it desired? Test script: --------------- <?php $a = 0; $b = 2; $c = 1; echo $a.' or '.$b.' or '.$c.' => '; echo $a or $b or $c; echo "<br>\n"; echo $a.' ?: '.$b.' ?: '.$c.' => '; echo $a ?: $b ?: $c; echo "<br>\n"; echo $a.' or '.$b.' ?: '.$c.' => '; echo $a or $b ?: $c; echo "<br>\n"; echo $a.' ?: '.$b.' or '.$c.' => '; echo $a ?: $b or $c; echo "<br>\n"; Expected result: ---------------- 0 or 2 or 1 => 2 0 ?: 2 ?: 1 => 2 0 or 2 ?: 1 => 2 0 ?: 2 or 1 => 2 Actual result: -------------- 0 or 2 or 1 => 1 0 ?: 2 ?: 1 => 2 0 or 2 ?: 1 => 1 0 ?: 2 or 1 => 1 -- Edit bug report at http://bugs.php.net/bug.php?id=53168&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53168&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53168&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53168&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53168&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53168&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53168&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53168&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53168&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53168&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53168&r=support Expected behavior: http://bugs.php.net/fix.php?id=53168&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53168&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53168&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53168&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53168&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53168&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53168&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53168&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53168&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53168&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53168&r=mysqlcfg
