From:             marc-bennewitz at arcor dot de
Operating system: openSUSE 11.3 (x86_64)
PHP version:      5.4.4
Package:          DBM/DBA related
Bug Type:         Bug
Bug description:dba_firstkey & dba_nextkey retuns NULL (instead false) on 
invalid dba resource

Description:
------------
The functions "dba_firstkey" & "dba_nextkey" retuns NULL (instead of false)
on invalid dba resource.
It's documented as "Returns the key on success or FALSE on failure."
That can result in an infinite loop on iterate over items.

Test script:
---------------
$dba = false;

var_dump(dba_firstkey($dba));
var_dump(dba_nextkey($dba));

Expected result:
----------------
PHP Warning:  dba_firstkey() expects parameter 1 to be resource, boolean
given in /tmp/dba_firstkey_nextkey.php on line 5

Warning: dba_firstkey() expects parameter 1 to be resource, boolean given
in /tmp/dba_firstkey_nextkey.php on line 5
boolean(false)
PHP Warning:  dba_nextkey() expects parameter 1 to be resource, boolean
given in /tmp/dba_firstkey_nextkey.php on line 6

Warning: dba_nextkey() expects parameter 1 to be resource, boolean given in
/tmp/dba_firstkey_nextkey.php on line 6
boolean(false)

Actual result:
--------------
PHP Warning:  dba_firstkey() expects parameter 1 to be resource, boolean
given in /tmp/dba_firstkey_nextkey.php on line 5

Warning: dba_firstkey() expects parameter 1 to be resource, boolean given
in /tmp/dba_firstkey_nextkey.php on line 5
NULL
PHP Warning:  dba_nextkey() expects parameter 1 to be resource, boolean
given in /tmp/dba_firstkey_nextkey.php on line 6

Warning: dba_nextkey() expects parameter 1 to be resource, boolean given in
/tmp/dba_firstkey_nextkey.php on line 6
NULL

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62492&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62492&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62492&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62492&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62492&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62492&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62492&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62492&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62492&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62492&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62492&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62492&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62492&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62492&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62492&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62492&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62492&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62492&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62492&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62492&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62492&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62492&r=mysqlcfg

Reply via email to