Annotation of embedaddon/php/tests/classes/destructor_and_exceptions.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ZE2 catch exception thrown in destructor
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class FailClass
                      7: {
                      8:        public $fatal;
                      9: 
                     10:        function __destruct()
                     11:        {
                     12:                echo __METHOD__ . "\n";
                     13:                throw new exception("FailClass");
                     14:                echo "Done: " . __METHOD__ . "\n";
                     15:        }
                     16: }
                     17: 
                     18: try
                     19: {
                     20:        $a = new FailClass;
                     21:        unset($a);
                     22: }
                     23: catch(Exception $e)
                     24: {
                     25:        echo "Caught: " . $e->getMessage() . "\n";
                     26: }
                     27: 
                     28: class FatalException extends Exception
                     29: {
                     30:        function __construct($what)
                     31:        {
                     32:                echo __METHOD__ . "\n";
                     33:                $o = new FailClass;
                     34:                unset($o);
                     35:                echo "Done: " . __METHOD__ . "\n";
                     36:        }
                     37: }
                     38: 
                     39: try
                     40: {
                     41:        throw new FatalException("Damn");
                     42: }
                     43: catch(Exception $e)
                     44: {
                     45:        echo "Caught Exception: " . $e->getMessage() . "\n";
                     46: }
                     47: catch(FatalException $e)
                     48: {
                     49:        echo "Caught FatalException: " . $e->getMessage() . "\n";
                     50: }
                     51: 
                     52: ?>
                     53: ===DONE===
                     54: --EXPECTF--
                     55: FailClass::__destruct
                     56: Caught: FailClass
                     57: FatalException::__construct
                     58: FailClass::__destruct
                     59: Caught Exception: FailClass
                     60: ===DONE===

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