Re: petition against registering
| From: | Anders Janson | Date: | Tue, 09 Oct 2001 12:39:07 +0000 |
| Subject: | Re: petition against registering | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1637@lists.php.net to get a copy of this message | ||
Hans-Peter Oeri wrote:
>
> However, I don't really see the reason for "register"ing of functions et
> al. Why not declaring the "suggestions" for function naming as mandatory
> and leaving out the whole registering/lookup stuff?
Let's say I agree about 90%.
But this could lead to a security nightmare if you have a system that
allows other people to develope/edit templates. Today the app must
explicitly tell Smarty the functions that are legal to use. And it is also
possible to unregister functions (in the addon file) that you don't want
template designers to use.
OTOH, if you name a function according to some very strict rules, then in
most cases you want to allow it to be used. But maybe not always! What if
some of the functions are allowed only if certain conditions are met?
And you'd still need to have some way of mapping built-in PHP functions to
modifier names etc (like lower=>strtolower), but this could be solved by
writing a simple wrapper.
>
> I know, this would be an incompatible change and therefore probably for
> V2. But I would really like to provide a patch.
Why not keep the registering procedure, and introduce a relaxed mode
(default off) that makes registering optional?
Or let Smarty auto-register functions that are named according to "the
rules" (that we don't have yet!)?
/Anders