core/modules/big_pipe/src/Render/BigPipe.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php index 5e3cc12..16c862a 100644 --- a/core/modules/big_pipe/src/Render/BigPipe.php +++ b/core/modules/big_pipe/src/Render/BigPipe.php @@ -126,7 +126,11 @@ public function sendContent($content, array $attachments) { // Reopen it for the duration that we are rendering placeholders. $this->session->start(); - list($pre_body, $post_body) = explode('', $content, 2); + // Find the closing tag and get the strings before and after. But be + // careful to use the latest occurrence of the string "", to ensure + // that strings in inline JavaScript or CDATA sections aren't used instead. + list($pre_body, $post_body) = array_reverse(array_map('strrev', explode(strrev(''), strrev($content), 2))); + $this->sendPreBody($pre_body, $nojs_placeholders, $cumulative_assets); $this->sendPlaceholders($placeholders, $this->getPlaceholderOrder($pre_body), $cumulative_assets); $this->sendPostBody($post_body);