View previous topic :: View next topic |
Author |
Message |
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Mon May 18, 2015 11:56 am Post subject: Apache dies when there are commented lines with {* and *} |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon May 18, 2015 2:14 pm Post subject: |
|
|
Please provide some example code.
I can't reproduce it with my test cases. |
|
Back to top |
|
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Mon May 18, 2015 6:33 pm Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue May 19, 2015 2:55 am Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue May 19, 2015 3:47 am Post subject: |
|
|
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 |
|
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Tue May 19, 2015 6:21 am Post subject: |
|
|
Thank you very much for finding the problem. I will wait for the fix. |
|
Back to top |
|
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Tue May 19, 2015 6:13 pm Post subject: |
|
|
By the way, where should i check for the fix? Thanks. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Wed May 20, 2015 7:11 am Post subject: |
|
|
Thank you. I have downloaded the master version but the problem still exist. Maybe i have done something wrong? |
|
Back to top |
|
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Wed May 20, 2015 8:17 am Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed May 20, 2015 3:43 pm Post subject: |
|
|
Check the software versions you are using. Better yet, remove any bundled crap and install everything by hands. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu May 21, 2015 1:15 am Post subject: |
|
|
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 |
|
gyunay Smarty Rookie
Joined: 18 May 2015 Posts: 8
|
Posted: Thu May 21, 2015 7:01 am Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu May 21, 2015 1:03 pm Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri May 22, 2015 6:54 am Post subject: |
|
|
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 |
|
|