Bug #80452 [Opn->Fbk]: Null Coalesce Operator Swallow warning error
Edit report at https://bugs.php.net/bug.php?id=80452&edit=1
ID: 80452
Updated by: cmb@php.net
Reported by: cxlblm at gmail dot com
Summary: Null Coalesce Operator Swallow warning error
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: docker/ubuntu
PHP Version: 8.0.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
From looking at <https://3v4l.org/4JIAY>, this
doesn't appear to
be a bug. The warning is raised in line 5, where the null
coalesce operator is not used.
Previous Comments:
------------------------------------------------------------------------
[2020-12-01 11:14:54] cxlblm at gmail dot com
Description:
------------
RFC Null Coalesce Operator:
This means the $_GET['mykey'] ?? "" is completely safe and will not raise an
E_NOTICE!
Test script:
---------------
$a = false;
var_dump($a['abc'] ?? '');
Expected result:
----------------
Warning: Trying to access array offset on value of type bool in /in/4JIAY
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80452&edit=1
Thread (6 messages)