From:             
Operating system: Linux / Windows
PHP version:      5.3.4
Package:          SPL related
Bug Type:         Bug
Bug description:property_exists incorrect on ArrayObject null and 0 values

Description:
------------
Calling property_exists() on an ArrayObject gives a false result on when
the value 

is a false value. This is not in compliance with the description of 

property_exists().



I tried this on PHP 5.3.2 and 5.3.3 under both Linux + Apache and Windows +
IIS.

Test script:
---------------
$a = array('a' => 1, 'b'=> true, 'c' => 0, 'd' => null, 'e' => false, 

  'f' => array());

$o = new ArrayObject($a, ArrayObject::ARRAY_AS_PROPS);



foreach ($a as $key => $value) {

 echo $key . ': ' . (is_null($value) ? 'null' : $value) . 

    ' array_key_exists: ' . (array_key_exists($key, $a) ? 'true' : 'false')
. 

    ' property_exists: ' . (property_exists($o, $key) ? 'true' : 'false');

}



Expected result:
----------------
a: 1 array_key_exists: true property_exists: true

b: 1 array_key_exists: true property_exists: true

c: 0 array_key_exists: true property_exists: true

d: null array_key_exists: true property_exists: true

e: array_key_exists: true property_exists: true

f: Array array_key_exists: true property_exists: true



Actual result:
--------------
a: 1 array_key_exists: true property_exists: true

b: 1 array_key_exists: true property_exists: true

c: 0 array_key_exists: true property_exists: false

d: null array_key_exists: true property_exists: false

e: array_key_exists: true property_exists: false

f: Array array_key_exists: true property_exists: false



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

Reply via email to