[Security/Http] report file+line of unserialization errors in Firewall/ContextListener
This commit is contained in:
parent
9efa555191
commit
9adb0c7e42
@ -218,7 +218,7 @@ class ContextListener implements ListenerInterface
|
||||
$prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
|
||||
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler) {
|
||||
if (__FILE__ === $file) {
|
||||
throw new \UnexpectedValueException($msg, 0x37313bc);
|
||||
throw new \ErrorException($msg, 0x37313bc, $type, $file, $line);
|
||||
}
|
||||
|
||||
return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false;
|
||||
@ -231,7 +231,7 @@ class ContextListener implements ListenerInterface
|
||||
restore_error_handler();
|
||||
ini_set('unserialize_callback_func', $prevUnserializeHandler);
|
||||
if ($e) {
|
||||
if (!$e instanceof \UnexpectedValueException || 0x37313bc !== $e->getCode()) {
|
||||
if (!$e instanceof \ErrorException || 0x37313bc !== $e->getCode()) {
|
||||
throw $e;
|
||||
}
|
||||
if ($this->logger) {
|
||||
@ -247,6 +247,6 @@ class ContextListener implements ListenerInterface
|
||||
*/
|
||||
public static function handleUnserializeCallback($class)
|
||||
{
|
||||
throw new \UnexpectedValueException('Class not found: '.$class, 0x37313bc);
|
||||
throw new \ErrorException('Class not found: '.$class, 0x37313bc);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user