Bug #54242 [NEW]: dba_insert returns true if key already exists
| From: | marc-bennewitz at arcor dot de | Date: | Sun, 13 Mar 2011 14:11:37 +0000 |
| Subject: | Bug #54242 [NEW]: dba_insert returns true if key already exists | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159449@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.5
Package: DBM/DBA related
Bug Type: Bug
Bug description:dba_insert returns true if key already exists
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 bug report at http://bugs.php.net/bug.php?id=54242&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54242&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54242&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54242&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54242&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54242&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54242&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54242&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54242&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54242&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54242&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54242&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54242&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54242&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54242&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54242&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54242&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54242&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54242&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54242&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54242&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54242&r=mysqlcfg