Index: branches/unlabeled/unlabeled-1.38.2/core/kernel/utility/debugger.php
===================================================================
diff -u -r3859 -r4508
--- branches/unlabeled/unlabeled-1.38.2/core/kernel/utility/debugger.php (.../debugger.php) (revision 3859)
+++ branches/unlabeled/unlabeled-1.38.2/core/kernel/utility/debugger.php (.../debugger.php) (revision 4508)
@@ -19,7 +19,7 @@
{
if( substr($rq_name,0,6)=='debug_' )
{
- dbg_safeDefine('DBG_ZEND_PRESENT', 1);
+ //dbg_safeDefine('DBG_ZEND_PRESENT', 1);
break;
}
}
@@ -71,7 +71,7 @@
'output_buffer' => 4, 'highlight_output' => 8);
var $scrollbarWidth = 0;
-
+
var $longErrors = Array();
/**
@@ -87,15 +87,16 @@
var $reportDone = false;
- var $dummyImage = 'http://www.adamauto.lv/chevrolet/images/spacer.gif';
-
+ var $dummyImage = '';
+
function Debugger()
{
+ $this->dummyImage = PROTOCOL.SERVER_NAME.(defined('PORT')?':'.PORT : '').rtrim(BASE_PATH, '/').'/'.'kernel/admin_templates/img/spacer.gif';
$this->profileStart('kernel4_startup', 'Startup and Initialization of kernel4');
$this->profileStart('script_runtime', 'Script runtime');
ini_set('display_errors', dbg_ConstOn('DBG_ZEND_PRESENT') ? 0 : 1);
$this->memoryUsage['error_handling'] = 0; // memory amount used by error handler
-
+
$this->scrollbarWidth = $this->isGecko() ? 22 : 25;
dbg_safeDefine('DBG_WINDOW_WIDTH', 700);
$this->appendRequest();
@@ -215,24 +216,24 @@
$profileKey = $Data['profile_key'];
$Data =& $this->ProfilerData[$profileKey];
$runtime = ($Data['ends'] - $Data['begins']); // in seconds
-
-
+
+
$totals_key = getArrayValue($Data, 'totalsKey');
if ($totals_key) {
$total_before = $Data['totalsBefore'];
$total = $this->ProfilerTotals[$totals_key];
-
+
$div_width = Array();
$div_width['before'] = ($total_before / $total) * $this->getWindowWidth();
$div_width['current'] = ($runtime / $total) * $this->getWindowWidth();
$div_width['left'] = (($total - $total_before - $runtime) / $total) * $this->getWindowWidth();
-
+
$ret = 'Name: '.$Data['description'].'
';
$ret .= 'Runtime: '.$runtime.'s';
$ret .= '
';
$ret .= '';
$ret .= '';
-
+
return $ret;
}
else {
@@ -250,15 +251,17 @@
{
return DBG_WINDOW_WIDTH - $this->scrollbarWidth;
}
-
+
function isApplication(&$object)
{
$app_class = defined('APPLICATION_CLASS') ? strtolower(APPLICATION_CLASS) : 'kApplication';
- return get_class($object) == $app_class;
+ return strtolower(get_class($object)) == $app_class;
}
function processTraceArguments(&$traceArgs)
{
+ $traceArgs = 'X';
+ return '';
if(!$traceArgs) return '';
$array_keys = array_keys($traceArgs);
@@ -268,11 +271,11 @@
if( is_array($argValue) || is_object($argValue) )
{
- if(is_object($argValue) && !in_array(get_class($argValue),$this->RecursionStack) )
+ if(is_object($argValue) && !in_array(get_class($argValue),$this->RecursionStack) && count($this->RecursionStack) < 2)
{
array_push($this->RecursionStack, get_class($argValue));
- if( get_class($argValue) == 'kfactory' || $this->isApplication($argValue) || get_class($argValue) == 'templateparser' )
+ if( strtolower(get_class($argValue)) == 'kfactory' || $this->isApplication($argValue) || strtolower(get_class($argValue)) == 'templateparser' )
{
$argValue = null;
continue;
@@ -283,7 +286,7 @@
$this->processTraceArguments($argValue);
array_pop($this->RecursionStack);
}
- elseif(is_object($argValue) && in_array(get_class($argValue),$this->RecursionStack) )
+ elseif(is_object($argValue) && in_array(get_class($argValue),$this->RecursionStack) && count($this->RecursionStack) >= 2)
{
// object & in stack - recursion
$traceArgs[$argID] = '**** RECURSION ***';
@@ -335,16 +338,16 @@
return $string;
}
}
-
+
function isGecko()
{
return strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'firefox') !== false;
}
-
+
function getFileLink($file, $lineno = 1, $title = '')
{
if (!$title) $title = $file;
-
+
if ($this->isGecko()) {
return ''.$title.'';
}
@@ -435,7 +438,7 @@
else {
$script = $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'];
}
-
+
$this->appendHTML('ScriptName: '.$this->getFileLink($script,1,basename($script)).' ('.dirname($script).')');
$this->appendHTML('DomViewer: ');
@@ -486,14 +489,14 @@
if (isset($description)) {
$this->ProfilerData[$key]['description'] = $description;
}
-
+
$this->Data[] = array('profile_key' => $key, 'debug_type' => 'profiler');
}
function profileFinish($key, $description = null)
{
$this->ProfilerData[$key]['ends'] = $this->getMoment();
-
+
if (isset($description)) {
$this->ProfilerData[$key]['description'] = $description;
}
@@ -508,12 +511,12 @@
if (!isset($value)) {
$value = $this->ProfilerData[$key]['ends'] - $this->ProfilerData[$key]['begins'];
}
-
+
if (isset($key)) {
$this->ProfilerData[$key]['totalsKey'] = $total_key;
$this->ProfilerData[$key]['totalsBefore'] = $this->ProfilerTotals[$total_key];
}
-
+
$this->ProfilerTotals[$total_key] += $value;
$this->ProfilerTotalCount[$total_key]++;
}
@@ -575,6 +578,7 @@
*/
function printReport($returnResult = false, $clean_output_buffer = true)
{
+ $this->breakOutofBuffering();
if($this->reportDone) return '';
if( dbg_ConstOn('DBG_SKIP_REPORTING') ) return;
@@ -649,7 +653,7 @@
border: 1px solid #000000;
float: left;
}
-
+
.dbg_flat_table {
border-collapse: collapse;
width: auto;
@@ -719,6 +723,9 @@
99) {
+ echo '';
+ }
echo ''.$this->prepareHTML($i).' |
';
$i++;
}
@@ -918,7 +925,7 @@
{
if( !dbg_ConstOn('DBG_HIDE_FULL_REPORT') )
{
- ob_end_flush();
+ $this->breakOutofBuffering();
}
else
{
@@ -1013,12 +1020,29 @@
$this->memoryUsage['error_handling']+=$memory_used['end']-$memory_used['begin'];
if( substr($errorType,0,5) == 'Fatal')
{
+ $this->breakOutofBuffering(false);
echo '';
- if( !dbg_ConstOn('DBG_USE_SHUTDOWN_FUNC') ) $this->printReport();
+ ob_flush();
+ if( !dbg_ConstOn('DBG_USE_SHUTDOWN_FUNC') || dbg_ConstOn('DBG_DBG_EVEN_WITH_ZEND')) $this->printReport();
exit;
}
}
+ function breakOutofBuffering($flush=true)
+ {
+ $status = ob_get_status();
+ while (getArrayValue($status, 'level') > 1)
+ {
+ if ($flush) {
+ ob_end_flush();
+ }
+ else {
+ ob_end_clean();
+ }
+ $status = ob_get_status();
+ }
+ }
+
function saveToFile($msg)
{
$fp = fopen($_SERVER['DOCUMENT_ROOT'].'/vb_debug.txt', 'a');
@@ -1054,7 +1078,7 @@
$return .= ' '.$suffix;
return $return;
}
-
+
function printConstants($constants)
{
if (!is_array($constants)) {