- set_error_handler: documentation ( source)
<?php
function eh($type, $message, $file, $line, $context)
{
unset($context['GLOBALS']);
throw new Exception();
}
set_error_handler('eh');
try {
$a->b;
} catch (\Exception $e) {
$trace = $e->getTrace();
$trace = $trace[0]['args'][4];
echo isset($trace['GLOBALS']);
}