4

We are experiencing some PHP errors due to a "too large" regular expression that is taking place during template parsing in Template.php. We noticed it was only occurring on templates that load an entry based on URL title and the URL title contains the word "random". The regular expression that is failing can be found in Template.php in the early 800 lines:

// Strip the "chunk" from the template, replacing it with a unique marker.
if (stristr($raw_tag, 'random'))
{
    $this->template = preg_replace("|".preg_quote($chunk)."|s", 'M'.$this->loop_count.$this->marker, $this->template, 1);
}
else
{
    $this->template = str_replace($chunk, 'M'.$this->loop_count.$this->marker, $this->template);
}

We're not sure how to go about fixing this issue.

5

From what I saw in a comment from Mark Croxton here: http://devot-ee.com/add-ons/support/stash/viewthread/8717

EE tries to cache tags that are used multiple times within the same template. To get around this, there's a "random" keyword that EE looks for that will cause it to use a separate marker for this tag (causing the tag to parse twice)

The problem is that it does a stristr for 'random', so if any of your parameters include the word random, or the tag itself does, it parses it an extra time.

It's possible to make a corehack by changing the line

if (stristr($raw_tag, 'random'))

to

if (stristr($raw_tag, ' random'))

It would be nice if there was a way to do this without a corehack, though?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.