di costruzione per le eccezioni di PHP ha terzo parametro, documentation dice:Come implementare eccezione concatenamento in PHP
$previous: The previous exception used for the exception chaining.
ma non riesco a farlo funzionare. Il mio codice è simile al seguente:
try
{
throw new Exception('Exception 1', 1001);
}
catch (Exception $ex)
{
throw new Exception('Exception 2', 1002, $ex);
}
mi aspetto Eccezione 2 per essere gettato e mi aspetto che avrà Eccezione 1 allegata. Ma tutto quello che ottengo è:
Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in ...
Cosa sto facendo male?
Qual è la versione di PHP? – EFraim