Project

General

Profile

Actions

Bug #3471

closed

IF substitution contents limited to 300 characters

Added by krileon almost 12 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
25 April 2012
Due date:
% Done:

100%

Estimated time:

Description

When you've content more then 300 characters contained in an IF substitute statement it seams to crash the server. This is confirmed using CB Content Bot in a Joomla article.

https://www.joomlapolis.com/forum/153-professional-member-support/197501-solved-hide-content-depending-on-cbsubs-plan?limit=6&start=12


Files

substitution_if_regexp.txt (162 Bytes) substitution_if_regexp.txt krileon, 31 October 2016 19:06
Actions #1

Updated by krileon almost 12 years ago

The below can be used to confirm this issue anywhere substitutions are used.

[cb:if user_id="myid"]1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890[/cb:if]

Actions #2

Updated by krileon almost 12 years ago

  • Status changed from Assigned to Feedback
  • Assignee changed from krileon to beat

Appears to be a stack overflow issue for preg_replace_callback. On windows servers it's quite small (like 1MB) while linux is significantly higher. Seams the only solution is to increase that stack overflow for apache or use smaller strings in their substitutions (maybe break it up into 3 or 4 of the same substitutions to keep them smaller). Don't see a solution we can implement without forcing the string into chunks, which could just end up breaking the substitutions if a substitution got split incorrectly.

Actions #3

Updated by beat almost 12 years ago

  • Target version changed from CB 1.8.1 to CB 1.9
Actions #4

Updated by beat over 11 years ago

  • Status changed from Feedback to New
  • Priority changed from High to Normal
  • Target version changed from CB 1.9 to CB 2.1

Not really an issue in CB imho. Something to keep in mind for CB 2.0.

Actions #5

Updated by krileon over 7 years ago

This is due to the massive amount of backtracking taking place. The current REGEXP will take 15,886 steps in the REGEXP engine to match a string with 7,953 characters. The proposes new REGEXP only takes 42 steps.

SEE ATTACHED FILE

The problem is the new usage can't work with IF substitutions that are side by side. This is simply early findings and of course needs further investigation, but this maybe fixable with just better REGEXP.

Actions #6

Updated by krileon over 7 years ago

This is easily fixed by limiting the backtracking by fixing the [^\[] to [^\[]+. This will group up strings that it can so they're checked in chunks instead of literally character by character. It will only backtrack if it needs to from the other conditions.

Actions #7

Updated by krileon over 7 years ago

  • Status changed from New to Assigned
  • Assignee changed from beat to krileon
  • % Done changed from 0 to 100

Fixed in MR !1121

Actions #8

Updated by krileon over 7 years ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF