|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71400 null assignment as array strange results
Submitted: 2016-01-17 22:39 UTC Modified: 2016-01-17 22:57 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: rav dot janisz at gmail dot com Assigned:
Status: Open Package: Arrays related
PHP Version: 5.5.31 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: rav dot janisz at gmail dot com
New email:
PHP Version: OS:


 [2016-01-17 22:39 UTC] rav dot janisz at gmail dot com
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-17 22:57 UTC] rav dot janisz at gmail dot com
-Summary: tested on 5.5.29 php version +Summary: null assignment as array strange results
 [2016-01-17 22:57 UTC] rav dot janisz at gmail dot com
wrong summary
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 19:01:26 2019 UTC