xref: /PHP-8.2/ext/spl/tests/gh11178.phpt (revision 81e50b4e)
1--TEST--
2GH-11178 (Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18))
3--FILE--
4<?php
5#[AllowDynamicProperties]
6class A implements IteratorAggregate {
7    function __construct() {
8        $this->{'x'} = 1;
9    }
10
11    function getIterator(): Traversable {
12        return new ArrayIterator($this);
13    }
14}
15
16$obj = new A;
17
18foreach ($obj as $k => &$v) {
19    $v = 3;
20}
21
22var_dump($obj);
23?>
24--EXPECT--
25object(A)#1 (1) {
26  ["x"]=>
27  &int(3)
28}
29