Re: [SMARTY-DEV] Handling TRUE,FALSE,NULL,ON,OFF, etc

From: Date: Wed, 07 Apr 2004 07:49:14 +0000
Subject: Re: [SMARTY-DEV] Handling TRUE,FALSE,NULL,ON,OFF, etc
References: 1 2  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2265@lists.php.net to get a copy of this message
messju mohr writes: > Tagnames, modifiers and variable-names are all case-sensitive. I see > nothing wrong with "true", "null" etc. also being case-sensitive and > only accepted in lowercase. PHP would disagree with you, in as much as TRUE/FALSE/NULL are valid in PHP, even though $x and $X are different. (I know we're talking about Smarty syntax, though, not PHP.) Interestingly, var_dump(null,true,false); gives NULL bool(true) bool(false) so we should at least expect true/false/NULL not true/false/null in Smarty? Regarding modifiers, {"xx"|STRTOUPPER} works (ie using a PHP function) whereas {""|DEFAULT:"YY"} doesn't. However, the behaviour when I try {""|DEFAULT:"YY"} (Smarty error) is very different from when I try TRUE (no complaint, treated as "TRUE") vs true (seen as bool(true)). Given all of this, is there really a good reason _not_ to accept TRUE/FALSE/NULL/ON/OFF etc? The performance impact is negligible (and only to the compiler). I think this is where I disagree with you - if Smarty did only accept "true", "false" etc in lowercase I would see your point. The problem is it *does* accept them, but treats them non-intuitively. Either it should error on them as ambiguous (which would be a lot of coding for little benefit) or should at least handle them the way the user would expect. -- Mark Rogers, More Solutions Ltd :: Tel: 0845 45 89 555

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