Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
weird bug with empty line.

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


Joined: 11 Mar 2013
Posts: 7

PostPosted: Mon Mar 11, 2013 2:48 pm    Post subject: weird bug with empty line. Reply with quote

Sorry for that stupid subject..

I have found something weird. This is my not working template (3.1.13)
Code:

{include 'header.tpl' delay=5 redir="connect4.php?wid=$wid&xf=$xf&game_id=$game_id"}
<div>
some text..
</div>


This throws me an error:
Code:
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/data/www/site/_xhtml3/connect4.tpl" on line 86 "{include 'header.tpl' delay=5 redir="connect4.php?wid=$wid&amp;xf=$xf&amp;game_id=$game_id"}" - Unexpected "5", expected one of: "identifier"' in


BUT if I add an empty line after {include ..} , it works.
Code:

{include 'header.tpl' delay=5 redir="connect4.php?wid=$wid&amp;xf=$xf&amp;game_id=$game_id"}

<div>
some text...
</div>


it took me hours to figure this out, but i can't understand this, because in the same tpl file I have other includes, and they works without an empty line.

Please explain me, what is wrong with my code.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7237
Location: Lincoln Nebraska, USA

PostPosted: Tue Mar 12, 2013 1:54 pm    Post subject: Reply with quote

Are you using the latest Smarty 3? also did you try adding "file=":

Code:
{include file='header.tpl' delay=5 redir="connect4.php?wid=$wid&amp;xf=$xf&amp;game_id=$game_id"}


It might be a bug, or it might have been fixed if you are not using the latest.
Back to top
View user's profile Send private message Visit poster's website
heal
Smarty Rookie


Joined: 11 Mar 2013
Posts: 7

PostPosted: Tue Mar 12, 2013 4:07 pm    Post subject: Reply with quote

Yes, I'm using the latest Smarty. I've checked this out with v. 3.1.12. I get the same error.

I have checked it with and without 'file='
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7237
Location: Lincoln Nebraska, USA

PostPosted: Tue Mar 12, 2013 4:47 pm    Post subject: Reply with quote

ok how about putting the 5 in quotes? (just trying to find a possible bug workaround)
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


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

PostPosted: Tue Mar 12, 2013 4:48 pm    Post subject: Reply with quote

Again I can't reproduce your problem. It does look like some invisable characters which go away if you edit the template.
Back to top
View user's profile Send private message
heal
Smarty Rookie


Joined: 11 Mar 2013
Posts: 7

PostPosted: Tue Mar 12, 2013 5:36 pm    Post subject: Reply with quote

No, there aren't invisible characters in those lines.
I'm using VIM, checked the hidden characters with :set invlist

Screenshot: image2

I'we checked with quotes, doesn't helped.
Back to top
View user's profile Send private message
heal
Smarty Rookie


Joined: 11 Mar 2013
Posts: 7

PostPosted: Tue Mar 12, 2013 10:19 pm    Post subject: Reply with quote

Based on this post, http://www.smarty.net/forums/viewtopic.php?p=77417#77414 I found the reason, why my production server throws an error and a test server not.
I have mbstring.func_overload=7 in the production server, and 0 on test.
This causes the error.

Thank you for all, U.Tews and mohrt!
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