Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function __construct()
- {
- static::$__flag = (~0)<<static::__MASK;
- static::$__mask = ~static::$__flag;
- static::$__catchError =
- [
- "#failed to open stream#" =>
- [
- 'msg' => "IO::Failed to open stream with",
- 'code' => 1<<static::IO_READ | 1<<static::ILLI_EXIT
- ],
- "#Filename cannot be empty#" =>
- [
- 'msg' => "Filename cannot be empty",
- 'code' => 1<<static::IO_PATH_EMPTY | 1<<static::ILLI_EXIT
- ],
- "#open_basedir#" =>
- [
- 'msg' => "Access denied",
- 'code' => 1<<static::IO_OPEN_BASE | 1<<static::ILLI_EXIT
- ]
- ];
- set_error_handler( array( __CLASS__, 'e' ) );
- register_shutdown_function( array( __CLASS__, 'e' ) );
- }
- public static function e($errno = 0, $errstr = 'unknown', $errfile = 'unknown', $errline = 'NaN', $context = NULL)
- {
- if($errno === 0)
- return FALSE;
- foreach (static::$__catchError as $regexp => $res)
- if(preg_match($regexp,$errstr,$match))
- throw new \Exception($res['msg']."\n\n".$errstr, $res['code']|( $errno & static::__MASK));
- throw new \Exception($errstr, ( $errno & static::__MASK ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement