xref: /PHP-8.1/Zend/tests/bug34873.phpt (revision f8d79582)
1--TEST--
2Bug #34873 (Segmentation Fault on foreach in object)
3--FILE--
4<?php
5class pwa {
6    public $var;
7
8    function __construct(){
9        $this->var = array();
10    }
11
12    function test (){
13        $cont = array();
14        $cont["mykey"] = "myvalue";
15
16        foreach ($cont as $this->var['key'] => $this->var['value'])
17        var_dump($this->var['value']);
18    }
19}
20$myPwa = new Pwa();
21$myPwa->test();
22
23echo "Done\n";
24?>
25--EXPECT--
26string(7) "myvalue"
27Done
28