Skip to content

Fix null coalescing operator with imported macros#4778

Merged
fabpot merged 1 commit intotwigphp:3.xfrom
fabpot:macro-fix-null-coalescing-operator
Feb 25, 2026
Merged

Fix null coalescing operator with imported macros#4778
fabpot merged 1 commit intotwigphp:3.xfrom
fabpot:macro-fix-null-coalescing-operator

Conversation

@fabpot
Copy link
Copy Markdown
Contributor

@fabpot fabpot commented Feb 25, 2026

Closes #4776

When using the null coalescing operator with a macro imported via the from tag, the TemplateVariable node inside MacroReferenceExpression was deep-cloned, causing the clone to generate a different $macros key than the one assigned by AssignTemplateVariable. This resulted in a Call to a member function hasMacro() on null error.

@fabpot fabpot merged commit e56cdfd into twigphp:3.x Feb 25, 2026
41 checks passed
@fabpot fabpot deleted the macro-fix-null-coalescing-operator branch February 25, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[3.x] macros not working with null coalescing operator

2 participants