Bug #54242 [Csd]: dba_insert returns true if key already exists
| From: | felipe@php.net | Date: | Sun, 13 Mar 2011 14:53:42 +0000 |
| Subject: | Bug #54242 [Csd]: dba_insert returns true if key already exists | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159452@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54242&edit=1
ID: 54242
Updated by: felipe@php.net
Reported by: marc-bennewitz at arcor dot de
Summary: dba_insert returns true if key already exists
Status: Closed
Type: Bug
Package: DBM/DBA related
Operating System: Linux
PHP Version: 5.3.5
Assigned To: felipe
Block user comment: N
Private report: N
New Comment:
Okay, I'll check it.
Previous Comments:
------------------------------------------------------------------------
[2011-03-13 15:51:35] marc-bennewitz at arcor dot de
Much thanks for the very fast fix !
But on a little bit more tests I found similar problems with the
'inifile' handler -> returns true on second insert without a warning
PS: not tested the other handlers yet.
------------------------------------------------------------------------
[2011-03-13 15:23:24] felipe@php.net
This bug has been fixed in SVN.
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/.
Thank you for the report, and for helping us make PHP better.
The bug has been fixed in trunk, I'll merge it in 5.3 branch when the
5.3.6 got released.
Thanks.
------------------------------------------------------------------------
[2011-03-13 15:21:59] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=309172
Log: - Fixed bug #54242 (dba_insert returns true if key already exists)
------------------------------------------------------------------------
[2011-03-13 15:11:36] marc-bennewitz at arcor dot de
Description:
------------
dba_insert returns true if key already exists using handler 'flatfile'
Test script:
---------------
$path = __DIR__ . '/test.dba';
$mode = 'c';
$handler = 'flatfile';
@unlink($path);
$dba = dba_open($path, $mode, $handler);
// first insert success
var_dump(dba_insert('key', 'value', $dba));
// second insert failed -> already exists
var_dump(dba_insert('key', 'value', $dba));
Expected result:
----------------
bool(true)
PHP Warning: dba_insert(key): Key already exists in
/mnt/workspace/zf2/cache/tests/test_dba.php on line 15
Warning: dba_insert(key): Key already exists in
/mnt/workspace/zf2/cache/tests/test_dba.php on line 15
bool(false)
Actual result:
--------------
bool(true)
PHP Warning: dba_insert(key): Key already exists in
/mnt/workspace/zf2/cache/tests/test_dba.php on line 15
Warning: dba_insert(key): Key already exists in
/mnt/workspace/zf2/cache/tests/test_dba.php on line 15
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54242&edit=1