diff --git a/NEWS b/NEWS index 7dabba2e..9485d40d 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier fix is to go about handling truncation a bit more cleverly so that we can wrap with divs (sidestepping the bug) but slurping out the rest of the text in case it ran off the end. (#78) +- Fix PREG_BACKTRACK_LIMIT_ERROR in HTMLPurifier_Filter_ExtractStyle. + Thanks @breathbath for contributing the report and fix (#120) # By default, when a link has a target attribute associated with it, we now also add rel="noopener" in order to prevent the new window from being able to overwrite diff --git a/library/HTMLPurifier/Filter/ExtractStyleBlocks.php b/library/HTMLPurifier/Filter/ExtractStyleBlocks.php index cc4324b6..8d781946 100644 --- a/library/HTMLPurifier/Filter/ExtractStyleBlocks.php +++ b/library/HTMLPurifier/Filter/ExtractStyleBlocks.php @@ -96,7 +96,7 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter $this->_tidy = $tidy; } $html = preg_replace_callback('#(.*)<\/style>#isU', array($this, 'styleCallback'), $html); - $style_blocks = array_filter($this->_styleMatches); + $style_blocks = $this->_styleMatches; $this->_styleMatches = array(); // reset $context->register('StyleBlocks', $style_blocks); // $context must not be reused if ($this->_tidy) {