8000 [Debug] Different trace message style on application code by rentalhost · Pull Request #23152 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Debug] Different trace message style on application code #23152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixing code-style
  • Loading branch information
rentalhost committed Jun 12, 2017
commit cfab90833c47bce52ea407b468302701dfcbfb5e
7 changes: 3 additions & 4 deletions src/Symfony/Component/Debug/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Debug;

use Symfony\Component\Config\Resource\ReflectionClassResource;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\Debug\Exception\OutOfMemoryException;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
Expand Down Expand Up @@ -235,7 +234,7 @@ public function getContent(FlattenException $exception)
EOF
, $ind, $total, $class, $message);
foreach ($e['trace'] as $trace) {
$content .= '<tr><td class="trace-row ' . static::getTraceClassname($trace) . '">';
$content .= '<tr><td class="trace-row '.static::getTraceClassname($trace).'">';
if ($trace['function']) {
$content .= sprintf('at <span class="trace-class">%s</span><span class="trace-type">%s</span><span class="trace-method">%s</span>(<span class="trace-arguments">%s</span>)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
}
Expand Down Expand Up @@ -423,9 +422,9 @@ private static function getTraceClassname($trace)
}

$vendorRoot = static::getVendorRoot();
$traceFileRelative = str_replace($vendorRoot, '', $trace['file']);
$traceFileRelative = str_replace($vendorRoot, '', realpath($trace['file']));

if (strpos($traceFileRelative, '\\vendor\\') === 0) {
if (strpos($traceFileRelative, '/vendor/') === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the generic logic to get vendors and composer root is a bit more involving, see LinkStub::getComposerRoot():
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/VarDumper/Caster/LinkStub.php#L64

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a great idea reuse that. But currently the VarDumper is not a dependency of Debug component. Can I turn it a dependency?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just copy/paste :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @rentalhost, ok for this comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok, I will cp. Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... How much this method is better than the currently implemented? I mean, I have based the vendor directory on the ClassLoader class from composer, and it is more simple than LinkStub::getComposerRoot() method. And just copy/paste don't solve the problem, I should adapt the code anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rentalhost sorry for the delay. The code to look for vendors in LinkStub handles two things yours doesn't:

  • there can be several vendor directories - eg the global one, the app's, phpunit's when running test, to consider a not uncommon situation
  • the vendor directories can have a different name than "vendor"

return null;
}

Expand Down
0