Bug #3091 Updated: dbase_replace_record miscounts number of fields
| From: | Bug Database | Date: | Wed, 05 Jan 2000 17:22:04 +0000 |
| Subject: | Bug #3091 Updated: dbase_replace_record miscounts number of fields | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-14286@lists.php.net to get a copy of this message | ||
ID: 3091
User Update by: anne.schoolcraft@mnplan.state.mn.us
Status: Open
Bug Type: dBase related
Description: dbase_replace_record miscounts number of fields
Figured out a fix, with the help of my colleauge, Brent Lund. In the PHP source, in the functions
directory,
the file dbase.c needs to be modified. Change line 348 from
num_fields = _php3_hash_num_elements(fields->value.ht);
to
num_fields = _php3_hash_num_elements(fields->value.ht) - 1;
The original version always saw the "deleted" field of a record that dbase_get_record adds
onto the end
of the record array. Adding the -1 drops the unneeded field.
Saying in the PHP code
unset($rec["deleted"]);
was apparently not effective.
My only concern with this fix is that it assumes it is being passed an array generated by
dbase_get_record or
dbase_get_record_with_names. I'm not sure how it will react if you send it a
"home-made" array.
Anne :)
Full Bug description available at: http://bugs.php.net/?id=3091