codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
43 stars 24 forks source link

StringUtil::recursiveReplaceTokensAndTags recursion will never stop, if token is not present #88

Closed fatcrobat closed 7 years ago

fatcrobat commented 7 years ago

If token is not present in $arrTokens, the recursion will never stop and the php-process will die.

StringUtil::recursiveReplace Line: 81

// check if the inserttags have returned a simple token or an insert tag to parse
if ((strpos($strBuffer, '##') !== false || strpos($strBuffer, '{{') !== false) && $strBuffer != $strText) {
    $strBuffer = static::recursiveReplaceTokensAndTags($strBuffer, $arrTokens, $intTextFlags);
}

There should be a check for the existence, of the token, that should be replaced.

Thanks for your support.

qzminski commented 7 years ago

Can you check if the 05879ee fixes the issue for you?

fatcrobat commented 7 years ago

Thanks, can confirm that it is working now.

qzminski commented 7 years ago

Sorry @fatcrobat, have you checked my commit explicitly or the 4.14.2 version? The 4.14.2 contains another approach to that fix and not my solution.

fatcrobat commented 7 years ago

Did it on 4.14.2 with the old behavior in our Test Environment and got no recursion error.