Created
November 9, 2011 18:28
-
-
Save docteurklein/1352375 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | |
/** | |
* a vim exception handler | |
* | |
* Commands a remote vim instance to display the stacktrace in a quickfix list | |
* | |
* @author Florian Klein <[email protected]> | |
*/ | |
class VimExceptionHandler | |
{ | |
public function onKernelException(GetResponseForExceptionEvent $event) | |
{ | |
$exception = $event->getException(); | |
$stack = ''; | |
foreach ($exception->getTrace() as $row) { | |
if (isset($row['file'])) { | |
$stack .= sprintf('%s | %s | %s', $row['file'], $row['line'], $row['function'])."\n"; | |
} | |
} | |
file_put_contents('/tmp/stack.php', $stack); | |
$cmd = sprintf('vim --servername %s --remote-send ":call PhpStackTrace()<CR>"', 'florian'); | |
shell_exec($cmd); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment