Req #65484 [Opn]: Accessing null variable as array over key
Edit report at https://bugs.php.net/bug.php?id=65484&edit=1
ID: 65484
Updated by: requinix@php.net
Reported by: jan dot kahoun at heureka dot cz
Summary: Accessing null variable as array over key
Status: Open
Type: Feature/Change Request
-Package: *General Issues
+Package: Scripting Engine problem
-PHP Version: Irrelevant
+PHP Version: 5.5.2
Block user comment: N
Private report: N
New Comment:
See also
bug #37676 using Array access operator [] on boolean variable does not show Notice
bug #40692 Trying to use boolean as array doesn't give an error
and a part of
bug #62769 Inconsistent notice reporting using []
Previous Comments:
------------------------------------------------------------------------
[2013-08-20 08:02:27] jan dot kahoun at heureka dot cz
Description:
------------
If you define variable as NULL and then you want to acces it over keys as array
like $array['kolo'] then PHP should trigger a strict error and not return the NULL.
Test script:
---------------
<?php
$array = null;
var_dump($array['kolo']);
/*
Expected result:
PHP strict error
Actual result:
NULL
*/
Expected result:
----------------
Expected is PHP strict error.
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65484&edit=1
Thread (4 messages)