|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bolnikh Smarty n00b
Joined: 26 Nov 2014 Posts: 1
|
Posted: Wed Nov 26, 2014 2:56 pm Post subject: Include same template - infinity include, memory finished |
|
|
We have template "loop.tpl".
--------- loop.tpl --------
<h1>Loop</h1>
{include file="loop.tpl"}
----------
It include herself - and we have infinity loop, memory finished error and so on.
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to all
ocate 16384 bytes) in C:\home\test_smarty\Smarty-3.1.21\libs\sysplugins\smarty_i
nternal_templatebase.php on line 180
How can I detect and prevent this situation? I have user edited templates and user can do error. I want to produce exception like "We have infinity loop error", not just crash with memory error
Thanks |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Nov 26, 2014 9:40 pm Post subject: |
|
|
Smarty itself has no way to to detect it. Many users have wanted recursion and deep nesting levels of their templates. If xdebug is installed you can set the xdebug.max_nesting_level paramater in php.ini (default 100) to limit the nestinf of php function calls. But reducing that is also not a good idea as you could run into that limit during template compilations.
So no real solution. |
|
Back to top |
|
|
|
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
|