Open Power Template 2.x family
PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!
Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!
Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
FS#40 - Not detected recursion
Attached to Project:
Open Power Template
Opened by Skruppy (Skrupellos) - Thursday, 08 January 2009, 08:58 GMT-8
Last edited by Zyx (Zyx) - Thursday, 22 January 2009, 08:06 GMT-8
Opened by Skruppy (Skrupellos) - Thursday, 08 January 2009, 08:58 GMT-8
Last edited by Zyx (Zyx) - Thursday, 22 January 2009, 08:06 GMT-8
|
DetailsCode:
--- CODE: a.tpl --- <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <opt:root> <opt:include file="a.tpl" /> <opt:include file="a.tpl" /> </opt:root> --- END a.tpl--- --- CODE: b.tpl --- <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <opt:extend file="b.tpl"> <opt:snippet name="slot"> Hello </opt:snippet> </opt:extend> --- END b.tpl--- --- CODE: c.tpl --- <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <b> <opt:insert snippet="slot"> </opt:insert> </b> --- END c.tpl--- Result: Fatal error: Maximum function nesting level of '100' reached, aborting! in lib/Opt/Xml/Scannable.php on line 234 Call Stack # Time Memory Function Location 1 0.0044 60520 {main}( ) ../gui1.php:0 2 0.0745 520880 Opt_Output_Http->render( object(Opt_View)[2], ??? ) ../gui1.php:20 3 0.0749 561996 Opt_View->_parse( object(Opt_Output_Http)[3], long, ???, ??? ) ../Http.php:202 4 0.6465 2897880 require( '.../cache/templates/a.tpl.php' ) ../Class.php:504 5 0.6477 2899876 Opt_View->_parse( object(Opt_Output_Http)[3], long, bool, bool ) ../a.tpl.php:3 6 0.7959 2934744 require( '.../cache/templates/a.tpl.php' ) ../Class.php:504 7 0.7972 2936080 Opt_View->_parse( object(Opt_Output_Http)[3], long, bool, bool ) ../a.tpl.php:3 Expected result: <b>Hello</b> <b>Hello</b> |
This task depends upon
Closed by Zyx (Zyx)
Thursday, 22 January 2009, 08:06 GMT-8
Reason for closing: Fixed
Additional comments about closing: The task was reopened just to hide some user paths in the description. Nothing strange.
Thursday, 22 January 2009, 08:06 GMT-8
Reason for closing: Fixed
Additional comments about closing: The task was reopened just to hide some user paths in the description. Nothing strange.
--- CODE: a.tpl ---
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<opt:include file="b.tpl" />
<opt:include file="b.tpl" />
</opt:root>
--- END a.tpl---
--- CODE: b.tpl ---
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:extend file="c.tpl">
<opt:snippet name="slot">
Hello
</opt:snippet>
</opt:extend>
--- END b.tpl---
Now the result is: Opt_InheritanceRecursion_Exception
Expected result:
<b>Hello</b>
<b>Hello</b>
This happens when:
$tpl = new Opt_Class;
$tpl->compileMode = Opt_Class::CM_REBUILD; <-- the problem
Is it a bug or a feature?
Quick patch:
Opt/Compiler/Class.php, somewhere near line 1114 we have:
----
if($weFree)
{
// Do the cleanup.
self::$_recursionDetector = NULL;
}
----
Replace with:
----
if($weFree)
{
// Do the cleanup.
$this->_dependencies = array();
self::$_recursionDetector = NULL;
}
----
Moreover, I discovered one more problem: if the template `c.tpl` does not have `opt:root` instruction, the compiler generates truncated PHP code.
PS. `opt:include` does not check the recursion.