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

Unexpected input at line xx

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


Joined: 20 Sep 2008
Posts: 25

PostPosted: Tue Dec 14, 2010 8:59 am    Post subject: Unexpected input at line xx Reply with quote

Hi,
while switching to Smart3 I came across something I think is a bug.

Whenever a line if is very long I get an Unexpected input at line xx error and the file is not compiled even if it contains no Smarty tag.

The same files used to compile fine in Smarty 2.

I frequently work with xml files in which long, unformatted lines (15k+ characters) are common, so this is a problem for me. Enclosing the offending line in {literal} tags helps, but it seems like a bad practice having to modifiy all existing xml templates and search for too long lines.

Wouldn't it be possible for the compiler to first check the line if it contains Smarty tag at all and if it doesn't skip the parsing process that throws this error?

Could somebody suggest a solution?
Thx.
SWK
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Tue Dec 14, 2010 12:56 pm    Post subject: Reply with quote

This is a problem when you have very long lines and pcre.backtrack_limit in php.ini has a too low value.

Set it to a (much) higher value or disable it by

Code:
ini_set('pcre.backtrack_limit', -1);
Back to top
View user's profile Send private message
satas
Smarty Rookie


Joined: 10 Mar 2010
Posts: 6
Location: Saint-Petersburg, Russia

PostPosted: Mon Jan 31, 2011 1:39 pm    Post subject: Reply with quote

U.Tews wrote:
This is a problem when you have very long lines and pcre.backtrack_limit in php.ini has a too low value.

Set it to a (much) higher value or disable it by

Code:
ini_set('pcre.backtrack_limit', -1);


Hi I have the same problem.
File smarty3 trying to parse contains special char VT (vertical tab). That template contains only few words (not very long lines as in example above).

Thx in advance.
Back to top
View user's profile Send private message
satas
Smarty Rookie


Joined: 10 Mar 2010
Posts: 6
Location: Saint-Petersburg, Russia

PostPosted: Mon Jan 31, 2011 1:43 pm    Post subject: Reply with quote

Dont know whether that symbol would be saved but i'll try to post it
Code:
text fail
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Mon Jan 31, 2011 2:19 pm    Post subject: Reply with quote

Indeed the lexer/parser did fail on some special chars like VT.

The fix is in the SVN trunk now.
Back to top
View user's profile Send private message
satas
Smarty Rookie


Joined: 10 Mar 2010
Posts: 6
Location: Saint-Petersburg, Russia

PostPosted: Mon Jan 31, 2011 2:56 pm    Post subject: Reply with quote

Many thanx for fast fix, everything works fine now!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 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