From: allan dot s dot oliveira at gmail dot com
Operating system: Windows NT WXP 5.1 build 2600
PHP version: 5.0.5
PHP Bug Type: dBase related
Bug description: php_dbase.dll : dbase_replace_record : tricks to work
Description:
------------
the last bug report was 2001... but, here it goes.
if you get the record and simply try to replace it using the loaded array,
the number of arguments is invalid.
Reproduce code:
---------------
<?php
$dbname = "./tmp/test.dbf"; // dbf name
$def = array( array("date", "D"), array("name", "C", 50), array("age",
"N", 3, 0),
array("email", "C", 128), array("ismember", "L") ); // structure
dbase_create($dbname, $def) // creating
$db=dbase_open($dbname,2) // open to insert
$reg=array("20030912","My Name","33","[EMAIL PROTECTED]",False); //
define record
dbase_add_record($db,$reg) // insert record
dbase_close($db); // close
$db=dbase_open($dbname,2) // open to replace
$row = dbase_get_record_with_names($db, 1); // gets actual row
$row['email'] = "[EMAIL PROTECTED]"; // Update the date field with the
current timestamp
dbase_replace_record($db,$row,1); // replace
// above instruction causes an error : incorrect number of arguments
$reg = array( $row['date'] , $row['name'] , $row['age'] , $row['email'] ,
$row['ismember'] ); // redefine record without 'deleted' column
dbase_replace_record($db,$reg,1); // Replace the record : OK
// This Replace goes OK
dbase_close($db);
echo "Done";
?>
Expected result:
----------------
this should work properly, without any tricks :
$row = dbase_get_record_with_names($db, 1)
$row['email'] = "[EMAIL PROTECTED]";
dbase_replace_record($db,$row,1);
Actual result:
--------------
I recently start to work with some dbase files, and following the
examples, this error should not appear.
--
Edit bug report at http://bugs.php.net/?id=34911&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34911&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34911&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34911&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34911&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34911&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34911&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34911&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34911&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34911&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34911&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34911&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34911&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34911&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34911&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34911&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34911&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34911&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34911&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34911&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34911&r=mysqlcfg