Details
Description
We received this report from a customer
When a cPanel account has a bandwidth limit set to 'unlimited' the cPanel module returns a PHP error of:
A non-numeric value encountered on line 1634 in components/modules/cpanel/cpanel.php
This is an error that prevents the a customer facing page: clients/services/manage/2/tabClientStats/ from loading. The following has worked for my use cases.diff --git a/components/modules/cpanel/cpanel.php b/components/modules/cpanel/cpanel.php
index ddbca45..504cb42 100644--- a/components/modules/cpanel/cpanel.php +++ b/components/modules/cpanel/cpanel.php @@ -1626,7 +1626,7 @@ class Cpanel extends Module if (isset($bw->bandwidth[0]->acct[0])) { $stats->bandwidth_usage['used'] = $bw->bandwidth[0]->acct[0]->totalbytes/(1024*1024); - $stats->bandwidth_usage['limit'] = $bw->bandwidth[0]->acct[0]->limit/(1024*1024); + $stats->bandwidth_usage['limit'] = is_numeric($bw->bandwidth[0]->acct[0]->limit) ? $bw->bandwidth[0]->acct[0]->limit/(1024*1024) : ''; } if (isset($stats->account_info->acct[0])) {
I was not able to reproduce this on our server, but since there is no harm in the proposed change it would be good to add it to resolve any potential errors for others.