Re: [SMARTY-DEV] Suggestion: make template commands case insensitive

From: Date: Wed, 23 Apr 2003 11:29:25 +0000
Subject: Re: [SMARTY-DEV] Suggestion: make template commands case insensitive
References: 1 2 3  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1257@lists.php.net to get a copy of this message
On Wed, Apr 23, 2003 at 01:10:55PM +0200, Wom.bat wrote: > > hmm, yes sorry. see my private mail. grmpf. > ;) you have mail :) > > > yes. this idea came up some time before but hasn't been done yet. > > i would definately also vote for making function/plugins-names case- > > insensitive. > goooooooooooooood ;> > > > only the filenames for autoloaded-plugins make me headaches: no > > problem on windows, where filenames are not case-sensitive > > (*shudder*). but on other system we can have function.showwhatever.php > > and function.showWhatEver.php in the plugin-dir. > > > > which one should we take? > > > > currently function.showWhatEver.php would be taken, but thats case- > > sensitive behaviour. > > > > if we change it to take function.showwhatever.php this *is* a BC issue > > but i ask, is this a real one? > well... erm... in both files, there would be a function declaration: > function smarty_function_showwhatever() > and > function smarty_function_showWhatEver() > but they are the same, and something like that wouldn't work anyways, as php > would then say: > > Fatal error: Cannot redeclare smarty_function_showwhatever() (previously > declared in /home/www/foo/bar/plugins/function.showWhatEver.php:4) in > /home/www/foo/bar/plugins/function.showwhatever.php on line 4 > > so I guess it wouldn't even break BC, would it? > I would suggest that Smarty, in such a case, only reads the first file and > then aborts with an error message explaining that something like this isn't > allowed!? hmm. as i would want to see case-insensitive functions: the plugin-name will be made to lowercase at registration-time. anywhere where the plugin-name is used inside smarty it is also made lowercase before it is looked up inside smarty. this is the most consistent to me. but then the studdly-capped name will not be reconstructable from smarty anymore (comparable to get_class() that always returns lowercase classname). and i definately want to avoid having to readdir() through the plugins-dir to find a case-insentively matching php-file. that's not an option either. so for sake of simplicity and consistency i would like to break BC here a little. the lowercase-plugin-name would become some kind of canonical plugin-name. so the file where it's implementation resides would have to have the canonical name (the 'function.' and the '.php' are also case-sensitive anyway :). but i'll only break this if there is a minimal amount of consensus. :) > Regards, > David > > > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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