0
0
mirror of https://github.com/php/php-src.git synced 2024-12-18 14:30:35 +08:00
php-src/Zend/tests/bug76901.phpt
Nikita Popov 294fb83ee8 Fixed bug
get_method() may modify the object pointer passed to it if method
forwarding is used. In this case we do not want to modify the
passed zval, so make sure that we copy the object into a temporary
first.
2018-09-19 09:37:04 +02:00

19 lines
317 B
PHP

--TEST--
Bug #76901: method_exists on SPL iterator passthrough method corrupts memory
--FILE--
<?php
$it = new ArrayIterator([1, 2, 3]);
$it = new IteratorIterator($it);
foreach ($it as $v) {
if (method_exists($it, 'offsetGet')) {
var_dump($it->offsetGet(0));
}
}
?>
--EXPECT--
int(1)
int(1)
int(1)