Jump to content

Notice: Undefined index Errors.


Xensus

Recommended Posts

I just recently installed WHMCS and I logged in as an administrator and as I was going to add another administrator, a white screen had came up. I put in the

$display_errors = true;
$display_errors = E_ALL;

inside the configuration.php file.

 

On most of the pages in the administration panel I was greeted by many errors and warnings.

These are the ones I have seen so far.

 

Notice: Undefined variable: action in /home/xensuscom/public_html/whm/xenacp/transactions.php on line 0

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/xensuscom/public_html/whm/includes/classes/WHMCS/Admin.php on line 0

Notice: Undefined variable: period in /home/xensuscom/public_html/whm/xenacp/supportcenter.php on line 0

Warning: Division by zero in /home/xensuscom/public_html/whm/xenacp/supportcenter.php on line 0

Notice: Undefined index: colors in /home/xensuscom/public_html/whm/includes/classes/WHMCS/Chart.php on line 0

Notice: Undefined index: chartarea in /home/xensuscom/public_html/whm/includes/classes/WHMCS/Chart.php on line 0

Notice: Undefined variable: added in /home/xensuscom/public_html/whm/xenacp/configadmins.php on line 0

Notice: Undefined index: SQLErrorReporting in /home/xensuscom/public_html/whm/includes/dbfunctions.php on line 0

Notice: Undefined index: supportannouncementsorder in /home/xensuscom/public_html/whm/includes/classes/WHMCS/Admin.php on line 0

Warning: Cannot modify header information - headers already sent by (output started at /home/xensuscom/public_html/whm/xenacp/supportannouncements.php:0) in /home/xensuscom/public_html/whm/includes/classes/WHMCS/Admin.php on line 0

 

I downloaded straight from the WHMCS clientarea and uploaded to my website, then I installed it and then deleted the install folder. Then I changed the admin area folder name in the configuration file and same with the folder name in the directory.

And that is all I have changed.

Please provide help on what may have happened.

Link to comment
Share on other sites

Hi,

 

 

 

First to let you know, when you post stuff like that never never never show the message with your cpanel username in it. change that to xxxxxx, its nobodies business what your username is...

 

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/xxxxxxxxxx/public_html/whm/includes/classes/WHMCS/Admin.php on line 0

 

Now...

 

notices are just that, they are not errors, they are just notices and they do not cause failure. Most of those (and most sites have them) are mostily because coders are not in the habbit of initializing a var first.

 

Basically what that means is that lets say you have a variable called $myvalue, well if you dont initialize the variable before calling it, you will get a notice. To solve that you just do things like this at the top of the php file.

 

if(!isset($myvalue))

{

$myvalue = '';

}

 

basically that tells the server that if that value is not set (or equal anything) then it is set to null or nothing hense '' coders sometimes get in a hurry to meet deadlines and dont worry about the notices. Do they need to be fixed, sure.... is not doing so bad coding, some would say yes, some would say no. You decide for yourself.

 

The warnings that you get are cause from the fact that you are trying to load a null value (or nothing) into a process or function that needs a value. This too will typically not cause a failure, but then again some warnings i have seen can at a times, but most of the time not.

 

for example

 

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/xensuscom/public_html/whm/includes/classes/WHMCS/Admin.php on line 0

 

what it means is that fetch array expects to get a resource... basically a result from a query for example.. But its getting nothing in value but true false so its failing. Again that is a bad habbit from coders that dont set conditions for thing such as wrap that in a if statement so that if there is no resource then it just passes over it or gives an error if needed.

 

Much like when you do mysql_num_rows() if you try to do num rows on an enpty or failed resource it will give you a warning of the same kind. So what people "should do" when they code is something like this

 

if(mysql_num_rows($whatever) > 0)

{

$total = mysql_num_rows($whatever);

}

 

this way you wont get the warning because total will only load or try to load if there are actually rows there, but people forget when they code.

 

the other warning

 

Warning: Cannot modify header information - headers already sent by (output started at /home/xensuscom/public_html

 

is because someplace you have output, be it a space, or any kind of output at all, before the header is called. The white page typically means there is a syntax error someplace that you changed a file or added or removed something or changed it and its not correct coding.

 

But also you have some kind of output before the header so wherever you changed something you cannot have any output, echo space anything at all that goes out to the browser before the header is called.

 

my guess is that this just came from this

$display_errors = true;

$display_errors = E_ALL;

 

and when you take those away that will disappear...

 

 

 

 

I hope that helps...

 

- - - Updated - - -

 

Also and this might be overkill if your new, but if you ever see @ infront of a var or function or system call, it typically means that there is an error or warning that always occurs and the coder has decided to subdue that warning or error for one reason or another. That symbol basically tells the server not to show the issue or to bypass it and move on. Its not an exact science but thats very very basic...

Edited by durangod
Link to comment
Share on other sites

Hello,

 

Thanks to Durango Dave for explaining what some of those warnings mean. Broadly speaking, we don't recommend setting $display_errors to anything other then true when debugging an issue. Warnings can be printed which break the products header redirect action and will cause the product not to behave as expected.

 

The existence of warnings is not something we consider a defect in product behavior and as such I am going to close this forum thread as not a bug.

 

Have a great day,

 

Nate C

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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