Skip to content

Commit 9093fa6

Browse files
committed
Use try/finally to restore error handlers
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 37a4d73 commit 9093fa6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

DeprecationErrorHandler/Deprecation.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ public function __construct($message, array $trace, $file)
102102
}
103103

104104
set_error_handler(function () {});
105-
$parsedMsg = unserialize($this->message);
106-
restore_error_handler();
105+
try {
106+
$parsedMsg = unserialize($this->message);
107+
} finally {
108+
restore_error_handler();
109+
}
107110
if ($parsedMsg && isset($parsedMsg['deprecation'])) {
108111
$this->message = $parsedMsg['deprecation'];
109112
$this->originClass = $parsedMsg['class'];

0 commit comments

Comments
 (0)