mirror of
https://github.com/php/php-src.git
synced 2025-01-05 18:33:56 +08:00
7a4b594c6f
Make this consistent with the corresponding engine behavior. Also adjust the messages to match.
40 lines
680 B
PHP
40 lines
680 B
PHP
--TEST--
|
|
ArrayObject illegal offset
|
|
--FILE--
|
|
<?php
|
|
|
|
$ao = new ArrayObject([1, 2, 3]);
|
|
try {
|
|
var_dump($ao[[]]);
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
$ao[[]] = new stdClass;
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
$ref =& $ao[[]];
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
var_dump(isset($ao[[]]));
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
unset($ao[[]]);
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Illegal offset type
|
|
Illegal offset type
|
|
Illegal offset type
|
|
Illegal offset type in isset or empty
|
|
Illegal offset type in unset
|