Menu

#1 assign incorrectly interprets "0" as a null value

open
nobody
None
5
2005-04-12
2005-04-12
Anonymous
No

First of all, you guys did a fantastic job with XiTemplate.
I looked at Smarty, Savant, patTemplate and others and
they all sucked for one reason or another. XiTemplate
keeps it simple and straight-forward and is really
elegant. In fact, out of frustration I started writing my
own templating engine and two days into it I randomly
stumbled upon XiTemplate. It was almost exactly what I
was building, so it really saved me some time and
headache. I just wish I had stumbled upon it sooner!!

However, I found what I think is a bug. If you assign a
variable the value "0" it will interpret the 0 as a null value
which isn't correct. I realize that you could assume that
0 is a null value and then use the nullValue to get
around it, but I really don't think that's the way it should
have to work. To fix this I changed the assignment test
in the assign function to

$var = ((isset($this->VARS[$v]) && !empty($this->VARS
[$v])) || $this->VARS[$v] == "0") ?
$this->VARS[$v] : $this->nullValue;

I hope this helps.

Thanks,
Jason Roberts
jason_c_roberts@yahoo.com

Discussion


Log in to post a comment.

MongoDB Logo MongoDB