|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76257 NULL can be used as an array without warning
Submitted: 2018-04-23 21:01 UTC Modified: 2021-11-03 14:42 UTC
From: smileytechguy at smileytechguy dot com Assigned: cmb (profile)
Status: Duplicate Package: Arrays related
PHP Version: 7.2.4 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: smileytechguy at smileytechguy dot com
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.


 [2018-04-23 21:01 UTC] smileytechguy at smileytechguy dot com
The special constant NULL or any value which is null can be used as an array without error, warning, or notice.

PHP version:

PHP 7.2.4 (cli) (built: Mar 28 2018 04:27:01) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Test script:
$foo = NULL;
var_dump($foo[0]); // will output NULL
var_dump($foo["bar"]); // will also output NULL

Expected result:
Throw at least a warning, showing that NULL was used in an invalid way.

Actual result:
NULL is returned


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-23 21:22 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2018-04-23 21:22 UTC]
This is basically a duplicate of request #37676.  Note that there
is a respective RFC[1] which already has been accepted, but not
implemented yet.

[1] <>
 [2021-11-03 14:36 UTC]
-Summary: NULL can be used as an array without essay +Summary: NULL can be used as an array without warning
 [2021-11-03 14:42 UTC]
-Block user comment: No +Block user comment: Yes
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 16:01:28 2024 UTC