|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-11 00:58 UTC] felipe@php.net
[2010-12-11 00:58 UTC] felipe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
[2010-12-11 00:58 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
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