1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-29 03:07:42 +01:00

Avoid expanded values on MessagesCollector (#601)

This commit is contained in:
PaolaRuby 2024-02-16 12:50:56 -05:00 committed by GitHub
parent 689ecda8c1
commit cbab4a8f45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,22 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
$this->collectFile = $enabled;
}
/**
* @param string|null $messageHtml
* @param mixed $message
*
* @return string|null
*/
protected function customizeMessageHtml($messageHtml, $message)
{
$pos = strpos((string) $messageHtml, 'sf-dump-expanded');
if ($pos !== false) {
$messageHtml = substr_replace($messageHtml, 'sf-dump-compact', $pos, 16);
}
return $messageHtml;
}
/**
* Adds a message
*
@ -81,7 +97,7 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
$this->messages[] = array(
'message' => $messageText,
'message_html' => $messageHtml,
'message_html' => $this->customizeMessageHtml($messageHtml, $message),
'is_string' => $isString,
'label' => $label,
'time' => microtime(true),