Re: [SMARTY] bug equating zero and null

From: Date: Tue, 21 Dec 2004 12:00:18 +0000
Subject: Re: [SMARTY] bug equating zero and null
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12061@lists.php.net to get a copy of this message
You can use PHP functions inside if/else clauses: {if isset($x) and ($x == 0)} ... {/if} On Tue, 2004-12-21 at 21:34, Heitzso wrote: > But php gives me "===" and as of 2.6.3 smarty doc > (running gentoo linux) smarty doesn't have that > equivalent test. ? > > >Neither. It's the same behaviour you would expect from the PHP language: > > > >tom@vanilla:~$ cat test.php > ><?php > > > >if (0 == null) { > > echo "0 == null\n"; > >} > > > >if (0 === null) { > > echo "0 === null\n"; > >} > > > >?> > >tom@vanilla:~$ php -f test.php > >0 == null > > > > > >On Tue, 2004-12-21 at 20:46, Heitzso wrote: > > > > > >>Hi, > >> > >>I'm fighting what appears to be a bug in smarty. > >>My variable (let's say $x) coming in is NULL. > >>I have a smarty test: > >> {if $x eq '0'}selected{/if} > >>that is getting triggered by $x being NULL. > >> > >>Ouch. Is that a bug or a feature? > >> > >>?? > >> > >> > >> > > > > > >

« previous php.smarty.general (#12061) next »