Annotation of embedaddon/php/Zend/tests/bug32674.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #32674 (exception in iterator causes crash)
3: --FILE--
4: <?php
5: class collection implements Iterator {
6:
7: private $_elements = array();
8:
9: public function __construct() {
10: }
11:
12: public function rewind() {
13: reset($this->_elements);
14: }
15:
16: public function count() {
17: return count($this->_elements);
18: }
19:
20: public function current() {
21: $element = current($this->_elements);
22: return $element;
23: }
24:
25: public function next() {
26: $element = next($this->_elements);
27: return $element;
28: }
29:
30: public function key() {
31: $this->_fillCollection();
32: $element = key($this->_elements);
33: return $element;
34: }
35:
36: public function valid() {
37: throw new Exception('shit happend');
38:
39: return ($this->current() !== false);
40: }
41: }
42:
43: class class2 {
44: public $dummy;
45: }
46:
47: $obj = new class2();
48: $col = new collection();
49:
50: try {
51: foreach($col as $co) {
52: //irrelevant
53: }
54: echo 'shouldn`t get here';
55: //$dummy = 'this will not crash';
56: $obj->dummy = 'this will crash';
57: } catch (Exception $e) {
58: echo "ok\n";
59: }
60: ?>
61: --EXPECT--
62: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>