Skip to content

Commit 090095a

Browse files
[Filesystem] Fix usages of error_get_last()
1 parent 79fe1ed commit 090095a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

SplFileInfo.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ public function getRelativePathname()
6666
*/
6767
public function getContents()
6868
{
69-
$level = error_reporting(0);
69+
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
7070
$content = file_get_contents($this->getPathname());
71-
error_reporting($level);
71+
restore_error_handler();
7272
if (false === $content) {
73-
$error = error_get_last();
74-
throw new \RuntimeException($error['message']);
73+
throw new \RuntimeException($error);
7574
}
7675

7776
return $content;

0 commit comments

Comments
 (0)