|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73980 PHP error reporting is less strict for bools access as array than for arrays
Submitted: 2017-01-23 14:36 UTC Modified: 2017-01-23 16:08 UTC
From: benp at yelp dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.1.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
42 + 4 = ?
Subscribe to this entry?

 [2017-01-23 14:36 UTC] benp at yelp dot com
This is well-known from long-past bugs e.g., but it really should be reconsidered at some point for future language versions.

It's pretty nuts that undefined offset access is more strict for arrays than it is for booleans (and other objects). Booleans should probably be able to complain about being accessed as arrays.

Test script:
$boolean = true;
$array = [];
$boolean['hello']; // No error
$array['hello'];  // E_NOTICE

Expected result:
$boolean['hello'] should throw some error.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-23 16:08 UTC]
-Status: Open +Status: Duplicate -Package: PHP Language Specification +Package: Scripting Engine problem
 [2017-01-23 16:08 UTC]
Already considered and accepted, and while it's mostly implemented there are some issues to address.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 13:01:29 2024 UTC