View previous topic :: View next topic |
Author |
Message |
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Wed Feb 21, 2007 1:22 pm Post subject: preg_match_all -> infinite loop ?! php bug ? |
|
|
when i fetch or display a template, i have this error :
Code: |
Fatal error: Maximum execution time of 60 seconds exceeded in /var/www/myapp/Vendor/Smarty/libs/Smarty_Compiler.class.php on line 1899 |
The line 1899 :
Code: |
1897 function _parse_modifiers(&$output, $modifier_string)
1898 {
1899 preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match);
|
any idea ?
Os : FreeBSD 6.1
PHP : 5.2.1_2
pcre-7.0
smarty 2.6.16 |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Feb 21, 2007 4:06 pm Post subject: |
|
|
Can you post and or PM me the template content that triggers this? |
|
Back to top |
|
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Thu Feb 22, 2007 8:07 am Post subject: |
|
|
ok, i use the fetch function with this template :
Code: |
{if ($SHOW_TABS)}<ul>
<li{$ENTITY_ACTIVE}>Entité</li>
<li{$USERS_ACTIVE}><a href="{MLink module="User"}">Utilisateurs</a></li>
<li{$HOTSPOTS_ACTIVE}><a href="{MLink module="Hotspot"}">Hotspots</a></li>
<li{$GROUPS_ACTIVE}><a href="{MLink module="Group"}">Groupes</a></li>
<li{$PROFILS_ACTIVE}><a href="{MLink module="Profil" controller="Profil" action="select"}">Profils</a></li>
</ul>{/if}
|
the code of the MLink function :
Code: |
<?php
function smarty_function_MLink($params, &$smarty) {
$req = mApp::getCur()->getRequest();
$module = isset($params['module']) ? $params['module'] : $req->getModule();
$controller = isset($params['controller']) ? $params['controller'] : $req->getModule();
$action = isset($params['action']) ? $params['action'] : $req->getAction();
$basename = isset($params['basename']) ? $params['basename'] : $req->getBase();
return ("$basename?module=$module&controller=$controller&action=$action");
}
|
Normaly, after this fetch, i call an other fetch to an other template. So i comment the first, but the second do the same error.
This is the second template :
Code: |
{if isset($_errors)}
{foreach from=$_errors item=_error}
<div class="error">
<img src="images/error.gif" alt="Erreur !" title="Une erreur est survenue" class="error" />
<p>{$_error}</p>
<img src="images/supprimer_mini.gif" alt="effacer erreur" title="effacer erreur" class="del_msg" />
<div style="clear:both;"></div>
</div>
{/foreach}
{/if}
{if isset($_infos)}
{foreach from=$_infos item=_info}
<div class="info">
<img src="images/info.gif" alt="information" title="Message d'inforamtion" class="info" />
<p>{$_info}</p>
<img src="images/supprimer_mini.gif" alt="effacer" title="effacer l'information" class="del_msg" />
<div style="clear:both;"></div>
</div>
{/foreach}
{/if}
<div id="header">
<div id="logo">
<img src="images/logo.gif" />
</div>
<div id="title">
<h1>Superviseur</h1>
</div>
</div>
<div id="menu">
{$ONGLETS}
</div>
<div id="containerCols">
<div id="left">
</div>
<div id="content">
|
I tried to comment the preg_match_all line, so i have a lot of notice error, but, it doesn't stop (or loop) |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Feb 22, 2007 8:40 am Post subject: |
|
|
my guess is you use fetch() in one of your modifiers, in getRequest(), getModule(), getAction() or getBase() or somewhere else and thus built an infinite loop in your application. |
|
Back to top |
|
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Thu Feb 22, 2007 8:40 am Post subject: |
|
|
I tried to fetch this template :
Code: |
<div id="header">
<div id="logo">
<img src="images/logo.gif" />
</div>
<div id="title">
<h1>Supervision</span></h1>
</div>
</div>
<div id="menu">
</div>
<div id="containerCols">
<div id="left">
</div>
<div id="content">
|
it works, but i takes a lot of time ! about (30sec !)
More the file is light, more fast the compilation is "fast"..[/code]
Last edited by nORKy on Thu Feb 22, 2007 8:45 am; edited 1 time in total |
|
Back to top |
|
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Thu Feb 22, 2007 8:43 am Post subject: |
|
|
messju wrote: | my guess is you use fetch() in one of your modifiers, in getRequest(), getModule(), getAction() or getBase() or somewhere else and thus built an infinite loop in your application. |
This is only in the first template I show you. But i commented it an tried the second fetch that doesn't call any function by me
EDIT :
and i know there isn't no fetch function in my modifier |
|
Back to top |
|
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Thu Feb 22, 2007 9:13 am Post subject: |
|
|
perhaps a good new for you (but not for me !)
I tried my code in an other system :
OS : Fedora Core 4
PHP : 5.2.1-1
pcre : 6.3-1.2.
Smarty : 2.6.16
and there is no problem ! |
|
Back to top |
|
immy Smarty n00b
Joined: 22 Feb 2007 Posts: 2
|
Posted: Thu Feb 22, 2007 9:19 am Post subject: |
|
|
Got the same problem as nORKy.
When template's content is just pure text like
Code: | <h2>I say some thing</h2> |
everything is OK.
But since inserting any variable like
Code: | <h2>I say {$my_str}</h2> |
got
Quote: | Fatal error: Maximum execution time of 30 seconds exceeded in /home/www/library/smartySmarty_Compiler.class.php on line 1899 |
and nothing happended in /templates_c/ (it is writeable, yes).
My system:
FreeBSD 5.4-RELEASE
PHP: 5.2.1
PCRE Library Version - 6.7 04-Jul-2006
Smarty: tried all from 2.6.12 till 2.6.16 with th same result
I also experimented on Win platform. With os as WinXP SP2 + XAMPP project (PHP 5.2.1) + Smarty 2.6.16 everything work just fine.
May be platform-dependent bug? |
|
Back to top |
|
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Thu Feb 22, 2007 9:37 am Post subject: |
|
|
immy wrote: |
PCRE Library Version - 6.7 04-Jul-2006
|
It's the PHP module pcre, not the pcre library
on my FreeBSD : 6.7 04-Jul-2006
on my linux FC : 6.6 06-Feb-2006 |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Feb 22, 2007 8:05 pm Post subject: |
|
|
Hmmm. I don't have FreeBSD so I can't test that hypothesi, unfortunately. It does work as expected on the various linux/windows systems I have tested using various versions of PHP up to 5.2.1. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Feb 23, 2007 8:46 am Post subject: |
|
|
I tested on freebsd-6.2 with php-5.2.1_2 from ports (with php5-pcre 6.7 04-Jul-2006) and It works well for me.
nORKy, immy: what architecture are you on? a 64-bit one? |
|
Back to top |
|
immy Smarty n00b
Joined: 22 Feb 2007 Posts: 2
|
Posted: Fri Feb 23, 2007 10:40 am Post subject: |
|
|
A 32-bit architecture. But it is not important anymore. The root of evil is pcre 7.0. I rolled back to 6.7 version and all is fine now! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Feb 23, 2007 11:01 am Post subject: |
|
|
immy wrote: | A 32-bit architecture. But it is not important anymore. The root of evil is pcre 7.0. I rolled back to 6.7 version and all is fine now! |
that's rather irritating to me, since php5-pcre should use the pcre that comes bundled with php, not the system's one. (that's at least what my port of php5-pcre does.) |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Feb 23, 2007 5:36 pm Post subject: |
|
|
It is also irritiating since the latest PHP4 RC is apparently bundling pcre7. Has anyone tested that build yet? |
|
Back to top |
|
nORKy Smarty Rookie
Joined: 21 Feb 2007 Posts: 9
|
Posted: Mon Feb 26, 2007 9:09 am Post subject: |
|
|
i rolled back to pcre-6.6_1 and now it's OK
so, the bug comes from pcre-7.0 |
|
Back to top |
|
|