Re: Uninitialized string offset

From: Date: Fri, 05 Jul 2002 11:51:24 +0000
Subject: Re: Uninitialized string offset
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-105623@lists.php.net to get a copy of this message
You'll have to check each part of the array with isset in order to get rid of this warning e.g if ((isset($GLOBALS['SPEEDY_GLOBAL_VARS'])) && (isset($GLOBALS['SPEEDY_GLOBAL_VARS']['CURRENT_USER'])) && (isset($GLOBALS['SPEEDY_GLOBAL_VARS']]['CURRENT_USER']['UserName']))) Of course, you can get rid of the first isset if you're absolutely sure that $GLOBALS['SPEEDY_GLOBAL_VARS'] will always be set, but I'd leave it in there, just in case. HTH Danny. ----- Original Message ----- From: "Chris Hewitt" <g0pae@manordat.demon.co.uk> To: "Uri Even-Chen" <webmaster@speedy.co.il> Cc: <php-general@lists.php.net> Sent: Friday, July 05, 2002 12:17 PM Subject: Re: [PHP] Uninitialized string offset > Uri, > > Sounds like the error reporting is set to E_ALL on the new php version > and was set at a lower level before. The error indicates that the > variable has not specfically been assigned a value before being used. > > if > > >>(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['CURRENT_USER']['UserName'])) > > > >I always use isset to check if a variable is defined. Do you know why I > >get this warning?

« previous php.general (#105623) next »