mirror of
https://github.com/php/php-src.git
synced 2024-12-20 15:30:38 +08:00
c42b7dd6d3
No notice is thrown for list() accesses, because we did not come to an agreement regarding patterns like while ([$key, $value] = yield $it->next()) { ... } where silent null access may be desirable. No effort is made to suppress multiple notices in access chains likes $x[0][0][0], because the technical complexity this causes does not seem worthwhile. RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
43 lines
723 B
PHP
43 lines
723 B
PHP
--TEST--
|
|
Testing isset accessing undefined array itens and properties
|
|
--FILE--
|
|
<?php
|
|
|
|
$a = 'foo';
|
|
$b =& $a;
|
|
|
|
var_dump(isset($b));
|
|
|
|
var_dump(isset($a[0], $b[1]));
|
|
|
|
var_dump(isset($a[0]->a));
|
|
|
|
var_dump(isset($c[0][1][2]->a->b->c->d));
|
|
|
|
var_dump(isset(${$a}->{$b->{$c[$d]}}));
|
|
|
|
var_dump(isset($GLOBALS));
|
|
|
|
var_dump(isset($GLOBALS[1]));
|
|
|
|
var_dump(isset($GLOBALS[1]->$GLOBALS));
|
|
|
|
?>
|
|
--EXPECTF--
|
|
bool(true)
|
|
bool(true)
|
|
bool(false)
|
|
bool(false)
|
|
|
|
Notice: Undefined variable: c in %s on line %d
|
|
|
|
Notice: Undefined variable: d in %s on line %d
|
|
|
|
Notice: Trying to access array offset on value of type null in %s on line %d
|
|
|
|
Notice: Trying to get property '' of non-object in %s on line %d
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(false)
|