Created
July 9, 2013 17:50
-
-
Save meonkeys/5959547 to your computer and use it in GitHub Desktop.
Run this within NetBeans PHP and you get a clickable stack trace. Files and line numbers link directly to the relevant code locations. Use in conjunction with https://gist.github.com/meonkeys/5959455 .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pathMap = [ | |
'/vagrant' => '/home/user/git/code', | |
]; | |
$trace = ' | |
/vagrant/foo/bar/Pager.php (131) | |
/vagrant/foo/bar/Main.php (25) | |
'; | |
foreach (preg_split('/\n/', $trace) as $traceLine) { | |
$traceLine = trim($traceLine); | |
if (preg_match('/([^\s]*)\s+\((\d+)\)/', $traceLine, $matches) < 1) { | |
continue; | |
} | |
$file = $matches[1]; | |
$linenum = $matches[2]; | |
foreach ($pathMap as $old => $new) { | |
$file = preg_replace("#$old#", $new, $file); | |
} | |
print " in $file on line $linenum\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment