PHP 8.x Compatibility; fixes broken cron job related to non-static method

Created on 11 May 2022, over 2 years ago
Updated 22 November 2023, about 1 year ago

Problem/Motivation

This module is not compatible with PHP 8 due to missing visibility on the cron controller and calling non-static methods against it.

 [error]  Error: Non-static method Drupal\quickbooks_api\Controller\QBOCronController::qboRunCron() cannot be called statically in quickbooks_api_cron() (line 58 of /srv/web/modules/contrib/quickbooks_api/quickbooks_api.module) #0 [internal function]: quickbooks_api_cron()
#1 /srv/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('quickbooks_api_...', Array)
#2 /srv/web/core/lib/Drupal/Core/Cron.php(250): Drupal\Core\Extension\ModuleHandler->invoke('quickbooks_api', 'cron')

Steps to reproduce

Run PHP 8, then cron.

Proposed resolution

Rewrite the cron controller into a service, use dependency injection properly for access to things like Drupal State, Config, etc.

Remaining tasks

See merge request.

User interface changes

None.

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States alexandersluiter

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024