webform_civicrm icon indicating copy to clipboard operation
webform_civicrm copied to clipboard

fix deprecated function warnings on wf_crm_get_relationship_types

Open MegaphoneJon opened this issue 2 years ago • 2 comments

Overview

When loading a webform_civicrm page, I get a lot of "Deprecated function" warnings in PHP 8 because I'm passing NULL to strlower(). You can replicate this by creating a new relationship type which has "All Contacts" as its contact type (which is stored in the db as NULL).

Before

Watchdog noise.

After

Less noise.

Technical Details

wf_crm_aval lets us specify the default value, so we can just return an empty string instead of NULL.

Comments

There was already handling for this for contact subtypes but this is more concise, so I also updated the subtype code.

MegaphoneJon avatar Dec 12 '22 16:12 MegaphoneJon

Thanks Jon. There is some noise from a failing iATS test on D9, but this one is real:

Testing modules/contrib/webform_civicrm
.......E....................................................S.    62 / 62 (100%)

Time: 1.09 hours, Memory: 300.00 MB

There was 1 error:

1) Drupal\Tests\webform_civicrm\FunctionalJavascript\ContactRelationshipTest::testSubmitWebform
Behat\Mink\Exception\ElementNotFoundException: Select option with value|text "School is" not found.

/home/runner/drupal/vendor/behat/mink/src/Element/NodeElement.php:234
/home/runner/drupal/vendor/behat/mink/src/Element/TraversableElement.php:262
/home/runner/work/webform_civicrm/webform_civicrm/tests/src/FunctionalJavascript/ContactRelationshipTest.php:194
/home/runner/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

KarinG avatar Dec 12 '22 19:12 KarinG

Thanks for interpreting that for me @KarinG - I wasn't sure how many of those to pay attention to. I'll take a look at this.

MegaphoneJon avatar Dec 12 '22 22:12 MegaphoneJon