Fix issues with stack trace output.

Traces without files and without classes caused errors in printing
the fancy trace.
This commit is contained in:
mark_story 2011-12-07 21:19:57 -05:00
parent 545694d84b
commit 123a1a21ba

View file

@ -29,12 +29,14 @@ App::uses('Debugger', 'Utility');
printf(
'<a href="#" onclick="traceToggle(event, \'file-excerpt-%s\')">%s line %s</a>',
$i,
$stack['file'],
Debugger::trimPath($stack['file']),
$stack['line']
);
$excerpt = sprintf('<div id="file-excerpt-%s" class="cake-code-dump" style="display:none;"><pre>', $i);
$excerpt .= implode("\n", Debugger::excerpt($stack['file'], $stack['line'] - 1, 2));
$excerpt .= '</pre></div> ';
else:
echo '<a href="#">[internal function]</a>';
endif;
echo ' &rarr; ';
if ($stack['function']):
@ -44,12 +46,12 @@ App::uses('Debugger', 'Utility');
$params[] = Debugger::exportVar($arg, 2);
endforeach;
$called = isset($stack['class']) ? $stack['class'] . $stack['type'] . $stack['function'] : $stack['function'];
printf(
'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s%s%s(%s)</a> ',
'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s(%s)</a> ',
$i,
$stack['class'],
$stack['type'],
$stack['function'],
$called,
implode(', ', $args)
);
$arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i);