Doc #80452 [ReO->Csd]: Null Coalesce Operator Swallow warning error
| From: | phpdocbot@php.net | Date: | Tue, 01 Dec 2020 12:22:11 +0000 |
| Subject: | Doc #80452 [ReO->Csd]: Null Coalesce Operator Swallow warning error | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18170@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80452&edit=1
ID: 80452
Updated by: phpdocbot@php.net
Reported by: cxlblm at gmail dot com
Summary: Null Coalesce Operator Swallow warning error
-Status: Re-Opened
+Status: Closed
Type: Documentation Problem
Package: *General Issues
Operating System: docker/ubuntu
PHP Version: 8.0.0
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=9c098f1e964f310c423844fafb1f8fb4399e4064
Log: Fix #80452: Null Coalesce Operator Swallow warning error
Previous Comments:
------------------------------------------------------------------------
[2020-12-01 12:20:14] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=351816
Log: Fix #80452: Null Coalesce Operator Swallow warning error
------------------------------------------------------------------------
[2020-12-01 12:12:37] cmb@php.net
Ah, I see. The docs need to updated in this regard.
------------------------------------------------------------------------
[2020-12-01 11:59:42] rtrtrtrtrt at dfdfdfdf dot dfd
> Accessing a scalar as an array before php8 will trigger
> a notice, but in php8 it will trigger a warning!
how does that change the simple fact that the purpose of "Null Coalesce" is either take
the left part if it's defined or take the right part?
NOTICE versus WARNING is only relevant for error_reporting
------------------------------------------------------------------------
[2020-12-01 11:55:00] cxlblm at gmail dot com
Sorry, my English not good!
see https://3v4l.org/bX1Q1
According to the description of rfc(https://wiki.php.net/rfc/isset_ternary), Null Coalesce Operator
will only suppress notice message.
Accessing a scalar as an array before php8 will trigger a notice, but in php8 it will trigger a
warning!
------------------------------------------------------------------------
[2020-12-01 11:40:08] cmb@php.net
Yes, that is the whole purpose of the null coalesce operator:
<https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce>.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80452
--
Edit this bug report at https://bugs.php.net/bug.php?id=80452&edit=1