On PHP 8.1: PHP message: TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /modules/contrib/saml_attributes_mapping/src/Controller/SamlAttributesMappingController.php on line 66

Created on 21 February 2024, 9 months ago

Problem/Motivation

After security updates to the site (core version - 9.5.11) and updating the PHP version to 8.1, been seeing this PHP error in logs during saml_login.

"PHP message: TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in 
 /web/modules/contrib/saml_attributes_mapping/src/Controller/SamlAttributesMappingController.php on line 66 #0 
 /web/modules/contrib/saml_attributes_mapping/src/Controller/SamlAttributesMappingController.php(66): count()
#1 /web/modules/contrib/saml_attributes_mapping/saml_attributes_mapping.module(53): Drupal\saml_attributes_mapping\Controller\SamlAttributesMappingController->getSamlAttributes()
#2 [internal function]: saml_attributes_mapping_simplesamlphp_auth_user_attributes()
#3 /web/core/lib/Drupal/Core/Extension/ModuleHandler.php(417): call_user_func_array()
#4 /web/modules/contrib/simplesamlphp_auth/src/EventSubscriber/SimplesamlExternalauthSubscriber.php(102): Drupal\Core\Extension\ModuleHandler->invoke()
#5 [internal function]: Drupal\simplesamlphp_auth\Event"

Steps to reproduce

Proposed resolution

Add a check in https://git.drupalcode.org/project/saml_attributes_mapping/-/blob/1.0.x/src/Controller/SamlAttributesMappingController.php?ref_type=heads#L66 to handle when $mappings is null.

Remaining tasks

NA

User interface changes

NA

API changes

NA

Data model changes

NA

🐛 Bug report
Status

Needs review

Version

1.1

Component

Code

Created by

🇮🇳India ankithashetty Karnataka, India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024