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

CommentFileSizeAuthor
#9 php8.patch11.59 KBalexandersluiter
#8 php8.patch11.58 KBalexandersluiter
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexandersluiter created an issue. See original summary.

alexandersluiter’s picture

StatusFileSize
new11.58 KB

The module does not have a proper 2.x-dev branch to build a merge request off. This is a patch that works against 2.0.0-rc1 that replaces the cron controller with a dependency injected service and is PHP 8 compatible.

alexandersluiter’s picture

StatusFileSize
new11.59 KB

First patch is completely broken. Cron service in wrong location. Here's the working one.

jdhildeb’s picture

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

Thank you, @alexandersluiter for this fix. I've applied your patch after encountering the broken cron job.

I'm updating the subject of this issue to make this patch easier to find.

alexandersluiter’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.