mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
===== 3.1.24.dev ===== (xx.xx.2015)
|
===== 3.1.24.dev ===== (xx.xx.2015)
|
||||||
19.05.2015
|
19.05.2015
|
||||||
- bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39
|
- bugfix compiler did overwrite existing variable value when setting the nocache attribute https://github.com/smarty-php/smarty/issues/39
|
||||||
|
- bugfix output filter trimwhitespace could run into the pcre.backtrack_limit on large output (code.google issue 220)
|
||||||
|
|
||||||
18.05.2015
|
18.05.2015
|
||||||
- improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
|
- improvement introduce shortcuts in lexer/parser rules for most frequent terms for higher
|
||||||
|
@@ -45,7 +45,7 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||||||
|
|
||||||
// capture html elements not to be messed with
|
// capture html elements not to be messed with
|
||||||
$_offset = 0;
|
$_offset = 0;
|
||||||
if (preg_match_all('#<(script|pre|textarea)[^>]*>.*?</\\1>#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$store[] = $match[0][0];
|
$store[] = $match[0][0];
|
||||||
$_length = strlen($match[0][0]);
|
$_length = strlen($match[0][0]);
|
||||||
@@ -62,7 +62,7 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||||||
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
|
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
|
||||||
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
|
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
|
||||||
// remove spaces between attributes (but not in attribute values!)
|
// remove spaces between attributes (but not in attribute values!)
|
||||||
'#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \4',
|
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
|
||||||
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
||||||
// maybe a \0 byte or something is interfering?
|
// maybe a \0 byte or something is interfering?
|
||||||
'#^\s+<#Ss' => '<',
|
'#^\s+<#Ss' => '<',
|
||||||
|
Reference in New Issue
Block a user