php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #19669 Incomplete documentation for dba_replace
Submitted: 2002-09-30 03:34 UTC Modified: 2002-11-12 20:23 UTC
From: jelte dot werkhoven at itfy dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: ANY OS: ANY
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jelte dot werkhoven at itfy dot com
New email:
PHP Version: OS:

 

 [2002-09-30 03:34 UTC] jelte dot werkhoven at itfy dot com
I think it might be worth mentioning in the documentation for the dba_replace function that to actually replace an entry in a *DBM-type database, you need to pad the value to the exact lenght of the value to be replaced. This seems to go for both entries shorter and longer than the replacing value. I also added a comment to the documention to this extent but this is, in my opinion, cardinal to the differance between dba_replace and dba_insert so it might be worth mentioning. Also, data corruption and infinite growth of the data file will result if the length is not padded.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-30 05:45 UTC] hholzgra@php.net
which ext/dba backend are you refering to? gdbm, db2, db3?
 [2002-09-30 05:51 UTC] jelte dot werkhoven at itfy dot com
I'm using three gdbm databases which are read and written to by both a C daemon and a php-script.
 [2002-10-15 09:06 UTC] jelte dot werkhoven at itfy dot com
I discoverd today that this problem is not actually a problem, but is inherent to the way gdbm (and probably other dbm-style databases) works. If the value of the new entry is longer or shorter than that of the old one, gdbm will insert a new key/value pair, but will not delete the old one, probably for the sake of performance. Only when an optimize is done on the database file, the old key/value pair will be deleted. Gdbm will return the correct value however, even if there seem to be two entries (as seen with less filename.db).
 [2002-11-12 20:23 UTC] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That's the way such libraries work :-(
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 06:01:35 2024 UTC