Re: [SMARTY-DEV] config array vars

From: Date: Thu, 26 Feb 2004 12:06:28 +0000
Subject: Re: [SMARTY-DEV] config array vars
References: 1 2  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2162@lists.php.net to get a copy of this message
Okay, you'r right I haven't try it. But then accents should also be accepted as first letter by the regexp. Then I propose this : if (!preg_match("/^[^\W|\d]\w*((\[((\d+)|(\\\$[\w^\d]\w*))\])|(.[\w^\d]\w*))*$/ ", $var_name)) { I added the acceptance of php constants inserted in square bracket, by saying we access them directly by $Const instead of $smarty.const.Const Tarik "Messju Mohr" <messju@lammfellpuschen.de> a écrit dans le message de news:20040226012135.GF5229@pharao.serveftp.org... > On Wed, Feb 25, 2004 at 08:59:52PM +0100, Tarik ANSARI wrote: > > I took a look into the smarty code, and I begin by proposing a new > > preg_match string for _set_config_var function (Config_File.class.php), > > before having a headache :-D (line 357 of 1.6.2 source) > > > > if > > (!preg_match("/^[a-zA-Z_][a-zA-Z0-9_]*((\[[0-9]+\])|(.[a-zA-Z_][a-zA-Z0-9_]* > > ))*$/", $var_name)) { > > > > I did not use anymore the \w match pattern because it seems to rely on local > > settings, for example if the local is ever french, it would accept variable > > names with accents : var_énorme, that is not correct. > > Why is this not correct? Both {#var_énorme#} and > {$smarty.config.var_énorme} work just fine in the template. > > > It looks like there will be a lot of things to change in code... > > > > Tarik

« previous php.smarty.dev (#2162) next »