Skip to content
Newer
Older
100644 27 lines (23 sloc) 509 Bytes
8f523cb Fixed bug #49269 (Ternary operator fails on Iterator object when used…
Dmitry Stogov authored Aug 17, 2009
1 --TEST--
2 Bug #49269 (Ternary operator fails on Iterator object when used inside foreach declaration).
3 --FILE--
4 <?php
5 class TestObject implements Iterator
6 {
7 public $n = 0;
8 function valid()
9 {
10 return ($this->n < 3);
11 }
12 function current() {return $this->n;}
13 function next() {$this->n++;}
14 function key() { }
15 function rewind() {$this->n = 0;}
16 }
17
18
19 $array_object = new TestObject();
20
21 foreach ((true ? $array_object : $array_object) as $item) echo "$item\n";
22 ?>
23 --EXPECT--
24 0
25 1
26 2
Something went wrong with that request. Please try again.