Bug: Smarty modifiers should support null/missing values
Quick Information
- Operating System:
- Browser: Chrome / Firefox / Edge / Safari
- Device: Computer / Tablet / Mobile
What Happened?
When using modifiers in Hazaar MVC Smarty templates, an error occurs if a parameter is null or missing. The specific error message is: An error occurred parsing the Smarty template: Hazaar\Template\Smarty\Modifier::capitalize(): Argument #1 ($string) must be of type string, null given, called in /opt/hazaar/vendor/hazaarlabs/hazaar-mvc/src/Template/Smarty.php(228) : eval()'d code on line 72
.
Expected result
Modifiers in Smarty templates should handle null or missing parameters gracefully without throwing errors. Ideally, they should either skip the modification or apply a default value.
Steps to reproduce
- Create a Smarty template that uses a modifier, such as
capitalize
. - Pass a variable to the template that is null or missing.
- Render the template.
- Observe the error due to the null parameter.
Screenshots
Priority/Severity
-
High (anything that impacts the normal user flow or blocks app usage) -
Medium (anything that negatively affects the user experience) -
Low (anything else e.g., typos, missing icons, layout issues, etc.)