You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above code fails in 3.1.29 with: Notice: Undefined index: MYVAR. My application uses $smarty quite a lot and uses createTemplate() several times to create custom results that are stored in php variables, all of them broke with "Undefined index". I tried various alternatives, like using assign instead of assignByRef, removing the $smarty as a parent from the createTemplate() parameters and changing variable names, but none of that had any effect. Going back to 3.1.27 makes everything work again.
The text was updated successfully, but these errors were encountered:
For other requirements since 3.1.29 it is possible to call fetch() on a template object but switch to another template.
echo$tpl->fetch('other.tpl');
In your case a new template object was create with same name 'subtemplate.html' but loosing the assigned variable.
#152 does fix this issue, but still calling fetch() on a template object with same template name as in createTemplate() does not make sense and has bad performance.
I upgraded my Smarty from v3.1.27 to v3.1.29 and found the following problem:
$tpl = $smarty->createTemplate('subtemplate.html', null, null, $smarty); $myvar = array("something"); $tpl->assignByRef('MYVAR', $myvar); echo $tpl->fetch('subtemplate.html');
The above code fails in 3.1.29 with: Notice: Undefined index: MYVAR. My application uses $smarty quite a lot and uses createTemplate() several times to create custom results that are stored in php variables, all of them broke with "Undefined index". I tried various alternatives, like using assign instead of assignByRef, removing the $smarty as a parent from the createTemplate() parameters and changing variable names, but none of that had any effect. Going back to 3.1.27 makes everything work again.
The text was updated successfully, but these errors were encountered: