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

Latest commit

 

History

History
History
43 lines (39 loc) · 1.03 KB

File metadata and controls

43 lines (39 loc) · 1.03 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace core;
/**
* Temporarily disable the error handler.
* Useful when calling legacy code and you don't want the
* new code to get written as sloppy as the old because of
* missing strictness.
*/
class Error
{
private static $handler = null;
private static $handlex = null;
public static function mute()
{
if (self::$handler !== null) {
throw new \Exception("Already muted, deverr calling it twice");
}
self::$handler = set_error_handler(function ($errno, $errstr, $errfile, $errline) {
//error_log("Error::mute ($errfile:$errline) $errno: $errstr";);
return true;
});
self::$handlex = set_exception_handler(function ($e) {
return true;
});
return self::$handler;
}
public static function unmute()
{
if (self::$handler === null) {
throw new \Exception("Already unmuted, deverr calling it without setting");
}
$handler = self::$handler;
$handlex = self::$handlex;
self::$handler = null;
self::$handlex = null;
set_exception_handler($handlex);
return set_error_handler($handler);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.