File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug31102.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #31102 (Exception not handled when thrown inside __autoload())
    3: --FILE--
    4: <?php
    5: 
    6: $test = 0;
    7: 
    8: function __autoload($class)
    9: {
   10: 	global $test;
   11: 
   12: 	echo __METHOD__ . "($class,$test)\n";
   13: 	switch($test)
   14: 	{
   15: 	case 1:
   16: 		eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
   17: 		return;
   18: 	case 2:
   19: 		eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
   20: 		throw new Exception(__METHOD__);
   21: 		return;
   22: 	case 3:
   23: 		return;
   24: 	}
   25: }
   26: 
   27: while($test++ < 5)
   28: {
   29: 	try
   30: 	{
   31: 		eval("\$bug = new Test$test();");
   32: 	}
   33: 	catch (Exception $e)
   34: 	{
   35: 		echo "Caught: " . $e->getMessage() . "\n";
   36: 	}
   37: }
   38: ?>
   39: ===DONE===
   40: <?php exit(0); ?>
   41: --EXPECTF--
   42: __autoload(Test1,1)
   43: Caught: Test1::__construct
   44: __autoload(Test2,2)
   45: Caught: __autoload
   46: __autoload(Test3,3)
   47: 
   48: Fatal error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code on line 1

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>