2010-09-06 22:09:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Prints a stack trace for an exception
|
|
|
|
*
|
|
|
|
* PHP 5
|
|
|
|
*
|
|
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
2011-05-29 21:31:39 +00:00
|
|
|
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2010-09-06 22:09:11 +00:00
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
2011-05-29 21:31:39 +00:00
|
|
|
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2010-09-06 22:09:11 +00:00
|
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
2011-10-15 18:17:44 +00:00
|
|
|
* @package Cake.View.Elements
|
2010-09-06 22:09:11 +00:00
|
|
|
* @since CakePHP(tm) v 1.3
|
|
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
|
|
*/
|
2011-10-09 03:27:05 +00:00
|
|
|
App::uses('Debugger', 'Utility');
|
2010-09-06 22:09:11 +00:00
|
|
|
?>
|
2011-10-09 03:27:05 +00:00
|
|
|
<h3>Stack Trace</h3>
|
|
|
|
<ul class="cake-stack-trace">
|
|
|
|
<?php foreach ($error->getTrace() as $i => $stack): ?>
|
|
|
|
<li><?php
|
|
|
|
$excerpt = $arguments = '';
|
|
|
|
$params = array();
|
|
|
|
|
|
|
|
if (isset($stack['file']) && isset($stack['line'])):
|
|
|
|
printf(
|
|
|
|
'<a href="#" onclick="traceToggle(event, \'file-excerpt-%s\')">%s line %s</a>',
|
|
|
|
$i,
|
|
|
|
$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> ';
|
|
|
|
endif;
|
|
|
|
echo ' → ';
|
|
|
|
if ($stack['function']):
|
|
|
|
$args = array();
|
|
|
|
foreach ($stack['args'] as $arg):
|
|
|
|
$args[] = Debugger::getType($arg);
|
|
|
|
$params[] = Debugger::exportVar($arg, 2);
|
|
|
|
endforeach;
|
|
|
|
|
|
|
|
printf(
|
|
|
|
'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s%s%s(%s)</a> ',
|
|
|
|
$i,
|
|
|
|
$stack['class'],
|
|
|
|
$stack['type'],
|
|
|
|
$stack['function'],
|
|
|
|
implode(', ', $args)
|
|
|
|
);
|
|
|
|
$arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i);
|
|
|
|
$arguments .= implode("\n", $params);
|
|
|
|
$arguments .= '</pre></div>';
|
|
|
|
endif;
|
|
|
|
echo $excerpt;
|
|
|
|
echo $arguments;
|
|
|
|
?></li>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</ul>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function traceToggle(event, id) {
|
|
|
|
var el = document.getElementById(id);
|
|
|
|
el.style.display = (el.style.display == 'block') ? 'none' : 'block';
|
|
|
|
event.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
</script>
|