From 44625594591686380f6af173d565ce838ae6f245 Mon Sep 17 00:00:00 2001 From: Andrey Pozolotin Date: Wed, 1 Mar 2017 17:46:03 +0100 Subject: [PATCH] Fixing PREG_BACKTRACK_LIMIT_ERROR in HTMLPurifier_Filter_ExtractStyleBlocks --- library/HTMLPurifier/Filter/ExtractStyleBlocks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/HTMLPurifier/Filter/ExtractStyleBlocks.php b/library/HTMLPurifier/Filter/ExtractStyleBlocks.php index 08e62c16..bc5d0da2 100644 --- a/library/HTMLPurifier/Filter/ExtractStyleBlocks.php +++ b/library/HTMLPurifier/Filter/ExtractStyleBlocks.php @@ -95,8 +95,8 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter if ($tidy !== null) { $this->_tidy = $tidy; } - $html = preg_replace_callback('#(.+)#isU', array($this, 'styleCallback'), $html); - $style_blocks = $this->_styleMatches; + $html = preg_replace_callback('#(.*)#isU', array($this, 'styleCallback'), $html); + $style_blocks = array_filter($this->_styleMatches); $this->_styleMatches = array(); // reset $context->register('StyleBlocks', $style_blocks); // $context must not be reused if ($this->_tidy) {