Skip to content

Commit

Permalink
Fix drush-ops#6065: Add backtrace to watchdog:show-one
Browse files Browse the repository at this point in the history
  • Loading branch information
andriokha committed Jul 16, 2024
1 parent 151b704 commit d1d1391
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Commands/core/WatchdogCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ protected function formatResult(\stdClass $result, bool $extended = false): \std
if (is_string($variables)) {
$variables = unserialize($variables);
}
$has_hidden_backtrace = false;
if (is_array($variables)) {
$has_hidden_backtrace = !empty($variables['@backtrace_string']) && !str_contains($result->message, '@backtrace_string');
$result->message = strtr($result->message, $variables);
}
unset($result->variables);
Expand All @@ -389,6 +391,10 @@ protected function formatResult(\stdClass $result, bool $extended = false): \std
unset($result->referer);
}
$message_length = PHP_INT_MAX;

if ($has_hidden_backtrace) {
$result->backtrace = $variables['@backtrace_string'];
}
}
$result->message = Unicode::truncate(strip_tags(Html::decodeEntities($result->message)), $message_length);

Expand Down

0 comments on commit d1d1391

Please sign in to comment.