Re: foreach fails on unitialized array?
| From: | Richard Lynch | Date: | Sat, 31 Aug 2002 04:52:16 +0000 |
| Subject: | Re: foreach fails on unitialized array? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114752@lists.php.net to get a copy of this message | ||
>>From: "Richard Lynch" <rich@phpbootcamp.com>
>>
>>If you absolute *MUST* refuse to initialize the array (BAD IDEA!)
>>
>>You would be *MUCH* better off listening to those >warnings and fixing your code.
>
>I totally agree with. I was just peeved that PHP would handle unitiliazed
>strings without a warning (a string with no value is treated as an empty
>string), so why would it complain about arrays.
Whoops.
Crank up your error_reporting to E_ALL instead of just E_ALL~E_NOTICE which
is what you have now.
A variable with no value is converted to '', but that can't be converted to
an array, and then you get the error.
There *ARE* "notice" level messages for all the uninitialized strings you're
using. You just ain't seeing them with the default php.ini setting for
error_reporting.
Use E_ALL.
Better code.
Unless they turned *OFF* that warning with the new default register_globals
setting... Surely nobody would be that silly...
--
Like Music? http://l-i-e.com/artists.htm