Skip to content

Bugfix/issue 1189 inheritance state leak#1190

Merged
wisskid merged 2 commits into
masterfrom
bugfix/issue_1189_inheritance_state_leak
Jun 23, 2026
Merged

Bugfix/issue 1189 inheritance state leak#1190
wisskid merged 2 commits into
masterfrom
bugfix/issue_1189_inheritance_state_leak

Conversation

@wisskid

@wisskid wisskid commented Jun 19, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Smarty inheritance state leaking across sequential {include} calls in a single render (issue #1189), where a child template’s {block} override could incorrectly affect a later, independent include of the parent template.

Changes:

  • Adds a regression test (PHPUnit + fixtures) reproducing the “PARENT CHILD CHILD” leak and asserting “PARENT CHILD PARENT”.
  • Adjusts InheritanceRuntime::init() to start a fresh inheritance root when entering a new top-level include after an inheritance tree has completed (based on state + empty block source stack).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/UnitTests/TemplateSource/_Issues/1189/templates/top.tpl Repro template including parent → child(extends parent) → parent again.
tests/UnitTests/TemplateSource/_Issues/1189/templates/parent.tpl Defines the parent {block} content (“PARENT”).
tests/UnitTests/TemplateSource/_Issues/1189/templates/child.tpl Extends parent and overrides the {block} content (“CHILD”).
tests/UnitTests/TemplateSource/_Issues/1189/IncludeExtendsBlockLeakIssue1189Test.php Regression test asserting the override does not leak into a later include.
src/Runtime/InheritanceRuntime.php Updates inheritance initialization logic to prevent cross-include state leakage (issue #1189).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wisskid wisskid merged commit 56ab75d into master Jun 23, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants