mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
Accessing key()/current() on an invalid iterator is an error condition. Throw instead of returning null.
21 lines
383 B
PHP
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
|