5

Drupal 9 has now deprecated PHP 7.4. CiviCRM gives lots of deprecated and warning messages under PHP 8.1. It is possible to suppress them by adding

// PHP 8.1 generates lots of warnings that 7.4 does not.
error_reporting(E_ALL & ~E_DEPRECATED & ~E_WARNING);

immediately before

require_once 'CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();

at the bottom of civicrm.settings.php. However, are there plans to change the code so those warnings are no longer given? It is surely better to make sure the code doesn't give deprecated and warning messages?

3
  • after updating to PHP 8.1, I have a punch of warning, like: ``` Warning: Undefined array key "pledgeBlock" in /.../wp-content/uploads/civicrm/templates_c/de_DE/%%3D/3D1/3D13F2BA%%Main.tpl.php on line 138 Warning: Undefined array key "pcpSupporterText" in /.../wp-content/uploads/civicrm/templates_c/de_DE/%%3D/3D1/3D13F2BA%%Main.tpl.php on line 222 Warning: Undefined array key "showMainEmail" in /.../uploads/civicrm/templates_c/de_DE/%%3D/3D1/3D13F2BA%%Main.tpl.php on line 230 Warning: Undefined array key "onBehalfOfFields" in /.../wp-content/uploads/civicrm/templates_c/de_DE/%%B0/B02/B02188B6%%
    – Charly
    Commented Dec 2, 2022 at 11:02
  • pls don't ask a question as an Answer, best to start a new Question and reference this one
    – petednz - fuzion
    Commented Dec 2, 2022 at 18:57
  • See the comment above about suppressing warning while PHP 8.1 support gets sorted. Commented Dec 5, 2022 at 11:56

1 Answer 1

1

Yes it's just a large task and they're getting fixed but slowly. Unlike every other language on the planet php itself has greatly changed, and keeps changing every couple months. As a comparison, imagine if javascript now decided to output warnings when doing something like a + b and a=2 and b=null. So much javascript on the internet would be throwing warnings and need changing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.