-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
[php8-compact] Add in guards into various templates to fix the CRM_Co… #20579
[php8-compact] Add in guards into various templates to fix the CRM_Co… #20579
Conversation
(Standard links)
|
3a1c836
to
560b4f3
Compare
<tr> | ||
{if !$type || $type eq 'tag'} | ||
{if empty($type) || (isset($type) && $type eq 'tag')} |
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.
The second guard is redundant because after the ||
we know type is not empty and therefore isset.
{if empty($type) || (isset($type) && $type eq 'tag')} | |
{if empty($type) || $type eq 'tag'} |
{$form.tag.html} | ||
</div> | ||
{if $context NEQ 'profile'} | ||
{if !isset($context) || (isset($context) && $context NEQ 'profile')} |
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.
The second guard is redundant because after the ||
we know $context
is set.
{if !isset($context) || (isset($context) && $context NEQ 'profile')} | |
{if !isset($context) || $context NEQ 'profile'} |
@@ -22,7 +22,7 @@ | |||
<div id="Address_Block_{$blockId}" {if $className eq 'CRM_Contact_Form_Contact'} class="boxBlock crm-edit-address-block crm-address_{$blockId}"{/if}> | |||
{if $blockId gt 1}<fieldset><legend>{ts}Supplemental Address{/ts}</legend>{/if} | |||
<table class="form-layout-compressed crm-edit-address-form"> | |||
{if $masterAddress.$blockId gt 0 } | |||
{if isset($masterAddress) && $masterAddress.$blockId gt 0 } |
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.
I'll be you anything the IDs don't go into negative numbers and the gt
was just another way of saying
{if isset($masterAddress) && $masterAddress.$blockId gt 0 } | |
{if !empty($masterAddress.$blockId) } |
But your version is a more literal interpretation of what was already there so probably safer.
{include file="CRM/common/Tagset.tpl"} | ||
{/if} | ||
</td> | ||
{/if} | ||
{if !$type || $type eq 'group'} | ||
{if isset($type) && $type eq 'group'} |
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.
I don't think that's exactly the same. I think it should be
{if isset($type) && $type eq 'group'} | |
{if empty($type) || $type eq 'group'} |
Disclaimer: this is making my brain hurt so I could be wrong
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.
Markdown table to the rescue!
The integer 0 one is fun.
type | {if !$type || $type eq 'group'} | {if isset($type) && $type eq 'group'} | {if empty($type) || $type eq 'group'} |
---|---|---|---|
unset | TRUE | FALSE | TRUE |
null | TRUE | FALSE | TRUE |
group | TRUE | TRUE | TRUE |
banana | FALSE | FALSE | FALSE |
"" | TRUE | FALSE | TRUE |
"0" | TRUE | FALSE | TRUE |
"1" | FALSE | FALSE | FALSE |
0 | TRUE | TRUE | TRUE |
1 | FALSE | FALSE | FALSE |
TRUE | TRUE | TRUE | TRUE |
FALSE | TRUE | FALSE | TRUE |
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.
LOL, you never know when you expect a group but it's actually a banana.
…ntact_Form_IndividualTest suite
560b4f3
to
e2e6000
Compare
Thanks @colemanw @demeritcowboy I believe I have fixed those issues mentioned in the TagsAndGroups tpl file which seemed to be the only one of concern. |
…ntact_Form_IndividualTest suite
Overview
This adds in a number of if guards to fix the CRM_Contact_Form_IndividualTest suite on php8
Before
CRM_Contact_Form_IndividualTest fails on php8
After
CRM_Contact_Form_IndividualTest passes on php8
ping @demeritcowboy @totten @colemanw