Bug: Smarty include params with spaces breaks
Problem Statement
The {include}
command in the Hazaar Smarty template engine is not handling multi-word string parameters correctly. While the parameters are being parsed correctly, they are incorrectly reconstructed, resulting in each word being individually quoted instead of preserving the original string format.
Steps to Reproduce
-
Use
{include}
with a multi-word string parameter in a Smarty template, such as:{include file="card.tpl" card_title="Another Card Title" card_content="This is another sample card content."}
-
Observe how the parameters are parsed correctly.
-
When the template is processed, the parameters are reconstructed incorrectly, with each word being quoted separately.
Expected Behavior
- Multi-word string parameters should be passed to the included template as a single string, maintaining their original formatting.
- The parsed and reconstructed output should correctly wrap the entire string in quotes as a single entity.
- The included template should receive parameters exactly as they were originally provided.
Actual Behavior
- Multi-word string parameters are being split into separate quoted words.
- Instead of preserving
"Another Card Title"
, the system reconstructs it as"Another" "Card" "Title"
. - This causes unexpected behavior in the included template, as it does not receive the intended string.
Who is affected?
- Developers using
{include}
with multi-word string parameters in Smarty templates. - Applications relying on dynamic template inclusion with descriptive string parameters.
- Users expecting consistent behavior when passing template variables.
Proposed Solution
- Review the parsing and reconstruction logic for
{include}
parameters. - Ensure that multi-word strings remain intact when processed.
- Implement a fix to correctly handle string parameters without splitting them incorrectly.
- Add test cases to validate proper reconstruction of multi-word string parameters.
Priority/Severity
-
High (Critical bug that significantly impacts functionality) -
Medium (Bug that causes incorrect behavior but has workarounds) -
Low (Minor issue with little impact)