#23778 [NEW]: The keys in dba_fetch() and dba_exists() require a terminating null character.
| From: | bnies at bluewin dot ch | Date: | Fri, 23 May 2003 13:22:03 +0000 |
| Subject: | #23778 [NEW]: The keys in dba_fetch() and dba_exists() require a terminating null character. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-40269@lists.php.net to get a copy of this message | ||
From: bnies at bluewin dot ch
Operating system: SunOS ducati 5.8 Generic_108528-
PHP version: 4.3.1
PHP Bug Type: DBM/DBA related
Bug description: The keys in dba_fetch() and dba_exists() require a terminating null character.
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.
--
Edit bug report at http://bugs.php.net/?id=23778&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23778&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23778&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23778&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23778&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23778&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23778&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23778&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23778&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23778&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23778&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23778&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23778&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23778&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23778&r=gnused