php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23778 The keys in dba_fetch() and dba_exists() require a terminating null character.
Submitted: 2003-05-23 08:22 UTC Modified: 2003-05-28 19:51 UTC
From: bnies at bluewin dot ch Assigned: helly (profile)
Status: No Feedback Package: DBM/DBA related
PHP Version: 4.3.1 OS: SunOS ducati 5.8 Generic_108528-
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-05-23 08:22 UTC] bnies at bluewin dot ch
When doing a dba_exists() or dba_fetch() on a ndbm database then one has to attach a "\0" character to the key string that it matches.

Configuration:

./configure --prefix=/opt/apache \
            --with-apxs2=/opt/apache/bin/apxs \
            --enable-safe-mode \
            --with-openssl=/opt/openssl \
            --with-ldap=/opt/openldap \
            --with-imap=/opt/uw-imap \
            --with-config-file-path=/opt/apache/conf \
            --enable-dba \
            --with-dbm \
            --with-ndbm

Script that explains the problem:

$alias = "some string";
$id = dba_open($ALIASES_FILE, 'r', 'ndbm');
$key = dba_firstkey($id); # $key contains trailing \0 char
print dba_fetch($alias, $id); # does not match
print dba_fetch("$alias\0", $id); # works
dba_close($id);

Don't know whether it works with other dba handlers or other PHP version.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-23 13:46 UTC] helly@php.net
Please execute:

  php runtests-php ext/dba

and pate the output here.
 [2003-05-28 19:51 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 05:01:25 2019 UTC