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

Triple quotes in comments

 
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
BRDude
Smarty Rookie


Joined: 23 Nov 2003
Posts: 17

PostPosted: Wed Nov 26, 2003 2:06 pm    Post subject: Triple quotes in comments Reply with quote

No big deal, easy workaround, but worth mentioning IMHO. The following config file doesn't work:

Code:

# Please use triple quotes (""") for multi-line values

whatever = """This is a
     multi-line
     value."""


{#whatever#} (and any other entry within triple quotes) won't be defined simply because there's a triple quote inside a comment line.
Back to top
View user's profile Send private message
BRDude
Smarty Rookie


Joined: 23 Nov 2003
Posts: 17

PostPosted: Thu Jan 01, 2004 3:19 pm    Post subject: Reply with quote

This bug report seems to have been ignored, I'm bumping it up, hope someone replies about it.

The triple quote bug gave me a hard time the other day, triple quotes should be parsed someway else, the way it's done with preg_replace isn't safe for config files IMHO.
Back to top
View user's profile Send private message
Budda
Smarty Regular


Joined: 19 Apr 2003
Posts: 53
Location: Lymm, Cheshire. UK

PostPosted: Tue Feb 10, 2004 3:27 pm    Post subject: Reply with quote

I'm having a right problem with triple quotes too, but not caused by exactly the same problem.

Using Smarty 2.6.1 on a linux based server.

Some lines in a config file do not appear to be getting picked up any more. So when referencing them as {#whatever#} in the template - it just comes out blank!

Most annoying as i never noticed that this had started happening randomly on the site.

The fix appears to be putting a line break before the next variable definition in the config file. Then Smarty recognises it.

What's the probability of this getting a lookin' and fix?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
ubaldo
Smarty Regular


Joined: 21 Apr 2003
Posts: 35
Location: Barcelona, Spain

PostPosted: Tue Feb 10, 2004 10:10 pm    Post subject: Reply with quote

I'm migrating to 2.6.1 today (from 2.5) and must say that triple quote parsing has been a royal pain.

I hit the comment bug plus another more difficult to track. For example, when the """" is placed right before a section, like this

whatever = """This is a
multi-line
value."""
[a_section]

The config parsing gets messed up. A workaround is a space, for example:

whatever = """This is a
multi-line
value."""

[a_section]

But now, I used to have a value set to 'yes' (for a button label). e.g

yesButtonLabel="""Yes"""

This no longer works, it basically sets the value as a boolean as if you were doing

yesButtonLabel=Yes

I'm having the same problem with Literal 'No'. Haven't found a workaround yet.
_________________
Ubaldo Huerta
http://madrid.loquo.com
http://rentals.loquo.com
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Tue Feb 10, 2004 10:28 pm    Post subject: Reply with quote

i had to rewrite the whole parsing of triple-quotes to handle trip-quotes in comments correctly.
this was done before the 2.6.1 release.
it seems i introduced some bugs with that. i'm having a look into it.

regarding the bug that the section (and other things) following a close '""""' is not recognized:
line 313 of Config_File.class.php should read
$var_value .= substr($lines[$i], 0, $pos);
instead of
$var_value .= substr($lines[$i++], 0, $pos);
Back to top
View user's profile Send private message Send e-mail Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Tue Feb 10, 2004 10:42 pm    Post subject: Reply with quote

regarding the issue with: var = """YES""" becoming (boolean)true is caused by the fact that triple-quoted vars are handled like single-quoted ones now.

to make it become (string)YES you have to set $smarty->config_booleanize=false.
but this is just an ugly workaround for this incompatibility, of course.

i think the best behaviour (though not 100% compatible with 2.5.0) would be:
var="YES" => (string)YES
var=""""YES""" => (string)YES
var = YES => (boolean)true

(when config_booleanize is true. all values are literal "YES" when config_booleanize is false anyway).

not?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Budda
Smarty Regular


Joined: 19 Apr 2003
Posts: 53
Location: Lymm, Cheshire. UK

PostPosted: Wed Feb 11, 2004 1:47 pm    Post subject: Reply with quote

Good stuff.
At least I now know i'm not going mad!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Feb 12, 2004 11:52 am    Post subject: Reply with quote

Okay, I updated Config_File to not booleanize triple-quotes. It should now behave like before Smarty-2.6.1 . please test.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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