Cannot assign null to property AbusiveTrafficCommands::$acquiaApplicationUuid of type string

Created on 15 April 2025, 6 days ago

Problem/Motivation

Following the instructions in the README.md file, I issued the following command in order to determine my application's UUID:
drush abusive_traffic:list-applications
When I did so, I got the following error:

TypeError: Cannot assign null to property Drupal\abusive_traffic\Drush\Commands\AbusiveTrafficCommands::$acquiaApplicationUuid of type string in Drupal\abusive_traffic\Drush\Commands\AbusiveTrafficCommands->initAcquiaApiClientAndProvider() (line 85 of /var/www/html/docroot/modules/contrib/abusive_traffic/src/Drush/Commands/AbusiveTrafficCommands.php).

Steps to reproduce

With PHP version 8.2 or higher, install the abusive_traffic module, and make sure your secret settings are not yet configured. Execute drush abusive_traffic:list-applications and you will get the error noted above.

Proposed resolution

On line 85 of AbusiveTrafficCommands.php, use the null coalescing operator to ensure that if abusive_traffic_acquia_application_uuid.key is unset, that $this->acquiaApplicationUuid will be set to an empty string instead of null. i.e.:

$this->acquiaApplicationUuid = $this->configFactory->get('abusive_traffic_acquia_application_uuid')->get('key') ?? '';

Remaining tasks

Update the code as specified above.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States paulmckibben Atlanta, GA

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