Jeff-Lewis / smarty-php

Automatically exported from code.google.com/p/smarty-php
0 stars 0 forks source link

child {block} wrapped by block function with parameter name more than 5 characters #128

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. parent.tpl:
<html>
<body>  
<div class="content">{block content}ататат.{/block}</div>
</body>
</html>

2. child.tpl:
{extends file="test/parent.tpl"}
{block content}
{block header}<h2>{$smarty.block.child}</h2>{/block}
{block info}
{$smarty.block.child}
{/block}
{test header="fake"}
{block fields hide}
{$smarty.block.child}
{/block}
{/test}
{/block}

3. form.tpl:
{extends file="test/child.tpl"}
{block fields}
fields
{/block}

4.block function block.test.php:

function smarty_block_test($params, $content, Smarty_Internal_Template 
$template, &$repeat)
{    
    if(!$repeat){
        if (isset($content)) {                      
            return "<i>$content</i>";
        }
    }
}

5. Fatal error: Uncaught exception 'SmartyCompilerException' with message 
'Syntax Error in template &quot;Z:\home\hexagone\templates\test\child.tpl&quot; 
on line 8 &quot;&quot; unclosed {block} tag' in 
Z:\home\hexagone\smarty\sysplugins\smarty_internal_templatecompilerbase.php:657

6. AND
if make func parameter bit shorter, "heade" not "header" - it's ok, works good.

It was Smarty-3.1.12, On Win7 + denwer(WAMP Apache + PHP 5.3.13)

also it was the mysterious problem in same situation. I didnt use func, but 
just wrapped {block childs} with some div, and as result this block disappered 
with its content, and was replaced by value of {$smarty.block.child} from 
previous {block header}, so its was just text from header with several /n 
before and after. Cannot reproduce it now, using blck function instead of 
direct html was my attempt of fix problem.

Original issue reported on code.google.com by yourick...@gmail.com on 28 Dec 2012 at 5:20

Attachments:

GoogleCodeExporter commented 9 years ago
The parsing of child template fails if the name of a {block} appears somewhere 
within another tag. (in this case "header" caused the problem).

Original comment by Uwe.Tews@googlemail.com on 28 Dec 2012 at 8:05

GoogleCodeExporter commented 9 years ago
>if the name of a {block} appears somewhere within another tag
thanks for info.

Original comment by yourick...@gmail.com on 29 Dec 2012 at 9:35

GoogleCodeExporter commented 9 years ago
The bugfix is now in the SVN trunk and will later be included in 3.1.13

Original comment by Uwe.Tews@googlemail.com on 9 Jan 2013 at 11:06