Bug #79053 [Com]: No error is reported when using null coalescing operator

From: Date: Wed, 01 Jan 2020 13:37:42 +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-224646@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: rubencm 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: Well, in this case the notice is being reported, that still don't have much sense for me. <?php function bar() { trigger_error("foo", E_USER_NOTICE); return null; } var_dump(bar()??false); Previous Comments: ------------------------------------------------------------------------ [2020-01-01 13:28:45] bugreports at gmail dot com taht's the whole point of null coalescing operator ------------------------------------------------------------------------ [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

« previous php.bugs (#224646) next »