mirror of
https://github.com/php/php-src.git
synced 2024-09-23 19:07:26 +00:00
14bdb0cfc7
* Change a number of "resource used as offset" notices to warnings, which were previously missed. * Throw the "resource used as offset" warning for isset() as well. * Make array_key_exists() behavior with regard to different key types consistent with isset() and normal array accesses. All key types now use the usual coercions and array/object keys throw TypeError. Closes GH-4887.
43 lines
727 B
PHP
43 lines
727 B
PHP
--TEST--
|
|
Testing isset accessing undefined array items 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)
|
|
|
|
Warning: Undefined variable: c in %s on line %d
|
|
|
|
Warning: Undefined variable: d in %s on line %d
|
|
|
|
Warning: Trying to access array offset on value of type null in %s on line %d
|
|
|
|
Warning: Trying to get property '' of non-object in %s on line %d
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(false)
|