No need to use mb functions here
When mb functions are used and a large response is given the OOM happens as mb functions will use large quantities of memory.
This commit is contained in:
parent
5b72e5ab04
commit
4e8ba13874
|
@ -96,16 +96,8 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|
|||
*/
|
||||
protected function injectToolbar(Response $response)
|
||||
{
|
||||
if (function_exists('mb_stripos')) {
|
||||
$posrFunction = 'mb_strripos';
|
||||
$substrFunction = 'mb_substr';
|
||||
} else {
|
||||
$posrFunction = 'strripos';
|
||||
$substrFunction = 'substr';
|
||||
}
|
||||
|
||||
$content = $response->getContent();
|
||||
$pos = $posrFunction($content, '</body>');
|
||||
$pos = strripos($content, '</body>');
|
||||
|
||||
if (false !== $pos) {
|
||||
$toolbar = "\n".str_replace("\n", '', $this->twig->render(
|
||||
|
@ -115,7 +107,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|
|||
'token' => $response->headers->get('X-Debug-Token'),
|
||||
)
|
||||
))."\n";
|
||||
$content = $substrFunction($content, 0, $pos).$toolbar.$substrFunction($content, $pos);
|
||||
$content = substr($content, 0, $pos).$toolbar.substr($content, $pos);
|
||||
$response->setContent($content);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue