Annotation of embedaddon/php/Zend/tests/catch_004.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Catching an exception in a constructor inside a static method
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: class MyObject
        !             7: {
        !             8:        function fail()
        !             9:        {
        !            10:                throw new Exception();
        !            11:        }
        !            12: 
        !            13:        function __construct()
        !            14:        {
        !            15:                self::fail();
        !            16:                echo __METHOD__ . "() Must not be reached\n";
        !            17:        }
        !            18: 
        !            19:        function __destruct()
        !            20:        {
        !            21:                echo __METHOD__ . "() Must not be called\n";
        !            22:        }
        !            23:        
        !            24:        static function test()
        !            25:        {
        !            26:                try
        !            27:                {
        !            28:                        new MyObject();
        !            29:                }
        !            30:                catch(Exception $e)
        !            31:                {
        !            32:                        echo "Caught\n";
        !            33:                }
        !            34:        }
        !            35: }
        !            36: 
        !            37: MyObject::test();
        !            38: 
        !            39: ?>
        !            40: ===DONE===
        !            41: --EXPECT--
        !            42: Caught
        !            43: ===DONE===

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