bug73209.phpt 572 B

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