0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-19 18:55:19 +00:00

Fixing PREG_BACKTRACK_LIMIT_ERROR in HTMLPurifier_Filter_ExtractStyleBlocks

This commit is contained in:
Andrey Pozolotin 2017-03-01 17:46:03 +01:00
parent 8e4cacf0a7
commit 4462559459

View File

@ -95,8 +95,8 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
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) {