2010-09-06 22:09:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Prints a stack trace for an exception
|
|
|
|
*
|
2017-06-10 21:33:55 +00:00
|
|
|
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
2017-06-10 22:10:52 +00:00
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
2010-09-06 22:09:11 +00:00
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
2013-02-08 12:22:51 +00:00
|
|
|
* For full copyright and license information, please see the LICENSE.txt
|
2010-09-06 22:09:11 +00:00
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
2017-06-10 22:10:52 +00:00
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
2017-06-10 21:33:55 +00:00
|
|
|
* @link https://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
|
2013-05-30 22:11:14 +00:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
2010-09-06 22:09:11 +00:00
|
|
|
*/
|
2013-05-30 22:11:14 +00:00
|
|
|
|
2011-10-09 03:27:05 +00:00
|
|
|
App::uses('Debugger', 'Utility');
|
2013-05-30 22:11:14 +00:00
|
|
|
|
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,
|
2011-12-08 02:19:57 +00:00
|
|
|
Debugger::trimPath($stack['file']),
|
2011-10-09 03:27:05 +00:00
|
|
|
$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> ';
|
2011-12-08 02:19:57 +00:00
|
|
|
else:
|
|
|
|
echo '<a href="#">[internal function]</a>';
|
2011-10-09 03:27:05 +00:00
|
|
|
endif;
|
|
|
|
echo ' → ';
|
|
|
|
if ($stack['function']):
|
|
|
|
$args = array();
|
2012-03-09 16:50:03 +00:00
|
|
|
if (!empty($stack['args'])):
|
|
|
|
foreach ((array)$stack['args'] as $arg):
|
|
|
|
$args[] = Debugger::getType($arg);
|
2014-10-30 01:43:18 +00:00
|
|
|
$params[] = Debugger::exportVar($arg, 4);
|
2012-03-09 16:50:03 +00:00
|
|
|
endforeach;
|
|
|
|
endif;
|
2011-12-08 02:19:57 +00:00
|
|
|
|
|
|
|
$called = isset($stack['class']) ? $stack['class'] . $stack['type'] . $stack['function'] : $stack['function'];
|
2012-07-18 01:55:29 +00:00
|
|
|
|
2011-10-09 03:27:05 +00:00
|
|
|
printf(
|
2011-12-08 02:19:57 +00:00
|
|
|
'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s(%s)</a> ',
|
2011-10-09 03:27:05 +00:00
|
|
|
$i,
|
2011-12-08 02:19:57 +00:00
|
|
|
$called,
|
2013-05-10 02:23:20 +00:00
|
|
|
h(implode(', ', $args))
|
2011-10-09 03:27:05 +00:00
|
|
|
);
|
|
|
|
$arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i);
|
2013-05-10 02:23:20 +00:00
|
|
|
$arguments .= h(implode("\n", $params));
|
2011-10-09 03:27:05 +00:00
|
|
|
$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);
|
2013-02-12 02:38:08 +00:00
|
|
|
el.style.display = (el.style.display === 'block') ? 'none' : 'block';
|
2011-10-09 03:27:05 +00:00
|
|
|
event.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
</script>
|