mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
1d94fb86b7
Fixes GH-16371 Closes GH-16436
48 lines
729 B
PHP
48 lines
729 B
PHP
--TEST--
|
|
GH-16371: Assertion failure in zend_weakmap_iterator_get_current_key() for invalid iterator
|
|
--FILE--
|
|
<?php
|
|
|
|
$map = new WeakMap();
|
|
$it = $map->getIterator();
|
|
|
|
print "# Empty WeakMap\n";
|
|
|
|
var_dump($it->key());
|
|
var_dump($it->current());
|
|
var_dump($it->valid());
|
|
|
|
$map = new WeakMap();
|
|
$obj = new stdClass;
|
|
$map[$obj] = 0;
|
|
|
|
print "# Valid iterator\n";
|
|
|
|
$it = $map->getIterator();
|
|
var_dump($it->key());
|
|
var_dump($it->current());
|
|
var_dump($it->valid());
|
|
|
|
print "# End of iterator\n";
|
|
|
|
$it->next();
|
|
var_dump($it->key());
|
|
var_dump($it->current());
|
|
var_dump($it->valid());
|
|
|
|
?>
|
|
--EXPECTF--
|
|
# Empty WeakMap
|
|
NULL
|
|
NULL
|
|
bool(false)
|
|
# Valid iterator
|
|
object(stdClass)#%d (0) {
|
|
}
|
|
int(0)
|
|
bool(true)
|
|
# End of iterator
|
|
NULL
|
|
NULL
|
|
bool(false)
|