ID: 19867 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: Arrays related Operating System: Linux PHP Version: 4.2.0 New Comment:
I cannot install the snapshot at this time. I don't have access to do that. I'm waiting for the provider to upgrade to 4.2.3. I've put in requests. In the meantime, what I know is, the follow behaves differently between 4.0.6 and 4.2 $sql = "SELECT * FROM $table WHERE gdate=$ymd"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { extract($row); print $score; } Pretty simple standard stuff. I've been using snippets to that effect all over in the projects I do for a couple years, and never noticed this. On the first pass, if $score = 20, it will print 20. On the second pass, is $score = NULL in the DB, it will again print 20. Previously, it would print "<blank>" - as I would expect it to. Could this be a glitch, or change, in mysql_fetch_array() as opposed to extract()? Previous Comments: ------------------------------------------------------------------------ [2002-10-12 02:30:53] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip And if the snapshot doesn't do what you expect, please add a short, self-contained example script here which shows the possible bug clearly. ------------------------------------------------------------------------ [2002-10-11 11:20:18] [EMAIL PROTECTED] In earlier versions of PHP ... when looping through a set of database data, for example, and "extract"ing on each loop -- the extract function would overwrite the variable with the previous value, even if it was NULL. I just recently switched servers that had a more recent version of PHP. Now extract behaves differently. On the next pass through, the variable is not overwritten if the new value is NULL. This requires the use of "unset" on each loop for each variable that could have NULL values. I see nothing in the changelog about this, so I'm trying to determine if it's a bug, or was changed on purpose. If it's a change, I'm not sure I understand why, since it would seem to be much more useful to have it overwritten with the NULL value. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19867&edit=1