Jump to content

TypeError when we're trying to load a client's service with hosting addons


Stocki
Go to solution Solved by Stocki,

Recommended Posts

Dear WHMCS!

We're getting the following error message when we're trying to load an AdminArea Product/Service which has a hosting/product addon (e.g.: admin/clientsservices.php?userid=1234&id=56789):

TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /path-to-whmcs/vendor/whmcs/whmcs-foundation/lib/Service.php:0
Stack trace:
#0 /path-to-whmcs/vendor/whmcs/whmcs-foundation/lib/Service.php(0): count(NULL)
#1 /path-to-whmcs/admin/clientsservices.php(0): WHMCS\Service->getAddons()
#2 {main}

We think the problem is around the `tbladdons`.`downloads` column, so we've tried to modify it, but none of the queries were successful:

UPDATE tbladdons SET downloads = '0';
UPDATE tbladdons SET downloads = '';
UPDATE tbladdons SET downloads = '[]';
UPDATE tbladdons SET downloads = ',';

We're using the latest WHMCS 8.7.2 (General Release) with PHP 8.1

Thank you in advance if you can help to solve the problem!

Br,
Richard

Link to comment
Share on other sites

  • Solution

It seems, I've solved the mystery.

Someone has removed an old Product Addon (Configuration » System Settings » Product Addons), but the Hosting Addons were not deleted.

I've created a MySQL query to find the affected Hosting Addon records:

SELECT
	tblhostingaddons.*
FROM tblhostingaddons
LEFT JOIN tbladdons ON tblhostingaddons.addonid = tbladdons.id
WHERE tblhostingaddons.addonid > 0 AND tbladdons.id IS NULL

After backing up (exporting) these rows, I've deleted them:

DELETE
	tblhostingaddons
FROM tblhostingaddons
LEFT JOIN tbladdons ON tblhostingaddons.addonid = tbladdons.id
WHERE tblhostingaddons.addonid > 0 AND tbladdons.id IS NULL

The TypeError message is gone.

I hope this helps someone.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated