/** * php error handler * * @param string $errorno error code * @param string $errstr error string * @param string $errfile error file * @param string $errline error line * @param string $context error context * */ public function errorHandler($errno, $errstr, $errfile, $errline, $context) { $message = "{$errno} in {$errfile}({$errline}): {$errstr}"; if (\Singleton::Error()) { switch ($errno) { case E_ERROR: $level = "FATAL"; Singleton::Error()->error($message); //$this->log("$level $errno in $errfile($errline): $errstr", ERR_FATAL); break; case ERROR: $level = "ERROR"; \Singleton::Error()->error($message); //$this->log("$level $errno in $errfile($errline): $errstr", ERR_NORMAL); break; case E_WARNING: \Singleton::Error()->warn($message); $level = "WARNING"; //$this->log("$level $errno in $errfile($errline): $errstr", ERR_WARNING); break; case E_NOTICE: \Singleton::Error()->debug($message); $level = "NOTICE"; //$this->log("$level $errno in $errfile($errline): $errstr",ERR_NOTICE); break; case E_STRICT: $level = "NOTICE"; \Singleton::Error()->debug($message); //$this->log("$level $errno in $errfile($errline): $errstr",ERR_NOTICE); break; default: /* echo "<b>".$errstr."</b><br>"; print_stack(); return;*/ $level = "NOTICE"; \Singleton::Error()->debug($message); //$this->log("$level $errno in $errfile($errline): $errstr", ERR_NOTICE); break; } } }
function propagateShutdown($url) { $size = ob_get_length(); header("Content-Length: {$size}"); ob_end_flush(); set_time_limit(0); ignore_user_abort(true); \Singleton::Error()->enabled = false; @header("Connection: close"); $size = ob_get_length(); @header("Content-Length: {$size}"); ob_end_flush(); flush(); session_write_close(); if (function_exists(fastcgi_finish_request)) { fastcgi_finish_request(); } $handle = @fopen($url, "r"); $buffer = ""; if ($handle) { while (!feof($handle)) { $buffer .= fgets($handle, 4096); } fclose($handle); } else { } }