summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorArnaud Le Blanc <lbarnaud@php.net>2009-06-01 16:10:13 +0000
committerArnaud Le Blanc <lbarnaud@php.net>2009-06-01 16:10:13 +0000
commita2412a68cd04df7e8f83d12373e4a2bbe758d2d3 (patch)
tree97e9392843b4c429feee60a42dfe1b62ac22e10d /Zend
parent07f2ac9f0aa8094c1e72d487163449264d932f47 (diff)
downloadphp-git-a2412a68cd04df7e8f83d12373e4a2bbe758d2d3.tar.gz
New tests
# These tests were failing on different configurations, so adding them # all to get more chances of seeing one failing in case of problem.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug48228.phpt32
-rw-r--r--Zend/tests/bug48408.phpt30
-rw-r--r--Zend/tests/bug48409.phpt67
-rw-r--r--Zend/tests/bug48428.phpt13
4 files changed, 142 insertions, 0 deletions
diff --git a/Zend/tests/bug48228.phpt b/Zend/tests/bug48228.phpt
new file mode 100644
index 0000000000..2add69c340
--- /dev/null
+++ b/Zend/tests/bug48228.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #48228 (crash when exception is thrown while passing function arguments)
+--FILE--
+<?
+
+function do_throw() {
+ throw new Exception();
+}
+
+class aa
+{
+ function check()
+ {
+ }
+
+ function dosome()
+ {
+ $this->check(do_throw());
+ }
+}
+$l_aa=new aa();
+
+$l_aa->dosome();
+?>
+--EXPECTF--
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 %s(%d): do_throw()
+#1 %s(%d): aa->dosome()
+#2 {main}
+ thrown in %s
diff --git a/Zend/tests/bug48408.phpt b/Zend/tests/bug48408.phpt
new file mode 100644
index 0000000000..20a019807b
--- /dev/null
+++ b/Zend/tests/bug48408.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #48408 (crash when exception is thrown while passing function arguments)
+--FILE--
+<?php
+class B{
+ public function process($x){
+ return $x;
+ }
+}
+class C{
+ public function generate($x){
+ throw new Exception;
+ }
+}
+$b = new B;
+$c = new C;
+try{
+ $b->process($c->generate(0));
+}
+catch(Exception $e){
+ $c->generate(0);
+}
+?>
+--EXPECTF--
+
+Fatal error: Uncaught exception 'Exception' in %s
+Stack trace:
+#0 %s(%d): C->generate(0)
+#1 {main}
+ thrown in %s
diff --git a/Zend/tests/bug48409.phpt b/Zend/tests/bug48409.phpt
new file mode 100644
index 0000000000..238b52ed74
--- /dev/null
+++ b/Zend/tests/bug48409.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Bug #48409 (crash when exception is thrown while passing function arguments)
+--FILE--
+<?php
+
+class ABCException extends Exception {}
+
+class BBB
+{
+ public function xyz($d, $x)
+ {
+ if ($x == 34) {
+ throw new ABCException;
+ }
+ return array('foo' => 'xyz');
+ }
+}
+
+class CCC
+{
+ public function process($p)
+ {
+ return $p;
+ }
+}
+
+class AAA
+{
+ public function func()
+ {
+ $b = new BBB;
+ $c = new CCC;
+ $i = 34;
+ $item = array('foo' => 'bar');
+ try {
+ $c->process($b->xyz($item['foo'], $i));
+ }
+ catch(ABCException $e) {
+ $b->xyz($item['foo'], $i);
+ }
+ } // end func();
+}
+
+class Runner
+{
+ public function run($x)
+ {
+ try {
+ $x->func();
+ }
+ catch(ABCException $e) {
+ throw new Exception;
+ }
+ }
+}
+
+try {
+ $runner = new Runner;
+ $runner->run(new AAA);
+}
+catch(Exception $e) {
+ die('Exception thrown');
+}
+
+?>
+--EXPECT--
+Exception thrown
diff --git a/Zend/tests/bug48428.phpt b/Zend/tests/bug48428.phpt
new file mode 100644
index 0000000000..ae9ac936a3
--- /dev/null
+++ b/Zend/tests/bug48428.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #48428 (crash when exception is thrown while passing function arguments)
+--FILE--
+<?php
+try {
+ function x() { throw new Exception("ERROR"); }
+ x(x());
+} catch(Exception $e) {
+ echo($e -> getMessage());
+}
+?>
+--EXPECT--
+ERROR