From:             the dot vinculum at gmx dot de
Operating system: Linux
PHP version:      4.3.2
PHP Bug Type:     DBM/DBA related
Bug description:  DBA_firstkey and nextkey do not work properly

Hello,
I encountered a bug while working with the DBA Databse (well i guess thats
a bug).
I saved Guestbook entries in a DBa because of no support of mySQL at my
account.
The way it was saved: x.y = Value
x= is the integer of the entry, eg 1,2,3,4...
y= index of entry, usually to save Name, Title and so on, eg. 1.1, 1.2,
1.3,...
Value is just a String.
This is just en example later i created a DBA with ips, so the key string
is an IP which means that it is unknow to me.
Because of this lack of knowledge of the key names i thought to use the
firstkey and nextkey functions to search the DB.
I tried it at first at my Guestbook DBa = x.y=Value
Here is the ineffective code:

$id= dba_open ("postings.db", "w", "gdbm");
$str.= dba_firstkey($id)." First Key <br>";
for ($i=1;$i<=200;$i++){
if (dba_nextkey($id)==false){ $str.="$i = False<BR>";} else {
$str.= dba_nextkey($id)."<br>";}
}
echo $str;
dba_close($id);

I know it is ineffective i  used the for loop to make sure that it doenst
stops too early .
Fact is that this loop began at 6.3, what is completly nonsense, that is
eiter the first key, nor the last.
And i realized that this way to list them does not show all entries, even
not the first 1.1.
I guess thats a very big bug, because it makes it impossible to work with
the DBA properly.

I hope this description helps you to fix this bug.

Samuel
-- 
Edit bug report at http://bugs.php.net/?id=23919&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=23919&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=23919&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=23919&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=23919&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=23919&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=23919&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=23919&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=23919&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=23919&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=23919&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23919&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=23919&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=23919&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=23919&r=gnused

Reply via email to