Skip to content

Commit

Permalink
Fixing PREG_BACKTRACK_LIMIT_ERROR in HTMLPurifier_Filter_ExtractStyle…
Browse files Browse the repository at this point in the history
…Blocks
  • Loading branch information
Andrey Pozolotin authored and ezyang committed Mar 7, 2017
1 parent bb3f86e commit 39c4c35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/HTMLPurifier/Filter/ExtractStyleBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public function preFilter($html, $config, $context)
if ($tidy !== null) {
$this->_tidy = $tidy;
}
$html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
$style_blocks = $this->_styleMatches;
$html = preg_replace_callback('#<style(?:\s.*)?>(.*)</style>#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) {
Expand Down

0 comments on commit 39c4c35

Please sign in to comment.