public static function HandleError($intErrorNumber, $strErrorString, $strErrorFile, $intErrorLine) { // If a command is called with "@", then we should return if (error_reporting() == 0) { return; } // If we still have access to QApplicationBase, set the error flag on the Application if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } // If we are currently dealing with reporting an error, don't go on if (QErrorHandler::$Type) { return; } // Setup the QErrorHandler Object QErrorHandler::$Type = 'Exception'; QErrorHandler::$Message = $strErrorString; QErrorHandler::$Filename = $strErrorFile; QErrorHandler::$LineNumber = $intErrorLine; switch ($intErrorNumber) { case E_ERROR: QErrorHandler::$ObjectType = 'E_ERROR'; break; case E_WARNING: QErrorHandler::$ObjectType = 'E_WARNING'; break; case E_PARSE: QErrorHandler::$ObjectType = 'E_PARSE'; break; case E_NOTICE: QErrorHandler::$ObjectType = 'E_NOTICE'; break; case E_STRICT: QErrorHandler::$ObjectType = 'E_STRICT'; break; case E_CORE_ERROR: QErrorHandler::$ObjectType = 'E_CORE_ERROR'; break; case E_CORE_WARNING: QErrorHandler::$ObjectType = 'E_CORE_WARNING'; break; case E_COMPILE_ERROR: QErrorHandler::$ObjectType = 'E_COMPILE_ERROR'; break; case E_COMPILE_WARNING: QErrorHandler::$ObjectType = 'E_COMPILE_WARNING'; break; case E_USER_ERROR: QErrorHandler::$ObjectType = 'E_USER_ERROR'; break; case E_USER_WARNING: QErrorHandler::$ObjectType = 'E_USER_WARNING'; break; case E_USER_NOTICE: QErrorHandler::$ObjectType = 'E_USER_NOTICE'; break; default: QErrorHandler::$ObjectType = 'Unknown'; break; } // Setup the Stack Trace QErrorHandler::$StackTrace = ""; $objBackTrace = debug_backtrace(); for ($intIndex = 0; $intIndex < count($objBackTrace); $intIndex++) { $objItem = $objBackTrace[$intIndex]; $strKeyFile = array_key_exists('file', $objItem) ? $objItem['file'] : ''; $strKeyLine = array_key_exists('line', $objItem) ? $objItem['line'] : ''; $strKeyClass = array_key_exists('class', $objItem) ? $objItem['class'] : ''; $strKeyType = array_key_exists('type', $objItem) ? $objItem['type'] : ''; $strKeyFunction = array_key_exists('function', $objItem) ? $objItem['function'] : ''; QErrorHandler::$StackTrace .= sprintf("#%s %s(%s): %s%s%s()\n", $intIndex, $strKeyFile, $strKeyLine, $strKeyClass, $strKeyType, $strKeyFunction); } QErrorHandler::Run(); }
function QcodoHandleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext) { $__exc_intErrorReport = error_reporting(); // If a command is called with "@", then we should return if ($__exc_intErrorReport == 0) { return false; } // If error_reporting is turned off for this error, return $error_all = $__exc_intErrorReport == E_ALL && $__exc_errno != E_STRICT; if (!$error_all || $__exc_intErrorReport % $__exc_errno == 0) { return false; } if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } global $__exc_strType; if (isset($__exc_strType)) { return false; } $__exc_strType = "Error"; $__exc_strMessage = $__exc_errstr; switch ($__exc_errno) { case E_ERROR: $__exc_strObjectType = "E_ERROR"; break; case E_WARNING: $__exc_strObjectType = "E_WARNING"; break; case E_PARSE: $__exc_strObjectType = "E_PARSE"; break; case E_NOTICE: //return; $__exc_strObjectType = "E_NOTICE"; break; case E_STRICT: $__exc_strObjectType = "E_STRICT"; break; case E_CORE_ERROR: $__exc_strObjectType = "E_CORE_ERROR"; break; case E_CORE_WARNING: $__exc_strObjectType = "E_CORE_WARNING"; break; case E_COMPILE_ERROR: $__exc_strObjectType = "E_COMPILE_ERROR"; break; case E_COMPILE_WARNING: $__exc_strObjectType = "E_COMPILE_WARNING"; break; case E_USER_ERROR: $__exc_strObjectType = "E_USER_ERROR"; break; case E_USER_WARNING: $__exc_strObjectType = "E_USER_WARNING"; break; case E_USER_NOTICE: $__exc_strObjectType = "E_USER_NOTICE"; break; default: $__exc_strObjectType = "Unknown"; break; } $__exc_strFilename = $__exc_errfile; $__exc_intLineNumber = $__exc_errline; $__exc_strStackTrace = ""; $__exc_objBacktrace = debug_backtrace(); for ($__exc_intIndex = 0; $__exc_intIndex < count($__exc_objBacktrace); $__exc_intIndex++) { $__exc_objItem = $__exc_objBacktrace[$__exc_intIndex]; $__exc_strKeyFile = array_key_exists("file", $__exc_objItem) ? $__exc_objItem["file"] : ""; $__exc_strKeyLine = array_key_exists("line", $__exc_objItem) ? $__exc_objItem["line"] : ""; $__exc_strKeyClass = array_key_exists("class", $__exc_objItem) ? $__exc_objItem["class"] : ""; $__exc_strKeyType = array_key_exists("type", $__exc_objItem) ? $__exc_objItem["type"] : ""; $__exc_strKeyFunction = array_key_exists("function", $__exc_objItem) ? $__exc_objItem["function"] : ""; $__exc_strStackTrace .= sprintf("#%s %s(%s): %s%s%s()\n", $__exc_intIndex, $__exc_strKeyFile, $__exc_strKeyLine, $__exc_strKeyClass, $__exc_strKeyType, $__exc_strKeyFunction); } if (ob_get_length()) { $__exc_strRenderedPage = ob_get_contents(); ob_clean(); } // Call to display the Error Page (as defined in configuration.inc.php) require __DOCROOT__ . ERROR_PAGE_PATH; //exit(); }
function QcubedHandleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext) { // If a command is called with "@", then we should return if (error_reporting() == 0) { return true; } if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } global $__exc_strType; if (isset($__exc_strType)) { return true; } // Already handled elsewhere, avoi looping $__exc_strType = "Error"; $__exc_strMessage = $__exc_errstr; switch ($__exc_errno) { case E_ERROR: $__exc_strObjectType = "E_ERROR"; break; case E_WARNING: $__exc_strObjectType = "E_WARNING"; break; case E_PARSE: $__exc_strObjectType = "E_PARSE"; break; case E_NOTICE: $__exc_strObjectType = "E_NOTICE"; break; case E_STRICT: $__exc_strObjectType = "E_STRICT"; break; case E_CORE_ERROR: $__exc_strObjectType = "E_CORE_ERROR"; break; case E_CORE_WARNING: $__exc_strObjectType = "E_CORE_WARNING"; break; case E_COMPILE_ERROR: $__exc_strObjectType = "E_COMPILE_ERROR"; break; case E_COMPILE_WARNING: $__exc_strObjectType = "E_COMPILE_WARNING"; break; case E_USER_ERROR: $__exc_strObjectType = "E_USER_ERROR"; break; case E_USER_WARNING: $__exc_strObjectType = "E_USER_WARNING"; break; case E_USER_NOTICE: $__exc_strObjectType = "E_USER_NOTICE"; break; case E_DEPRECATED: $__exc_strObjectType = 'E_DEPRECATED'; break; case E_USER_DEPRECATED: $__exc_strObjectType = 'E_USER_DEPRECATED'; break; case E_RECOVERABLE_ERROR: $__exc_strObjectType = 'E_RECOVERABLE_ERROR'; break; default: $__exc_strObjectType = "Unknown"; break; } $__exc_strFilename = $__exc_errfile; $__exc_intLineNumber = $__exc_errline; $__exc_strStackTrace = QcubedGetBacktrace(); if (ob_get_length()) { $__exc_strRenderedPage = ob_get_contents(); ob_clean(); } // Call to display the Error Page (as defined in configuration.inc.php) if (defined('ERROR_PAGE_PATH')) { require __DOCROOT__ . ERROR_PAGE_PATH; } else { // Error in installer or similar - ERROR_PAGE_PATH constant is not defined yet. echo "error: errno: " . $__exc_errno . "<br/>" . $__exc_errstr . "<br/>" . $__exc_errfile . ":" . $__exc_errline . "<br/>" . implode(', ', $__exc_errcontext); } exit; }
function QcodoHandleError($__exc_errno, $__exc_errstr, $__exc_errfile, $__exc_errline, $__exc_errcontext) { // If a command is called with "@", then we should return if (error_reporting() == 0) { return; } if (class_exists('QApplicationBase')) { QApplicationBase::$ErrorFlag = true; } global $__exc_strType; if (isset($__exc_strType)) { return; } $__exc_strType = "Error"; $__exc_strMessage = $__exc_errstr; switch ($__exc_errno) { case E_ERROR: $__exc_strObjectType = "E_ERROR"; break; case E_WARNING: $__exc_strObjectType = "E_WARNING"; break; case E_PARSE: $__exc_strObjectType = "E_PARSE"; break; case E_NOTICE: $__exc_strObjectType = "E_NOTICE"; break; case E_STRICT: $__exc_strObjectType = "E_STRICT"; break; case E_CORE_ERROR: $__exc_strObjectType = "E_CORE_ERROR"; break; case E_CORE_WARNING: $__exc_strObjectType = "E_CORE_WARNING"; break; case E_COMPILE_ERROR: $__exc_strObjectType = "E_COMPILE_ERROR"; break; case E_COMPILE_WARNING: $__exc_strObjectType = "E_COMPILE_WARNING"; break; case E_USER_ERROR: $__exc_strObjectType = "E_USER_ERROR"; break; case E_USER_WARNING: $__exc_strObjectType = "E_USER_WARNING"; break; case E_USER_NOTICE: $__exc_strObjectType = "E_USER_NOTICE"; break; case E_DEPRECATED: $__exc_strObjectType = 'E_DEPRECATED'; break; case E_USER_DEPRECATED: $__exc_strObjectType = 'E_USER_DEPRECATED'; break; case E_RECOVERABLE_ERROR: $__exc_strObjectType = 'E_RECOVERABLE_ERROR'; break; default: $__exc_strObjectType = "Unknown"; break; } $__exc_strFilename = $__exc_errfile; $__exc_intLineNumber = $__exc_errline; $__exc_strStackTrace = ""; $__exc_objBacktrace = debug_backtrace(); for ($__exc_intIndex = 0; $__exc_intIndex < count($__exc_objBacktrace); $__exc_intIndex++) { $__exc_objItem = $__exc_objBacktrace[$__exc_intIndex]; $__exc_strKeyFile = array_key_exists("file", $__exc_objItem) ? $__exc_objItem["file"] : ""; $__exc_strKeyLine = array_key_exists("line", $__exc_objItem) ? $__exc_objItem["line"] : ""; $__exc_strKeyClass = array_key_exists("class", $__exc_objItem) ? $__exc_objItem["class"] : ""; $__exc_strKeyType = array_key_exists("type", $__exc_objItem) ? $__exc_objItem["type"] : ""; $__exc_strKeyFunction = array_key_exists("function", $__exc_objItem) ? $__exc_objItem["function"] : ""; $__exc_strStackTrace .= sprintf("#%s %s(%s): %s%s%s()\n", $__exc_intIndex, $__exc_strKeyFile, $__exc_strKeyLine, $__exc_strKeyClass, $__exc_strKeyType, $__exc_strKeyFunction); } if (ob_get_length()) { $__exc_strRenderedPage = ob_get_contents(); ob_clean(); } // Call to display the Error Page (as defined in configuration.inc.php) if (defined('ERROR_PAGE_PATH')) { require __DOCROOT__ . ERROR_PAGE_PATH; } else { // Error in installer or similar - ERROR_PAGE_PATH constant is not defined yet. echo "error: errno: " . $__exc_errno . "<br/>" . $__exc_errstr . "<br/>" . $__exc_errfile . ":" . $__exc_errline . "<br/>" . $__exc_errcontext; } exit; }