Bizarre array create error
| From: | Ken Tozier | Date: | Sun, 29 Jul 2007 22:49:39 +0000 |
| Subject: | Bizarre array create error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-259785@lists.php.net to get a copy of this message | ||
Hi
I'm trying to assign two fields of an object returned from a MySQL query and have stumbled upon the most bizarre PHP bug where I can't create two arrays in succession.
Here's the MySQL query with two dummy fields to be filled in later
select *, 0 as dummy_1, 0 as dummy_2 from table
Here's how I'm grabbing the query results
$result = array();
while ($row = mysql_fetch_object($query_result))
{
$result[] = $row;
}
Once that's done, I try to set two of the rows to arrays like this
$result-> dummy_1 = array(1, 2, 3, 4);
$result-> dummy_2 = array('a', 'b', 'c', 'd');
If I comment out either of the above lines, the script works but with both uncommented, it seems to drop dead. It doesn't even return an error.
I rebooted my system thinking PHP might have gotten into a funky state but that didn't work. I retyped the function from scratch but it still breaks on these two lines. I did a "show invisibles" and "show spaces" in BBEdit to see if there was a hidden character, none found. I did a hex dump to see if there was a hidden character that BBEdit was missing, nope. And I haven't upgraded PHP in a year so it's not a question of an unstable update.
I've been doing assignments like the above for 3 years and never had a problem and in fact the exact same function works perfectly in another script.This one has me utterly stumped.
Anyone have an idea what might be causing this? Or something else I could try to glean more info about the failure?
Thanks in advance
Ken