Bug #23440 See Comments

Hitting PCRE Backtrack Limit in Conditional Parser

Version: 4.0.7 Reporter: Warble Media

I had an issue where parsing conditionals on a very large (537,327 chars) block of template was just resulting in nothing.

I traced the template parser and found the issue was when EllisLab\ExpressionEngine\Library\Parser\Conditional\Parser::parse() was called return preg_replace('/^\n?(.*?)\n?$/is', '$1', $out); (Line 75).

Setting pcre.backtrack_limit to a higher value in the php.ini worked as a temporary solution, but a better solution would be to change this line to:

$out = preg_replace('/^\n/', '', $out);
$out = preg_replace('/\n$/', '', $out);

return $out;

This produces the same result, but does not require backtracking and because of this not only solves the issue, but should also be more performant.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases