Bug: Smarty include params with spaces breaks #330

Closed
opened 2025-03-19 04:38:12 +00:00 by jamie · 6 comments
jamie commented 2025-03-19 04:38:12 +00:00 (Migrated from git.hazaar.io)

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

  1. 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."}
    
  2. Observe how the parameters are parsed correctly.

  3. 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)
## 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 1. Use `{include}` with a multi-word string parameter in a Smarty template, such as: ```smarty {include file="card.tpl" card_title="Another Card Title" card_content="This is another sample card content."} ``` 2. Observe how the parameters are parsed correctly. 3. 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) - [x] Medium (Bug that causes incorrect behavior but has workarounds) - [ ] Low (Minor issue with little impact)
jamie commented 2025-03-19 04:38:13 +00:00 (Migrated from git.hazaar.io)

assigned to @jamie

assigned to @jamie
jamie commented 2025-03-19 04:38:58 +00:00 (Migrated from git.hazaar.io)

created branch 330-bug-smarty-include-params-with-spaces-breaks to address this issue

created branch [`330-bug-smarty-include-params-with-spaces-breaks`](/hazaar/framework/-/compare/master...330-bug-smarty-include-params-with-spaces-breaks) to address this issue
jamie commented 2025-03-19 04:39:03 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !219

mentioned in merge request !219
jamie commented 2025-03-19 04:42:46 +00:00 (Migrated from git.hazaar.io)

mentioned in commit 2e9fc10e4602d97b4324713c3247b29136616f21

mentioned in commit 2e9fc10e4602d97b4324713c3247b29136616f21
jamie commented 2025-03-19 09:16:27 +00:00 (Migrated from git.hazaar.io)

mentioned in commit 6c151437c28ed84c787c98c785330ec44180c92d

mentioned in commit 6c151437c28ed84c787c98c785330ec44180c92d
jamie commented 2025-03-19 09:18:18 +00:00 (Migrated from git.hazaar.io)

mentioned in commit 56eece9f14

mentioned in commit 56eece9f14c9e6e119690fb86de57886fb719cb4
jamie (Migrated from git.hazaar.io) closed this issue 2025-03-19 09:18:18 +00:00
jamie self-assigned this 2025-09-04 01:13:36 +00:00
jamie removed their assignment 2025-09-04 01:13:44 +00:00
jamie self-assigned this 2025-09-04 01:13:48 +00:00
jamie removed their assignment 2025-09-04 01:13:54 +00:00
jamie self-assigned this 2025-09-04 01:14:00 +00:00
jamie removed their assignment 2025-09-04 01:14:06 +00:00
jamie self-assigned this 2025-09-04 01:14:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/framework#330
No description provided.