ID:               25794
 Updated by:       [EMAIL PROTECTED]
 Reported By:      rcovell at rolet dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         DBM/DBA related
 Operating System: FreeBSD 4.8
 PHP Version:      4.3.4RC1
-Assigned To:      
+Assigned To:      helly


Previous Comments:
------------------------------------------------------------------------

[2003-10-08 10:10:39] rcovell at rolet dot com

Description:
------------
Basically I cannot get php to open an existing (not created by php) db3
hash file when using either "w" or "c".  It seems that php is looking
for a btree format.  My database is a hash file.

More information:
Trying to read/write information to an existing db3 database (sendmail
aliases file).

I can read the file just fine.  But when I try to issue:

$id = dba_open ("aliases5.db", "w", "db3");

I get:
[Wed Oct  8 08:56:44 2003] [error] PHP Warning: 
dba_open(aliases5.db,w): Driver initialization failed for handler: db3:
Invalid argument in /usr/local/www/data/maillists/test3.php on line 3

After further testing I dumped the entire aliases db to a text file
using perl and recreated a copy of it with php:

$id = dba_open ("aliases5.db", "c", "db3");

This worked when creating a new file.  The file sizes where were
different from the original so performed a db3_dump on the newly
created php db3 database.  It seems that php is defaulting to a btree
format when trying to open with either w or c.  My output from the
db3_dump on the php created db3:
VERSION=3
format=bytevalue
type=btree
HEADER=END

And from the one that sendmail created:
VERSION=3
format=bytevalue
type=hash
h_nelem=172
HEADER=END





Reproduce code:
---------------
//Note you need a hash database for this to fail
$id = dba_open ("aliases5.db", "w", "db3");
if (!$id) {
    echo "dba_open failed\n";
    exit;
}
dba_insert ("bkey", "bvalue", $id);

$key = dba_firstkey ($id);

while ($key != false)
{
    echo "<br>Key: " . $key . "->Value: " . dba_fetch ( $key, $id);
    $key = dba_nextkey ($id);
}

dba_close ($id);


Expected result:
----------------
To be able to insert into an existing (not created by php) db3 hash
database.

Actual result:
--------------
[Wed Oct  8 08:56:44 2003] [error] PHP Warning: 
dba_open(aliases5.db,w): Driver initialization failed for handler: db3:
Invalid argument in /usr/local/www/data/maillists/test3.php on line 3


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25794&edit=1

Reply via email to