|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33480 dbase_add_record() failed
Submitted: 2005-06-26 15:13 UTC Modified: 2005-07-04 01:00 UTC
Avg. Score:3.7 ± 0.9
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: info at heyne dot biz Assigned:
Status: No Feedback Package: dBase related
PHP Version: 5.0.4 OS: Suse 9.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
23 + 39 = ?
Subscribe to this entry?

 [2005-06-26 15:13 UTC] info at heyne dot biz
dbase_add_record() failed with 'unexpected error'

Problem located in dbase.c: 

PHP_FUNCTION(dbase_add_record) { .....

for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
zval tmp;
if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unexpected error");

Reproduce code:
$db = dbase_open( 'test.dbf', 2 );
$record = dbase_get_record_with_names ( $db, 1);
dbase_add_record( $db, $record );

--> test.dbf contains only String fields ! <--

Expected result:
Record should be inserted

Actual result:
Warning: dbase_add_record() [function.dbase-add-record]: unexpected error in .../export_db.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-26 19:17 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-07-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-07-25 08:07 UTC] a_developer_in at yahoo dot co dot in
No it did not solve that binary helped me..please help me out
 [2006-09-05 02:11 UTC] willyef at gmail dot com
This module has a mistake, You should use dbase_get_record() instead dbase_get_record_with_names(). The dbase_add and dbase_replace cannot use associative matrix.

$db = dbase_open( 'test.dbf', 2 );
$record = dbase_get_record_with_names ( $db, 1);
dbase_add_record( $db, $record );
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC