I am using print_r($exception->getTrace()); and I get the below error. I want an answer why this error occures when using print_r. When using var_dump it does not occur.
https://www.php.net/manual/en/exception.gettrace.php
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98570240 bytes) in
try {
}
catch (Exception $exception) {
$a = print_r($exception->getTrace()); //memory issue
var_dump($exception->getTrace()); //works fine
}
Update:
getTraceAsString() solved this issue in some cases.