smarty-php / smarty

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
Other
2.26k stars 712 forks source link

getTemplateVars - why the change in return signature in smarty 5? #994

Closed demeritcowboy closed 7 months ago

demeritcowboy commented 7 months ago

Short version: Any code that calls getTemplateVars() breaks with smarty5 because it's expecting an array of values, and instead getting an array of objects.

Slightly longer version: At the very least the change seems inconsistent. If you pass in a variable name, it returns its value not the object. Either it should always return an object, or not be a breaking change and do what it did before.

What was the reason for the change, and should it be made more consistent (either way)?

wisskid commented 7 months ago

You are correct, this was never intended. I've created https://github.com/smarty-php/smarty/pull/995 Does that fix this issue?

demeritcowboy commented 7 months ago

Yes it does. Great! Thank you.