From 9adb0c7e42196b5cf19e1fb578b39e371cd37b46 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 1 Jul 2018 21:56:56 +0200 Subject: [PATCH] [Security/Http] report file+line of unserialization errors in Firewall/ContextListener --- .../Component/Security/Http/Firewall/ContextListener.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 4b0d41f17f..70885e6910 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -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); } }