Index: trunk/kernel/include/debugger.php =================================================================== diff -u -r874 -r875 --- trunk/kernel/include/debugger.php (.../debugger.php) (revision 874) +++ trunk/kernel/include/debugger.php (.../debugger.php) (revision 875) @@ -1,7 +1,24 @@ 'c:\Program Files\UltraEdit\uedit32.exe', 'params' => '%F/%L'); + $dbg_editors[1] = Array('editor' => 'c:\Program Files\Zend\ZendStudio-4.0Beta\bin\ZDE.exe', 'params' => '%F'); + define('WINDOWS_EDITOR',$dbg_editors[$dbg_editor]['editor'].' '.$dbg_editors[$dbg_editor]['params']); + unset($dbg_editors,$dbg_editor); + } + class Debugger { /** @@ -13,12 +30,40 @@ var $ProfilerData = Array(); var $RecursionStack = Array(); // prevent recursion when processing debug_backtrace() function results + var $Options = 0; + var $OptionsMap = Array('shutdown_func' => 1, 'error_handler' => 2, + 'output_buffer' => 4, 'highlight_output' => 8); + function Debugger() { - $this->appendHTML('Hide Debugger'); $this->appendRequest(); } + function initOptions() + { + + + } + + function setOption($name,$value) + { + if( !isset($this->OptionsMap[$name]) ) die('undefined debugger option: ['.$name.']
'); + if($value) + { + $this->Options|=$this->OptionsMap[$name]; + } + else + { + $this->Options=$this->Options&~$this->OptionsMap[$name]; + } + } + + function getOption($name) + { + if( !isset($this->OptionsMap[$name]) ) die('undefined debugger option: ['.$name.']
'); + return ($this->Options & $this->OptionsMap[$name]) == $this->OptionsMap[$name]; + } + function dumpVars() { $dumpVars = func_get_args(); @@ -43,8 +88,7 @@ break; case 'var_dump': - $ret = highlight_string('', true); - $ret = preg_replace('/<\?php (.*)\?>/s','$1',$ret); + $ret = $this->highlightString( print_r($Data['value'], true) ); return addslashes($ret); break; @@ -202,6 +246,18 @@ return true; } + /** + * Move $debugLineCount lines of input from debug output + * end to beginning. + * + * @param int $debugLineCount + */ + function moveToBegin($debugLineCount) + { + $lines = array_splice($this->Data,count($this->Data)-$debugLineCount,$debugLineCount); + $this->Data = array_merge($lines,$this->Data); + } + function appendRequest() { $script = $_SERVER['PATH_TRANSLATED']; @@ -233,6 +289,16 @@ ob_end_clean(); } + function appendSession() + { + if( isset($_SESSION)&&$_SESSION ) + { + $this->appendHTML('PHP Session: ['.ini_get('session.name').']'); + $this->dumpVars($_SESSION); + $this->moveToBegin(2); + } + } + function profileStart($key, $description) { $timeStamp = $this->getMoment(); @@ -298,6 +364,13 @@ */ function printReport($returnResult = false) { + // show php session if any + $this->appendSession(); + + // ensure, that 1st line of debug output always is this one: + $this->appendHTML('Hide Debugger'); + $this->moveToBegin(1); + $i = 0; $lineCount = count($this->Data); ob_start(); ?> @@ -387,7 +460,7 @@ if(!$e) $e = window.event; var $KeyCode = getEventKeyCode($e); //alert(showProps($e)); - if($KeyCode == 123 || $KeyCode == 68 && $e.shiftKey) // F12 (for Maxthon) or Ctrl+F2 (for Other Browsers) + if($KeyCode == 123 || $KeyCode == 27) // F12 or ESC { toggleDebugLayer(); $e.cancelBubble = true; @@ -514,7 +587,7 @@ ob_clean(); return $ret; } - else + else { ob_end_flush(); } @@ -538,7 +611,18 @@ trigger_error('Unknown error type ['.$errno.']', E_USER_ERROR); return false; } + if( strpos($errfile,'eval()\'d code') !== false ) + { + $errstr = '[EVAL, line '.$errline.']: '.$errstr; + $tmpStr = $errfile; + $pos = strpos($tmpStr,'('); + $errfile = substr($tmpStr,0,$pos); + $pos++; + $errline = substr($tmpStr,$pos,strpos($tmpStr,')',$pos)-$pos); + } + $this->Data[] = Array('no' => $errno, 'str' => $errstr, 'file' => $errfile, 'line' => $errline, 'context' => $errcontext, 'debug_type' => 'error'); + if( substr($errorType,0,5) == 'Fatal') { echo '';