Constructor for PHP's exception has third parameter, documentation says:
$previous: The previous exception used for the exception chaining.
But I can't make it work. My code looks like this:
try
{
throw new Exception('Exception 1', 1001);
}
catch (Exception $ex)
{
throw new Exception('Exception 2', 1002, $ex);
}
I expect Exception 2 to be thrown and I expect that it will have Exception 1 attached. But all I get is:
Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in ...
What am I doing wrong?