xref: /PHP-8.2/Zend/tests/bug34310.phpt (revision f8d79582)
1--TEST--
2Bug #34310 (foreach($arr as $c->d => $x) crashes)
3--FILE--
4<?php
5
6class C
7{
8    public $d;
9}
10
11$c = new C();
12
13$arr = array (1 => 'a', 2 => 'b', 3 => 'c');
14
15// Works fine:
16foreach($arr as $x => $c->d)
17{
18    echo "{$x} => {$c->d}\n";
19}
20
21// Crashes:
22foreach($arr as $c->d => $x)
23{
24    echo "{$c->d} => {$x}\n";
25}
26
27?>
28--EXPECT--
291 => a
302 => b
313 => c
321 => a
332 => b
343 => c
35