Guides & Tutorials8.8 UpdateTroubleshootingError: Call to a member function getOnDemandRenewalSettings() on null

Error: Call to a member function getOnDemandRenewalSettings() on null

Symptom

After updating to WHMCS 8.8, a Call to a member function error displays in the Client Area for some users:

Error: Call to a member function getOnDemandRenewalSettings() on null in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/User/Client.php:0 

Cause

The user's current client contains an orphaned service that is in the Cancelled status. An orphaned service is a service for a product that does not exist.

The system does not allow admins to delete products that have an associated service, indicating that someone deleted the data directly from the MySQL® database.

Troubleshooting

Run the following query on your WHMCS MySQL database to identify the orphaned services. You can do this using a tool like phpMyAdmin:

SELECT * FROM `tblhosting` WHERE `packageid` NOT IN (select id from tblproducts)

Solution

To fix this, assign the orphaned services to a product:

1. In the WHMCS Admin area, go to Configuration > System Settings > Products/Services.

2. Click Create a New Product.

3. Enter a product name (for example, Orphaned Service).

4. Click Continue.

5. Note the package ID that displays in the URL in your browser's URL bar:

Package ID 28

6.  Run this MySQL query to assign the orphaned services to the newly-created product, replacing XX with the package ID from the URL:

UPDATE tblhosting SET packageid='XX' WHERE packageid NOT IN (SELECT id FROM tblproducts);