Mailing List Archive

Changing the template per-page substitution limit?
Is there a way I can raise the limit on the max number of template
substitutions done in one page from 5 to something more useful for my
site in a configuration file? I've managed to figure out that I can
raise it by modifying the code in exactly one place (the definition of
MAX_INCLUDE_REPEAT in includes/Parser.php), but I'd rather not have to
touch the code at all, even for something so trivial.

PS yes, I understand the attack that this limit protects again, and
have judged that in an in-house wiki where all the users are trusted,
the actuality of the limit hurts more than the possibility of an
attack.

--
Luis Casillas <casillas@mercedsystems.com>
Re: Changing the template per-page substitution limit? [ In reply to ]
Luis Casillas wrote:
> Is there a way I can raise the limit on the max number of template
> substitutions done in one page from 5 to something more useful for my
> site in a configuration file? I've managed to figure out that I can
> raise it by modifying the code in exactly one place (the definition of
> MAX_INCLUDE_REPEAT in includes/Parser.php), but I'd rather not have to
> touch the code at all, even for something so trivial.
>
> PS yes, I understand the attack that this limit protects again, and have
> judged that in an in-house wiki where all the users are trusted, the
> actuality of the limit hurts more than the possibility of an attack.
>
> --
> Luis Casillas <casillas@mercedsystems.com>

Make the change and retest. As simple as that.

--
Ashar Voultoiz
Re: Re: Changing the template per-page substitution limit? [ In reply to ]
On Aug 13, 2004, at 10:36 AM, Ashar Voultoiz wrote:

> Make the change and retest. As simple as that.

Well, I understand that I can just make the change to the code, but I
really think this should be something one should be able to configure,
and want to make completely sure there's no other way before going
ahead. Modifying the core code in-house just to configure a number
creates a maintainability issue when upgrading the software; a trivial
one in this case, sure, but that just makes it all the easier to
forget.

If there isn't a way to do this without modifying the code, I'd ask if
the project would accept a patch to make it pick up the default value
from DefaultSettings.php.

--
Luis Casillas <casillas@mercedsystems.com>
Re: Re: Changing the template per-page substitution limit? [ In reply to ]
Luis Casillas wrote:
> If there isn't a way to do this without modifying the code, I'd ask if
> the project would accept a patch to make it pick up the default value
> from DefaultSettings.php.

There's already a big change for this in current CVS, it works
differently and AFAIK has removed this limit. I don't know how easy it
would be to backport it to 1.3.

If you just want to change the limit locally, it's defined right at the
top of Parser.php:

define( "MAX_INCLUDE_REPEAT", 5 );

-- brion vibber (brion @ pobox.com)