Bug #79053 [Com]: No error is reported when using null coalescing operator
| From: | bugreports at gmail dot com | Date: | Wed, 01 Jan 2020 13:28:45 +0000 |
| Subject: | Bug #79053 [Com]: No error is reported when using null coalescing operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224645@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79053&edit=1
ID: 79053
Comment by: bugreports at gmail dot com
Reported by: rubencm at gmail dot com
Summary: No error is reported when using null coalescing
operator
Status: Open
Type: Bug
Package: *General Issues
PHP Version: 7.4.1
Block user comment: N
Private report: N
New Comment:
taht's the whole point of null coalescing operator
Previous Comments:
------------------------------------------------------------------------
[2020-01-01 13:27:09] rubencm at gmail dot com
Description:
------------
When I try to access to an array offset on a boolean, a notice (a warning in master) is thrown.
<?php
false['']; // php notice: "Trying to access array offset on value of type bool"
?>
But when I use the null coalescing operator with it, that error isn't reported
<?php
false['']??false; // false, no error
?>
I'm not sure, but I think it's not the expected behavior, since possible errors are
hidden.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79053&edit=1