Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #29368 (The destructor is called when an exception is thrown from the constru..

Decoded Output download

--TEST--
Bug #29368 (The destructor is called when an exception is thrown from the constructor)
--FILE--
<?php

class Foo
{
    function __construct()
    {
        echo __METHOD__ . "
";
        throw new Exception;
    }
    function __destruct()
    {
        echo __METHOD__ . "
";
    }
}

try
{
    $bar = new Foo;
} catch(Exception $exc)
{
    echo "Caught exception!
";
}

unset($bar);

?>
--EXPECT--
Foo::__construct
Caught exception!

Did this file decode correctly?

Original Code

--TEST--
Bug #29368 (The destructor is called when an exception is thrown from the constructor)
--FILE--
<?php

class Foo
{
    function __construct()
    {
        echo __METHOD__ . "\n";
        throw new Exception;
    }
    function __destruct()
    {
        echo __METHOD__ . "\n";
    }
}

try
{
    $bar = new Foo;
} catch(Exception $exc)
{
    echo "Caught exception!\n";
}

unset($bar);

?>
--EXPECT--
Foo::__construct
Caught exception!

Function Calls

None

Variables

None

Stats

MD5 9936440710d468157d356be81ec4b70d
Eval Count 0
Decode Time 92 ms