1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/spl/tests/SplObjectStorage_current_empty_storage.phpt
Nikita Popov 58f3f751ca Throw from SplObjectStorage::current() for invalid iterator
Accessing key()/current() on an invalid iterator is an error
condition. Throw instead of returning null.
2021-07-14 12:34:39 +02:00

21 lines
383 B
PHP

--TEST--
Check that SplObjectStorage::current() throws when iterator invalid
--CREDITS--
PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
--FILE--
<?php
$s = new SplObjectStorage();
var_dump($s->valid());
try {
var_dump($s->current());
} catch (RuntimeException $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(false)
Called current() on invalid iterator