xref: /PHP-8.4/ext/spl/tests/bug73209.phpt (revision f14b6f49)
1--TEST--
2Bug #73209: RecursiveArrayIterator does not iterate object properties
3--FILE--
4<?php
5
6class hello {
7  public $props = array();
8  function __construct() {
9    $this->props = ['hello' => 5, 'props' => ['keyme' => ['test' => 5]]];
10  }
11}
12$data = new hello();
13
14$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($data), RecursiveIteratorIterator::SELF_FIRST);
15echo "Expect to see all keys in ->props here: \n";
16
17foreach($iterator as $k=>$v) {
18    echo $k . "\n";
19}
20
21?>
22--EXPECT--
23Expect to see all keys in ->props here:
24props
25hello
26props
27keyme
28test
29