summaryrefslogtreecommitdiff
path: root/Zend/tests/bug32993.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-06-06 08:24:05 +0000
committerDmitry Stogov <dmitry@php.net>2005-06-06 08:24:05 +0000
commit61054dbcd0a27ae7cc4785bf93331ddf77261698 (patch)
tree1ae3d7e2b873ce2ffae7c7fa84ce82c0b8401737 /Zend/tests/bug32993.phpt
parentcd88e646fd69ab1242cd331ca025048daca312b7 (diff)
downloadphp-git-61054dbcd0a27ae7cc4785bf93331ddf77261698.tar.gz
Fixed bug #32993 (implemented Iterator function current() don't throw exception)
Diffstat (limited to 'Zend/tests/bug32993.phpt')
-rwxr-xr-xZend/tests/bug32993.phpt29
1 files changed, 29 insertions, 0 deletions
diff --git a/Zend/tests/bug32993.phpt b/Zend/tests/bug32993.phpt
new file mode 100755
index 0000000000..88fb0230b6
--- /dev/null
+++ b/Zend/tests/bug32993.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #32993 (implemented Iterator function current() don't throw exception)
+--FILE--
+<?php
+class Test implements Iterator {
+
+ public $arr = array();
+
+ public function rewind() { return reset($this->arr); }
+ public function current() { throw new Exception(); }
+ public function key() { return key($this->arr); }
+ public function next() { return next($this->arr); }
+ public function valid() { return (current($this->arr) !== false); }
+}
+
+$t = new Test();
+$t->arr = array(1, 2, 3);
+
+try {
+ foreach ($t as $v) {
+ echo "$v\n";
+ }
+} catch (Exception $e) {
+ ; // handle exception
+}
+echo "ok\n";
+?>
+--EXPECT--
+ok