nrueckmann / smarty-php

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

$_tmp1 conflict in template inheritance #149

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
PARENT:
================
{foo bar={'12'|escape}}
    {block name='content'}
        hello from parent
    {/block}
{/foo}
================

CHILD:
================
{extends file='parent.tpl'}

{block name='content'}
    {{'Hello from child'|escape}|escape}
{/block}
================

Full example: https://github.com/mariansollmann/smarty-bug-block

What steps will reproduce the problem?
1. Extend from a template which defines a block in a block-plugin, and pass a 
modified parameter ("12") to it
2. Use modifiers/functions when overwriting that block in the child ("Hello 
from child")
3. The compiled template will use $_tmp1 for the block-plugin-parameter ("12") 
*and* the block-content ("Hello from child")

EXPECTED OUTPUT:
================
<foo>
array (
  'bar' => '12',
)
'

    Hello from child

'
</foo>
================

ACTUAL OUTPUT:
================
<foo>
array (
  'bar' => 'Hello from child',
)
'

    Hello from child

'
</foo>
================

What version of the product are you using? On what operating system?
trunk@4764

Original issue reported on code.google.com by marian.s...@cargomedia.ch on 12 Aug 2013 at 12:37

GoogleCodeExporter commented 8 years ago
The general problem is accepted.

But in you examples you did use unnecessary {...}

The following would create better code (and in this case no error) for the 
desired result.

1. {foo bar='12'|escape}

2. {'Hello from child'|escape|escape}

Original comment by Uwe.Tews@googlemail.com on 12 Aug 2013 at 8:48

GoogleCodeExporter commented 8 years ago
The general fix is now in the SVN trunk and fill later be included in 3.1.15

Original comment by Uwe.Tews@googlemail.com on 12 Aug 2013 at 9:11

GoogleCodeExporter commented 8 years ago
Yes I can confirm that fix. thank you for the fast work.

Original comment by marian.s...@cargomedia.ch on 13 Aug 2013 at 8:31