Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outputfilter does not return pure HTML anymore when using nocache tags in included templates #160

Closed
kkFelix opened this issue Jan 12, 2016 · 1 comment

Comments

@kkFelix
Copy link

kkFelix commented Jan 12, 2016

Minimal example:

function opf($tpl_output, Smarty_Internal_Template $template) {
    echo '<pre>';
    var_dump(htmlentities($tpl_output));
    echo '</pre>';

    return $tpl_output . '<br>Text from filter';
}

$smarty = new Smarty();
$smarty->setCompileDir('/tmp/smarty/compile');
$smarty->setCacheDir('/tmp/smarty/cache');
$smarty->setCaching(true);
$smarty->setTemplateDir('/tmp/smarty/tpl');
$smarty->registerFilter('output', 'opf');
$smarty->display('test.tpl');

test.tpl:

{include file=test2.tpl}

test2.tpl:

{nocache}
<p>Timestamp: {$smarty.now}</p>
{/nocache}

In Smarty 3.1.27 (or without caching) the $tpl_output variable in the output filter function would be something like

<p>Timestamp: 1452604029</p>

In 3.1.29 (and possibly .28) with enabled cache it is instead

<p>Timestamp: <?php echo time();?></p>

I think it's because of Smarty_Internal_Runtime_UpdateCache::removeNoCacheHash() but did not investigate further.

@uwetews
Copy link
Contributor

uwetews commented Jan 26, 2016

The bugfix is now in the master branch and will later be included in 3.1.30

@uwetews uwetews closed this as completed Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants