Quantcast
Channel: Serverphorums.com
Viewing all articles
Browse latest Browse all 23908

[PHP-DEV] Possible Bug or Bad Expectations?

$
0
0
Hi all,

I am conflicted as per if what I experience in this code should be
throwing a notice in E_STRICT:

http://3v4l.org/srm5f

<?php
error_reporting(E_ALL);
$foo = ['bar' => ['baz' => 5]];
$bar = ['box' => 'baz'];

// this will Notice: Undefined index: boom
var_dump(isset($foo['bar'][$bar['boom']]));


Essentially, my expectation is that anything inside an isset() would be
immune from notices of undefined indexes, but that is not the case with
nested array key lookups.

Is this a bad expectation to have? Or should isset() silence the nested
undefined index as well? I also realized this has always been the
behavior leading me to believe I might have a bad expectation here. In
any case wanted to check.

Thanks,
-ralph

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Viewing all articles
Browse latest Browse all 23908

Trending Articles