Bug #79970 [NEW]: Null coalescing operator needs to have a higher precedence value
| From: | folarin at engineer dot com | Date: | Thu, 13 Aug 2020 12:43:42 +0000 |
| Subject: | Bug #79970 [NEW]: Null coalescing operator needs to have a higher precedence value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228569@lists.php.net to get a copy of this message | ||
From: folarin at engineer dot com
Operating system:
PHP version: Irrelevant
Package: *Programming Data Structures
Bug Type: Bug
Bug description:Null coalescing operator needs to have a higher precedence value
Description:
------------
Look at the following example
$var1 = true
$var2 = true
if($var1??false && $var2)
echo 'Passed"
else
echo 'Failed'
The above expresion always prints 'Failed' which isn't the expected
behaviour.
Just like the Parenthesis, the null-coalescing operator should ALWAYS be
expressed first.
This now causes the unwanted, over-expressive use of parenthesis to
remedy the cause ALL THE TIME:
if(($var1??false) && ($var2??false))...
why do I have to do the above when none of
--
Edit bug report at https://bugs.php.net/bug.php?id=79970&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79970&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79970&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79970&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79970&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79970&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79970&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79970&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79970&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79970&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79970&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79970&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79970&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79970&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79970&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79970&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79970&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79970&r=mysqlcfg