ID:               39166
 User updated by:  peters at yandex dot ru
 Reported By:      peters at yandex dot ru
 Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows and Linux
 PHP Version:      5.1.6
 New Comment:

May be this should be noticed in the manual, because it's not clear
what does mean "also works on objects".


Previous Comments:
------------------------------------------------------------------------

[2006-10-16 13:08:31] [EMAIL PROTECTED]

ARRAY_key_exists() first converts it to ARRAY and then continues
working, which is expected.

------------------------------------------------------------------------

[2006-10-16 12:57:40] peters at yandex dot ru

Description:
------------
array_key_exists() may take object as second parameter and
in such case I think it should use __isset() magic function of the
object (if any), but it seems not to do so.
The  isset() and array_key_exists() may return different results for
the same object, which is not good :)

Reproduce code:
---------------
class TestObject
{
        function __isset($nm)
        {
                return true;
        }
}

$A = new TestObject();

var_dump(array_key_exists('test', $A));
var_dump(isset($A->test));

Expected result:
----------------
true
true

Actual result:
--------------
false
true


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39166&edit=1

Reply via email to