-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Smarty - {htxt} blocks should not be evaluated unless needed #25653
Conversation
(Standard links)
|
Looks good. |
@totten not so fast CRM_Case_Form_EmailTest::testOpeningEmailForm /home/jenkins/bknix-dfl/build/build-1/web/sites/all/modules/civicrm/packages/Smarty/Smarty.class.php:1100 |
@@ -144,6 +144,7 @@ private function initialize() { | |||
$this->default_modifiers[] = 'escape:"htmlall"'; | |||
} | |||
$this->load_filter('pre', 'resetExtScope'); | |||
$this->load_filter('pre', 'htxtFilter'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as an aside - from memory this is one thing I am still stuck on with smarty 3 - I think this way of loading filters changes & I haven't figured out what to do instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fcef51b
to
6b68a5f
Compare
Right-o. It was going line-by-line and failed with certain extra bits at the start of line (eg Also corrected a typo in the new error message. |
Reported regression, https://lab.civicrm.org/dev/core/-/issues/4303 |
Overview
Fixes a common class of PHP warning about
*.hlp
files.Before
The
{htxt}
block appears to act like a conditional expression. If you look atfunction.htxt.php
, it checks the value of$id
and conditionally enables or disables the content.But it is not an effective conditional. The nested content is evaluated before it calls
smarty_block_htxt()
.Consequently, if you try to show help for field
foo
, then it actually evaluates the help message for everything in the.hlp
file (even if it's some quirky field that's not relevant and that requires extra data).After
The
{htxt}
is literally like an{if}
.You don't get warnings about irrelevant data.