Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubbling up of parent scope in template blocks with inheritance chain #851

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maryo
Copy link

@maryo maryo commented Jan 23, 2023

Updating variable in parent scope (when the scope=parent is explicitly used on a tag like assign) now bubbles up (to the including template) even when the included template is part of an inheritance chain as it did pre v3.1.28.

Fixes #850

$_stack = array();
$ptr = $tpl->parent;
if ($mergedScope && isset($ptr) && $ptr->_isTplObj()) {
$_stack[] = $ptr;
if ($tpl->inheritance && $tagScope & Smarty::SCOPE_PARENT) {
Copy link
Author

@maryo maryo Jan 23, 2023

Choose a reason for hiding this comment

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

Templates with an inheritance chain have an implicit Smarty::SCOPE_PARENT. Variables should not bubble up outside the inheritance chain implicitly so I have to explicitly test against the tag scope (not the merged one).

@maryo maryo force-pushed the inheritance-parent-scope branch 4 times, most recently from 0940874 to 3b9e536 Compare January 23, 2023 17:30
@maryo maryo force-pushed the inheritance-parent-scope branch from 3b9e536 to efd40aa Compare May 19, 2023 15:11
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.

Parent scope in template blocks does not bubble up when it extends another template
1 participant