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

foreach outputs with boolean false, intented or not

 
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 -> Smarty Development
View previous topic :: View next topic  
Author Message
scdgro
Smarty Regular


Joined: 24 May 2003
Posts: 39
Location: Netherlands

PostPosted: Sat Mar 19, 2011 9:08 am    Post subject: foreach outputs with boolean false, intented or not Reply with quote

Using latest svn release @ smarty 3 :

I wonder why the foreach loop outputs data when the data passed
to it is boolean false.
When the data is null, then the foreach outputs nothing.

The loop below is executed once if $data == false
and never when $data == null
Code:
{foreach $data as $d}
     //some code
{/foreach}


I assumed that null and boolean false both don't give any output.
Back to top
View user's profile Send private message Send e-mail
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Mar 19, 2011 6:17 pm    Post subject: Reply with quote

This is intended behaviour. Only $data=null will not iterate.
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 -> Smarty Development 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