summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug31926.phpt
blob: 428039b1cb46f1c4406da154055abb8ecdd41abc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--TEST--
Bug #31926 (php in free() error with RecursiveArrayIterator)
--FILE--
<?php

$array = array(0 => array('world'));

class RecursiveArrayIterator extends ArrayIterator implements
RecursiveIterator {
   function hasChildren() {
       return (is_array($this->current()));
   }

   function getChildren() {
       return new self($this->current());
   }
}

$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
foreach($it as $key => $val) {
   var_dump($key, $val);
}

?>
--EXPECT--
int(0)
string(5) "world"