Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9da0454

Browse filesBrowse files
committed
minor #27795 [Security/Http] report file+line of unserialization errors in Firewall/ContextListener (nicolas-grekas)
This PR was merged into the 4.2-dev branch. Discussion ---------- [Security/Http] report file+line of unserialization errors in Firewall/ContextListener | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 9adb0c7 [Security/Http] report file+line of unserialization errors in Firewall/ContextListener
2 parents 9efa555 + 9adb0c7 commit 9da0454
Copy full SHA for 9da0454

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎src/Symfony/Component/Security/Http/Firewall/ContextListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/ContextListener.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ private function safelyUnserialize($serializedToken)
218218
$prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
219219
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler) {
220220
if (__FILE__ === $file) {
221-
throw new \UnexpectedValueException($msg, 0x37313bc);
221+
throw new \ErrorException($msg, 0x37313bc, $type, $file, $line);
222222
}
223223

224224
return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false;
@@ -231,7 +231,7 @@ private function safelyUnserialize($serializedToken)
231231
restore_error_handler();
232232
ini_set('unserialize_callback_func', $prevUnserializeHandler);
233233
if ($e) {
234-
if (!$e instanceof \UnexpectedValueException || 0x37313bc !== $e->getCode()) {
234+
if (!$e instanceof \ErrorException || 0x37313bc !== $e->getCode()) {
235235
throw $e;
236236
}
237237
if ($this->logger) {
@@ -247,6 +247,6 @@ private function safelyUnserialize($serializedToken)
247247
*/
248248
public static function handleUnserializeCallback($class)
249249
{
250-
throw new \UnexpectedValueException('Class not found: '.$class, 0x37313bc);
250+
throw new \ErrorException('Class not found: '.$class, 0x37313bc);
251251
}
252252
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.