Bug #71400 [Opn]: null assignment as array strange results

From: Date: Sun, 17 Jan 2016 22:57:07 +0000
Subject: Bug #71400 [Opn]: null assignment as array strange results
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198737@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71400&edit=1

 ID:                 71400
 User updated by:    rav dot janisz at gmail dot com
 Reported by:        rav dot janisz at gmail dot com
-Summary:            tested on 5.5.29 php version
+Summary:            null assignment as array strange results
 Status:             Open
 Type:               Bug
 Package:            Arrays related
 Operating System:   linux
 PHP Version:        5.5.31
 Block user comment: N
 Private report:     N

 New Comment:

wrong summary


Previous Comments:
------------------------------------------------------------------------
[2016-01-17 22:39:57] rav dot janisz at gmail dot com

Description:
------------
null assignment to a variable and refer to it as an array element does not return any errors

after assign null to variable var_dump return null and isset return false, but why in line 5 assign
first element of $zonk variable(which is don't array and don't should exists at all) to
next variable doesnt't return any errors

Test script:
---------------
$zonk = null;            //1
var_dump($zonk);         //2 return null
var_dump(isset($zonk));  //3 return false

$beret = $zonk[0];       //5 don't throw nothing ???
var_dump($beret);        //6 return null
var_dump(isset($beret)); //7 return false

Expected result:
----------------
is line 6 don't should throw something to output error or notice?
or if it is good behavior then in line 3 isset should return true?
or if i'm wrong explain why? becouse i can't figured it out



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71400&edit=1


Thread (4 messages)

« previous php.bugs (#198737) next »