php-src/Zend/tests/illegal_offset_unset_isset_empty.phpt
Nikita Popov 2354aa9676 Add test for illegal unset/isset offset
Weirdly these warnings had zero coverage previously...

Remove an incorrect exception checking optimization: The key
lookup may throw (it could also throw previously, though only
through a custom error handler).
2019-09-27 13:00:07 +02:00

28 lines
473 B
PHP

--TEST--
Using unset(), isset(), empty() with an illegal array offset throws
--FILE--
<?php
$ary = [];
try {
unset($ary[[]]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
isset($ary[[]]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
empty($ary[[]]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Illegal offset type in unset
Illegal offset type in isset or empty
Illegal offset type in isset or empty