Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Bug inside if query

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
pvdb
Smarty Rookie


Joined: 07 Mar 2014
Posts: 6

PostPosted: Fri May 27, 2016 12:53 pm    Post subject: Bug inside if query Reply with quote

Hi Guys,

In my template I had a code like:

{if $value.selected == $counter2 }selected{/if}

When $value.selected and $counter2 were numbers, everything works fine.

But for $value.selected = 0 and $counter2 = top1234 it did not work. smarty says 0 is equal to top1234.

As I changed top1234 into 1234top smarty says it is unequal.

I think there should be a little bug or little magic.

Best regards
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 27, 2016 1:37 pm    Post subject: Reply with quote

This is nothing unexpected, and this is how PHP works.
You will get the same result without Smarty, in pure PHP code.
Back to top
View user's profile Send private message
pvdb
Smarty Rookie


Joined: 07 Mar 2014
Posts: 6

PostPosted: Fri May 27, 2016 1:41 pm    Post subject: Reply with quote

Thanks for the feedback.

I did not know that.

Never had such a problem with PHP during the last years.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri May 27, 2016 1:50 pm    Post subject: Reply with quote

https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/#operators
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP