Fix undefined variable error in Template Variable class #16780
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do?
Move
$policyTablestatement up in scope to avoid error that occurs when$rgEnabledis false and$catEnabledis true.Why is it needed?
In certain scenarios the condition above happens and the error log can quickly fill up with the following warning:
[...server_path]/core/src/Revolution/modTemplateVar.php : 1141) PHP warning: Undefined variable $policyTableHow to test
It's a bit of a needle in the haystack, so I don't have a suggested way to trigger the problematic condition. However, logically, the change made should be done regardless.
Related issue(s)/PR(s)
This is a port of the same change made for 2.x some time ago (PR #16427).