Bug #78568 [NEW]: Incorrect evaluation of ?? and ? containing expression

From: Date: Thu, 19 Sep 2019 16:30:36 +0000
Subject: Bug #78568 [NEW]: Incorrect evaluation of ?? and ? containing expression
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222830@lists.php.net to get a copy of this message
From: carlos at wfmh dot org dot pl Operating system: Linux PHP version: 7.3.9 Package: *General Issues Bug Type: Bug Bug description:Incorrect evaluation of ?? and ? containing expression Description: ------------ Incorrect evaluation of ?? and ? containing expression. This code produces incorrect results: <?php $result = 20; $success = false; $result = $result ?? $success ? "TRUE" : "FALSE"; var_dump($result); would output "TRUE" instead of expected 20. Workaround is to put ternary into brackets: <?php $result = 20; $success = false; $result = $result ?? ($success ? "TRUE" : "FALSE"); var_dump($result); and then the result is as expected 20. -- Edit bug report at https://bugs.php.net/bug.php?id=78568&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78568&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78568&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78568&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78568&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78568&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78568&r=support Expected behavior: https://bugs.php.net/fix.php?id=78568&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78568&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78568&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78568&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78568&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78568&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78568&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78568&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78568&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78568&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78568&r=mysqlcfg

« previous php.bugs (#222830) next »