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

Apache dies when there are commented lines with {* and *}
Goto page 1, 2  Next
 
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 -> General
View previous topic :: View next topic  
Author Message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Mon May 18, 2015 11:56 am    Post subject: Apache dies when there are commented lines with {* and *} Reply with quote

Hi everyone,

I have a very strange problem with smarty 3.1.23.
When I have several lines of code commented by {* and *} the apache dies. There is no error. When i remove the comment the template is compiled and executed correctly. I have no idea why this happen. There is no such problem with the old version (2.6.26) which I used until now.

By the way there is no nested comments in the commented lines. The problem occurs even when it is a pure html.

Can someone give me an advise about this problem? Thank you in advanced.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Mon May 18, 2015 2:14 pm    Post subject: Reply with quote

Please provide some example code.
I can't reproduce it with my test cases.
Back to top
View user's profile Send private message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Mon May 18, 2015 6:33 pm    Post subject: Reply with quote

Below you can find an example code which doesn't work for me:

-- The php code starts here:

require( "smarty-3.1.23/libs/Smarty.class.php" );

$smarty = new Smarty;
$smarty->assign("test", "test value");

$result = $smarty->fetch('test.htm');

echo $result;

--/ The php code ends here.

-- The template starts here:

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ut diam diam. Aenean sodales ligula at tincidunt posuere. Curabitur pharetra hendrerit ligula quis consectetur. Pellentesque vehicula lorem tincidunt turpis porttitor, a adipiscing sem fermentum. Phasellus at vestibulum nisi. Nulla ut pretium eros. Aenean bibendum ante in quam tincidunt volutpat.</p>

{*
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ut diam diam. Aenean sodales ligula at tincidunt posuere. Curabitur pharetra hendrerit ligula quis consectetur. Pellentesque vehicula lorem tincidunt turpis porttitor, a adipiscing sem fermentum. Phasellus at vestibulum nisi. Nulla ut pretium eros. Aenean bibendum ante in quam tincidunt volutpat.</p>
*}

--/ The template ends here.

As you can see the example is very simple. When the commented code is longer than X lines or Y characters the apache dies and I get the following error message: Apache HTTP Server has stopped working

It is very strange. I have not changed anything in the smarty.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Tue May 19, 2015 2:55 am    Post subject: Reply with quote

I found the reason. The parser did run into the preg.backtrack_limit.
Strange that PHP did not drop an error message.

It will be fixed tomorrow.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue May 19, 2015 3:47 am    Post subject: Reply with quote

U.Tews wrote:
I found the reason. The parser did run into the preg.backtrack_limit.

That's such an old problem, that I'm surprised it isn't widely known.
Back to top
View user's profile Send private message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Tue May 19, 2015 6:21 am    Post subject: Reply with quote

Thank you very much for finding the problem. I will wait for the fix.
Back to top
View user's profile Send private message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Tue May 19, 2015 6:13 pm    Post subject: Reply with quote

By the way, where should i check for the fix? Thanks.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed May 20, 2015 3:50 am    Post subject: Reply with quote

The fix is now at https://github.com/smarty-php/smarty in the master branch.

I will later this week release 3.1.24
Back to top
View user's profile Send private message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Wed May 20, 2015 7:11 am    Post subject: Reply with quote

Thank you. I have downloaded the master version but the problem still exist. Maybe i have done something wrong?
Back to top
View user's profile Send private message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Wed May 20, 2015 8:17 am    Post subject: Reply with quote

It seems that the problem exists only on Windows OS with xampp.

I did the same test on a linux server and everything is OK. I hope this will be useful for fixing the problem.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed May 20, 2015 3:43 pm    Post subject: Reply with quote

Check the software versions you are using. Better yet, remove any bundled crap and install everything by hands.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu May 21, 2015 1:15 am    Post subject: Reply with quote

Are you sure you got the right version?
changelog.txt should show corresponding entries for 19.05.2015.

If you use composer make sure that the stability setting allows the installation of dev-master version.

Or get the ZIP file here https://github.com/smarty-php/smarty/archive/master.zip

I did run my tests also in Windows and the patch resolved the problem.
Back to top
View user's profile Send private message
gyunay
Smarty Rookie


Joined: 18 May 2015
Posts: 8

PostPosted: Thu May 21, 2015 7:01 am    Post subject: Reply with quote

Yes i am sure. I checked the changelog.txt. Even i have downloaded the zip from your link today. The same problem continues to exist. When there are any comments {*.....*} the apache dies. Unfortunately there is no error message and this is the bad side of this problem. The apache just die. I checked the log files of apache and php, nothing!

Could it be something else? I mean should i change any setting in my php.ini or apache? I have to fix this problem otherwise.

Thank you once again for your help. I appreciate it. I hope you can help me to fix this problem.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu May 21, 2015 1:03 pm    Post subject: Reply with quote

I told you what you MUST, not "should", do first.
Compare versions of the software on your Windows and Linux hosts.
The problem is in PERL REGEX library. It is not a problem that it runs into bactracks limit, but that it crashes silently, killing everything with it.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Fri May 22, 2015 6:54 am    Post subject: Reply with quote

This is now strange. As I said I could reproduce your problem before my modification on Window. But it was gone now. Which PHP and Apache versions do you use?
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 -> General All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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