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

Smarty 4.5.2 template generation causes PHP Warning: Array to string conversion error #998

Open
jmd8045 opened this issue Apr 18, 2024 · 1 comment

Comments

@jmd8045
Copy link

jmd8045 commented Apr 18, 2024

PHP 8.2

$utility_links = array( 0 => array('name'     => 'Member Login',
                                          'hrefpage' => 'login_page.php'));

TEMPLATE: SMARTY 4.5.2

{section name="i" loop=$utility_links}
        <a href="{$utility_links[i].hrefpage}"> {$utility_links[i].name} </a> |
{/section}

This has been working fine previously, but since conversion to Smarty 4.5.2 I get: Array to string conversion in /var/www/members.austintgca.com/htdocs/smarty/templates_c/1ca2fef31b64289057db4688371cb3bf741c93cd_0.file.static_main_page.tpl.php on line 35

I have just about beat the old noggin to death but I don't see the error: From TEMPLATE GENERATED LINE 35

$_smarty_tpl->_subTemplateRender("file:utility_links_nav.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('utility_links'=>((string)$_smarty_tpl->tpl_vars['utility_links']->value)), 0, false);

Do you think this is a scope error?

Origin: "Smarty object"	
Value
"TGCA - Management System"	
$section_current_member
Origin: "Smarty object"	
Value
" "	
$section_name
Origin: "Smarty object"	
Value
"Sub Menu"	
$sessionid
Origin: "Smarty object"	
Value
"5434647"	
$style_sheet
Origin: "Smarty object"	
Value
"http://jmdlocaltest/../css/emx_nav_left.css"	
$tgca_version
Origin: "Smarty object"	
Value
"PROD_16_07"	
$title
Origin: "Smarty object"	
Value
""	
$utility_links
Origin: "file:utility_links_nav.tpl"	
Value
"Array"	
$ver
Origin: "Smarty object"	
Value
"?v=PROD_16_07"

@wisskid
Copy link
Contributor

wisskid commented Apr 19, 2024

The code you present does not compile into a _subTemplateRender call. Can you provide a reproduction scenario that triggers this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants