php.net |  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
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: info at heyne dot biz
New email:
PHP Version: OS:

 

 [2005-06-26 15:13 UTC] info at heyne dot biz
Description:
------------
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");
efree(cp);
RETURN_FALSE;
}

Reproduce code:
---------------
$db = dbase_open( 'test.dbf', 2 );
$record = dbase_get_record_with_names ( $db, 1);
unset($record['deleted']);
dbase_add_record( $db, $record );
dbase_close($db);



--> 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-26 19:17 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [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 error..no 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);
unset($record['deleted']);
dbase_add_record( $db, $record );
dbase_close($db);
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jan 27 21:01:23 2020 UTC