Mystery foreach error

[email protected] (Angela Barone)
Newsgroups php.general
Message-ID <[email protected]>
	I've been getting the following error for awhile now, but I can't figure out why it's happening:

Invalid argument supplied for foreach() in ... sample.php on line 377

	Here's that portion of code:

include("states_zipcodes.php");

// Check if Zip Code matches from states_zipcodes
$zip_short = substr($zip, 0, 3);
foreach ($states[$state] as &$zip_prefix) {   // <-- line 377
    if ($zip_prefix == $zip_short) {
        break;
    } else {
        $match = 'no';
    }
}

	It doesn't happen all the time, so I'm thinking that some spambot is populating the HTML form with something the script doesn't like(?).  However, I tested that myself by entering text, or by entering just 2 digits, but there was no error.  FYI, I do have code in the script that catches faulty input and warns people in their browser to go back and re-enter the correct data, so I'm at a loss as to why this is happening.

	How can I see what's triggering this to happen?  I have the following line in my php.ini:

error_reporting = E_ALL & E_STRICT & E_NOTICE & E_DEPRECATED

Thank you,
Angela
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.