dba_insert not working as expected

Bug #62489 dba_insert not working as expected
Submitted: 2012-07-06 08:40 UTC Modified: 2013-01-15 08:39 UTC
From: marc-bennewitz at arcor dot de Assigned: lstrojny (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 5.4.4 OS: openSUSE 11.3 (x86_64)
Private report: No CVE-ID: None

 [2012-07-06 08:40 UTC] marc-bennewitz at arcor dot de

Description:
------------
The function "dba_insert" doesn't work as expected with most handlers.
On calling "dba_insert" on an already existing key the function should return false and do not trigger a warning but that's not the case on most tested handlers.

Test script:
---------------
$dba = dba_open(sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('dba_'), 'c', 'qdbm');

var_dump(dba_insert('key', 'test1', $dba));
var_dump(dba_insert('key', 'test2', $dba));
var_dump(dba_fetch('key', $dba));

Expected result:
----------------
bool(true)
bool(false)
string(5) "test1"

Actual result:
--------------
           RETURN1  RETURN2  WRANING	
flatfile   true     false    YES
inifile    true     true     NO
gdbm       true     false    YES
qdbm       true     false    YES
db4        true     false    NO
-> Didn't test not listed handlers !

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2013-01-15 08:39 UTC] lstrojny@php.net

The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed in the 5.5 and master trees.

 [2013-01-15 08:39 UTC] lstrojny@php.net

-Status: Open +Status: Closed -Assigned To: +Assigned To: lstrojny