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.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Rank | Ranked higher |
| Fix Version/s | 4.11.0-b2 [ 11503 ] | |
| Fix Version/s | 4.12.0-b1 [ 11502 ] |
| Sprint | 4.12.0 Sprint 1 [ 113 ] |
| Rank | Ranked lower |
| Assignee | Abdy Franco [ abdy ] |
Automated transition triggered when Abdy Franco created a branch in Stash -
| Status | Open [ 1 ] | In Progress [ 3 ] |
Automated transition triggered when Abdy Franco created pull request #30 in Stash -
| Status | In Progress [ 3 ] | In Review [ 5 ] |
| Resolution | Fixed [ 1 ] |
| Remaining Estimate | 0 minutes [ 0 ] | |
| Time Spent | 12 minutes [ 720 ] | |
| Worklog Id | 13878 [ 13878 ] |
Automated transition triggered when Jonathan Reissmueller merged pull request #30 in Stash -
| Status | In Review [ 5 ] | Closed [ 6 ] |
| Resolution | Fixed [ 1 ] | |
| Status | Closed [ 6 ] | Reopened [ 4 ] |
| Fix Version/s | 4.10.3 [ 11504 ] |
Automated transition triggered when Abdy Franco created pull request #31 in Stash -
| Status | Reopened [ 4 ] | In Review [ 5 ] |
| Resolution | Fixed [ 1 ] |
Automated transition triggered when Jonathan Reissmueller merged pull request #31 in Stash -
| Status | In Review [ 5 ] | Closed [ 6 ] |