Skip to content
This repository
Browse code

Fix issues with stack trace output.

Traces without files and without classes caused errors in printing
the fancy trace.
  • Loading branch information...
commit 123a1a21baf307b85b9ea7e78017d02d375c1a91 1 parent 545694d
Mark Story authored December 07, 2011
12  lib/Cake/View/Elements/exception_stack_trace.ctp
@@ -29,12 +29,14 @@ App::uses('Debugger', 'Utility');
29 29
 		printf(
30 30
 			'<a href="#" onclick="traceToggle(event, \'file-excerpt-%s\')">%s line %s</a>',
31 31
 			$i,
32  
-			$stack['file'],
  32
+			Debugger::trimPath($stack['file']),
33 33
 			$stack['line']
34 34
 		);
35 35
 		$excerpt = sprintf('<div id="file-excerpt-%s" class="cake-code-dump" style="display:none;"><pre>', $i);
36 36
 		$excerpt .= implode("\n", Debugger::excerpt($stack['file'], $stack['line'] - 1, 2));
37 37
 		$excerpt .= '</pre></div> ';
  38
+	else:
  39
+		echo '<a href="#">[internal function]</a>';
38 40
 	endif;
39 41
 	echo ' &rarr; ';
40 42
 	if ($stack['function']):
@@ -43,13 +45,13 @@ App::uses('Debugger', 'Utility');
43 45
 			$args[] = Debugger::getType($arg);
44 46
 			$params[] = Debugger::exportVar($arg, 2);
45 47
 		endforeach;
  48
+
  49
+		$called = isset($stack['class']) ? $stack['class'] . $stack['type'] . $stack['function'] : $stack['function'];
46 50
 	
47 51
 		printf(
48  
-			'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s%s%s(%s)</a> ',
  52
+			'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s(%s)</a> ',
49 53
 			$i,
50  
-			$stack['class'],
51  
-			$stack['type'],
52  
-			$stack['function'],
  54
+			$called,
53 55
 			implode(', ', $args)
54 56
 		);
55 57
 		$arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i);

0 notes on commit 123a1a2

Please sign in to comment.
Something went wrong with that request. Please try again.