[Debug] prevent infinite loop with faulty exception handlers
This commit is contained in:
parent
fad59b3ce7
commit
5f397f8dcf
@ -561,6 +561,8 @@ class ErrorHandler
|
|||||||
|
|
||||||
$handler = self::$reservedMemory = null;
|
$handler = self::$reservedMemory = null;
|
||||||
$handlers = array();
|
$handlers = array();
|
||||||
|
$previousHandler = null;
|
||||||
|
$sameHandlerLimit = 10;
|
||||||
|
|
||||||
while (!is_array($handler) || !$handler[0] instanceof self) {
|
while (!is_array($handler) || !$handler[0] instanceof self) {
|
||||||
$handler = set_exception_handler('var_dump');
|
$handler = set_exception_handler('var_dump');
|
||||||
@ -570,7 +572,14 @@ class ErrorHandler
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
restore_exception_handler();
|
restore_exception_handler();
|
||||||
array_unshift($handlers, $handler);
|
|
||||||
|
if ($handler !== $previousHandler) {
|
||||||
|
array_unshift($handlers, $handler);
|
||||||
|
$previousHandler = $handler;
|
||||||
|
} elseif (0 === --$sameHandlerLimit) {
|
||||||
|
$handler = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach ($handlers as $h) {
|
foreach ($handlers as $h) {
|
||||||
set_exception_handler($h);
|
set_exception_handler($h);
|
||||||
|
Reference in New Issue
Block a user