|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78508 PHP does not emit a warning when some types are accessed with an index
Submitted: 2019-09-07 09:06 UTC Modified: 2019-09-07 09:10 UTC
From: michael dot vorisek at email dot cz Assigned: nikic (profile)
Status: Closed Package: *General Issues
PHP Version: 7.3.9 OS: Linux
Private report: No CVE-ID: None
 [2019-09-07 09:06 UTC] michael dot vorisek at email dot cz
I found out that current PHP does not emit warnings at least for the following expressions:

a) if boolean is accessed with index:

b) if null is accessed with index:

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-07 09:10 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2019-09-07 09:10 UTC]
A notice for this has already been added in PHP 7.4.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Apr 10 12:01:23 2021 UTC