Skip to content

Commit 5685f0c

Browse files
committed
Use try/finally to restore error handlers
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent d685d0c commit 5685f0c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Filesystem.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,15 +737,10 @@ private static function box(callable $func, ...$args)
737737
self::$lastError = null;
738738
set_error_handler(__CLASS__.'::handleError');
739739
try {
740-
$result = $func(...$args);
740+
return $func(...$args);
741+
} finally {
741742
restore_error_handler();
742-
743-
return $result;
744-
} catch (\Throwable $e) {
745743
}
746-
restore_error_handler();
747-
748-
throw $e;
749744
}
750745

751746
/**

0 commit comments

Comments
 (0)