cvs: ZendEngine2 /tests bug48228.phpt bug48408.phpt bug48409.phpt bug48428.phpt

[email protected] ("Arnaud Le Blanc") Mon, 01 Jun 2009 16:10:13 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvslbarnaud1243872613@cvsserver>
lbarnaud		Mon Jun  1 16:10:13 2009 UTC

  Added files:                 
    /ZendEngine2/tests	bug48228.phpt bug48408.phpt bug48409.phpt 
                      	bug48428.phpt 
  Log:
  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.
  
  

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug48228.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug48228.phpt
+++ ZendEngine2/tests/bug48228.phpt
--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

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug48408.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug48408.phpt
+++ ZendEngine2/tests/bug48408.phpt
--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

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug48409.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug48409.phpt
+++ ZendEngine2/tests/bug48409.phpt
--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

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug48428.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug48428.phpt
+++ ZendEngine2/tests/bug48428.phpt
--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