Bug #78508 [Opn->Csd]: PHP does not emit a warning when some types are accessed with an index
| From: | nikic@php.net | Date: | Sat, 07 Sep 2019 09:10:51 +0000 |
| Subject: | Bug #78508 [Opn->Csd]: PHP does not emit a warning when some types are accessed with an index | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222618@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78508&edit=1
ID: 78508
Updated by: nikic@php.net
Reported by: michael dot vorisek at email dot cz
Summary: PHP does not emit a warning when some types are
accessed with an index
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 7.3.9
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
A notice for this has already been added in PHP 7.4.
Previous Comments:
------------------------------------------------------------------------
[2019-09-07 09:06:04] michael dot vorisek at email dot cz
Description:
------------
I found out that current PHP does not emit warnings at least for the following expressions:
a) if boolean is accessed with index:
false['x']
b) if null is accessed with index:
null['x']
in contrary with string type, which emits the following message:
Warning: Illegal string offset 'x'...
Notice: Uninitialized string offset: 0
I would expect PHP to emit at least Notice warning.
Is this a bug which needs to be addressed or is this an intended behaviour for some use
case/backcompatibility that requires no warning?
Test script:
---------------
see desc.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78508&edit=1