Re: Undifined Indexes

Michael Dunn <[email protected]> Wed, 06 Jul 2005 14:05:13 -0700
Newsgroups gmane.comp.cms.xaraya.knowledge-base
Organization Xaraya
Message-ID <[email protected]>
Thanks Mike,

I was on IRC earlier and found that all exceptions are caught regardless 
of your ini settings. While I definitely agree that all indexes should 
be defined, and I would like to ensure that all indexes are defined, I 
have been faced with a choice: allow my customers to find these, or turn 
  the error reporting off for them and find them myself through my 
development site. Since a couple of these have come up inside our 
shopping cart while the customer was checking out; I'm opting for the 
later. I guess this make me a "less-than-average" developer, but so be 
it; I'd rather run into the errors rather than my customer.

Thank you much for the advice :).

Mike

mikespub wrote:
> In article <[email protected]>, Michael Dunn <[email protected]> 
> wrote:
> 
>>I'm not sure if this is a Xaraya setting or a php_ini setting and I'm 
>>not seeing anyone else having this issue, but, I've got errors turning 
>>up "Undefined Index" errors. I know PHP can over look these, and I've 
>>tested to make sure that I can have a normal PHP page ignore instances 
>>where the index is undefined, however in my Xaraya site this throws an 
>>error. Is there a setting somewhere that I'm missing where this can be 
>>turned off, or are there dire consequences for doing so? I'd like to 
>>catch these, however I'd rather not have the user bothered with them 
>>when it's really not important to the working of the program.
>>
>>Thanks in advance for your help :).
>>
>>Mike
> 
> 
> First you should figure out why you're getting those undefined index
> errors - perhaps a simple check to see if the values exist would fix
> those if you expect them to happen anyway :
> 
> if (isset($mystuff[$idx])) {
>     ... use $mystuff[$idx] ...
> }
> 
> Otherwise, you may have a problem elsewhere that means you're not
> getting the data you were expecting, and you should fix that instead :-)
> 
> For the rest, try setting the following in var/config.system.php :
> 
> $systemConfiguration['Exception.EnablePHPErrorHandler'] = false;
> 
> Mike.