Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Assigning boolean using short hand of {assign} makes strings

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
JayEn84
Smarty n00b


Joined: 27 May 2015
Posts: 3

PostPosted: Tue Aug 01, 2017 9:32 am    Post subject: Assigning boolean using short hand of {assign} makes strings Reply with quote

I want to assign the boolean value true or false to a variable using {assign} within a Smarty template.

Using the conventional way does what I want. But using the short hand version of {assign} creates the strings "true" and "false" instead of the boolean values true and false.

See this sample script:

Code:
<pre>
{* conventional way: creates a boolean value, correct *}
{assign var="testVar" value=true}
{$testVar|var_export:true}

{* short hand way: creates a string value, bug! *}
{assign "testVar" true}
{$testVar|var_export:true}
</pre>
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1270

PostPosted: Tue Aug 01, 2017 5:31 pm    Post subject: Reply with quote

Code:
{$testVar=true}
Back to top
View user's profile Send private message
JayEn84
Smarty n00b


Joined: 27 May 2015
Posts: 3

PostPosted: Mon Aug 07, 2017 4:40 pm    Post subject: Reply with quote

Thanks, this is much better! Smile
However, what I have posted is still a bug, right?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1270

PostPosted: Mon Aug 07, 2017 10:31 pm    Post subject: Reply with quote

If you feel it that way, please post an issue on GitHub.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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