diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index 5c399ef089e3b..154b96395ae41 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -14,6 +14,7 @@ use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\Debug\Exception\OutOfMemoryException; use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Composer\Autoload\ClassLoader; /** * ExceptionHandler converts an exception to a Response object. @@ -233,11 +234,11 @@ public function getContent(FlattenException $exception) EOF , $ind, $total, $class, $message); foreach ($e['trace'] as $trace) { - $content .= ''; + $content .= ''; if ($trace['function']) { $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); } - if (isset($trace['file']) && isset($trace['line'])) { + if (isset($trace['file'], $trace['line'])) { $content .= $this->formatPath($trace['file'], $trace['line']); } $content .= "\n"; @@ -320,6 +321,8 @@ public function getStylesheet(FlattenException $exception) .trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; } + .trace-row.application { background-color: #ffffe6; } + .trace-file-path, .trace-file-path a { margin-top: 3px; color: #999; color: #795da3; color: #B0413E; color: #222; font-size: 13px; } .trace-class { color: #B0413E; } .trace-type { padding: 0 2px; } @@ -411,4 +414,27 @@ private function getSymfonyGhostAsSvg() { return ''; } + + private static function getTraceClassname($trace) + { + if (empty($trace['file'])) { + return null; + } + + $vendorRoot = static::getVendorRoot(); + $traceFileRelative = str_replace($vendorRoot, '', realpath($trace['file'])); + + if (strpos($traceFileRelative, '/vendor/') === 0) { + return null; + } + + return 'application'; + } + + private static function getVendorRoot() + { + $classReflection = new \ReflectionClass(ClassLoader::class); + + return dirname($classReflection->getFileName(), 3); + } } diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index 0285eff1346cb..b033a328db79c 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -130,4 +130,16 @@ public function testHandleOutOfMemoryException() $handler->handle($exception); } + + public function testApplicationStyle() + { + $handler = new ExceptionHandler(); + + ob_start(); + $handler->sendPhpResponse(new \RuntimeException('Foo')); + $response = ob_get_clean(); + + $this->assertSame(1, preg_match('/trace-row application".+ExceptionHandlerTest\\.php.+<\\/td>/', $response)); + $this->assertSame(1, preg_match('/trace-row ".+testApplicationStyle().+<\\/td>/', $response)); + } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy