xref: /PHP-8.1/Zend/tests/bug76901.phpt (revision 294fb83e)
1--TEST--
2Bug #76901: method_exists on SPL iterator passthrough method corrupts memory
3--FILE--
4<?php
5
6$it = new ArrayIterator([1, 2, 3]);
7$it = new IteratorIterator($it);
8foreach ($it as $v) {
9    if (method_exists($it, 'offsetGet')) {
10        var_dump($it->offsetGet(0));
11    }
12}
13
14?>
15--EXPECT--
16int(1)
17int(1)
18int(1)
19