Index: branches/5.3.x/core/kernel/utility/debugger.php =================================================================== diff -u -N -r15483 -r15578 --- branches/5.3.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 15483) +++ branches/5.3.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 15578) @@ -1,6 +1,6 @@ profileStart('script_runtime', 'Script runtime', $start); $this->LastMoment = $start; - error_reporting(E_ALL); + error_reporting(E_ALL & ~E_STRICT); // show errors on screen in case if not in Zend Studio debugging ini_set('display_errors', DebuggerUtil::constOn('DBG_ZEND_PRESENT') ? 0 : 1); @@ -403,7 +403,6 @@ 'DBG_WINDOW_WIDTH' => 700, // set width of debugger window (in pixels) for better viewing large amount of debug data 'DBG_USE_SHUTDOWN_FUNC' => DBG_ZEND_PRESENT ? 0 : 1, // use shutdown function to include debugger code into output 'DBG_HANDLE_ERRORS' => DBG_ZEND_PRESENT ? 0 : 1, // handle all allowed by php (see php manual) errors instead of default handler - 'DBG_IGNORE_STRICT_ERRORS' => 0, // ignore PHP5 errors about private/public view modified missing in class declarations 'DBG_DOMVIEWER' => '/temp/domviewer.html', // path to DOMViewer on website 'DOC_ROOT' => str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT']) ), // windows hack 'DBG_LOCAL_BASE_PATH' => 'w:', // replace DOC_ROOT in filenames (in errors) using this path @@ -481,21 +480,6 @@ } /** - * Allows to overcome short error message problem in tigger_error function - * - * @param string $msg - * @return int - * @access public - */ - public function mapLongError($msg) - { - $key = $this->generateID(); - $this->longErrors[$key] = $msg; - - return $key; - } - - /** * Appends all passed variable values (without variable names) to debug output * * @return void @@ -1337,24 +1321,15 @@ private function getErrorNameByCode($error_code) { $error_map = Array ( - 'Fatal Error' => Array (E_USER_ERROR), - 'Warning' => Array (E_WARNING, E_USER_WARNING), - 'Notice' => Array (E_NOTICE, E_USER_NOTICE), + 'Fatal Error' => Array (E_RECOVERABLE_ERROR, E_USER_ERROR, E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE), + 'Warning' => Array (E_WARNING, E_USER_WARNING, E_CORE_WARNING, E_COMPILE_WARNING), + 'Notice' => Array (E_NOTICE, E_USER_NOTICE, E_STRICT), ); - if ( defined('E_STRICT') ) { - // since PHP 5 - $error_map['PHP5 Strict'] = Array (E_STRICT); - } - - if ( defined('E_RECOVERABLE_ERROR') ) { - // since PHP 5.2 - $error_map['Fatal Error (recoverable)'] = Array (E_RECOVERABLE_ERROR); - } - if ( defined('E_DEPRECATED') ) { // since PHP 5.3 - $error_map['PHP5 Depricated'] = Array (E_DEPRECATED, E_USER_DEPRECATED); + $error_map['Notice'][] = E_DEPRECATED; + $error_map['Notice'][] = E_USER_DEPRECATED; } foreach ($error_map as $error_name => $error_codes) { @@ -1429,6 +1404,13 @@ return ''; } + $last_error = error_get_last(); + + if ( !is_null($last_error) && !$this->_lastErrorProcessed ) { + $this->_lastErrorProcessed = true; + $this->saveError($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']); + } + $this->profileFinish('script_runtime'); $this->breakOutofBuffering(!$returnResult); @@ -1713,10 +1695,6 @@ $this->appendTrace(4); } - if ( DebuggerUtil::constOn('DBG_IGNORE_STRICT_ERRORS') && defined('E_STRICT') && ($errno == E_STRICT) ) { - return false; - } - $this->expandError($errstr, $errfile, $errline); $this->Data[] = Array ( @@ -1795,11 +1773,11 @@ */ private function expandError(&$errstr, &$errfile, &$errline) { - if ( preg_match('/(.*)#([\d]+)$/', $errstr, $rets) ) { - // replace short message with long one (due triger_error limitations on message size) - $long_id = $rets[2]; - $errstr = $this->longErrors[$long_id]; - unset($this->longErrors[$long_id]); + $errstr = kLogger::expandMessage($errstr); + list ($errno, $errstr, $sql) = kLogger::parseDatabaseError($errstr); + + if ( $errno != 0 ) { + $errstr = '' . $errstr . ' (' . $errno . ')
SQL: ' . $this->formatSQL($sql); } if ( strpos($errfile, 'eval()\'d code') !== false ) { @@ -1886,20 +1864,14 @@ } if ( class_exists('kApplication') ) { - // replace application error/exception handler with own - restore_error_handler(); - restore_exception_handler(); - $this->Application =& kApplication::Instance(); - $this->Application->Debugger =& $this; - - $this->Application->errorHandlers[] = Array (&$this, 'saveError'); - $this->Application->exceptionHandlers[] = Array (&$this, 'saveException'); + $this->Application->Debugger = $this; } - else { - set_error_handler( Array (&$this, 'saveError') ); - set_exception_handler( Array (&$this, 'saveException') ); - } + + // kLogger will auto-detect these automatically + // error/exception handlers registered before debugger will be removed! + set_error_handler( Array ($this, 'saveError') ); + set_exception_handler( Array ($this, 'saveException') ); } /**