summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xZend/tests/bug30725.phpt32
1 files changed, 32 insertions, 0 deletions
diff --git a/Zend/tests/bug30725.phpt b/Zend/tests/bug30725.phpt
new file mode 100755
index 0000000000..511ab815f3
--- /dev/null
+++ b/Zend/tests/bug30725.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach)
+--FILE--
+<?php
+
+class Test implements IteratorAggregate
+{
+ function getIterator()
+ {
+ throw new Exception();
+ }
+}
+
+try
+{
+ $it = new Test;
+ foreach($it as $v)
+ {
+ echo "Fail\n";
+ }
+ echo "Wrong\n";
+}
+catch(Exception $e)
+{
+ echo "Caught\n";
+}
+
+?>
+===DONE===
+---EXPECT---
+Caught
+===DONE===