These variables are set when the putmsg function is called to redirect error messages (see here):
putmsg
$errnum, $errscript, $errline, $errmsg, $errfunc, $errvfunc, $errpid, $errthreadname, $errthreadid, $errtime