ID:               50152
 Updated by:       fel...@php.net
-Summary:          ReflectionClass::hasProperty hehaves like isset() not
                   property_exists
 Reported By:      fel...@php.net
-Status:           Assigned
+Status:           Closed
 Bug Type:         Reflection related
 Operating System: Linux
 PHP Version:      5.3SVN-2009-11-11 (SVN)
 Assigned To:      felipe
 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

5.2 is okay, it already checks like property_exists().


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

[2009-11-11 18:52:15] s...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=290515
Log: - Fixed bug #50152 (ReflectionClass::hasProperty hehaves like
isset() not property_exists)
  [5_2 is OK]

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

[2009-11-11 18:39:41] fel...@php.net

Description:
------------
This change looks to be introduced accidentaly in HEAD, and was MFHd by
me times ago. the hasProperty() is currently using the __isset magic
method, this doesn't look right from a reflection perspective. It must
behaves like property_exists() that doesn't uses the magic stuff.

Reproduce code:
---------------
<?php

class foo {
        function __isset($a) {
                var_dump($a);           
                return 1;
        }
}

$x = new foo;
$ref = new ReflectionObject($x);
var_dump($ref->hasProperty('b'));


Expected result:
----------------
bool(false)

Actual result:
--------------
string(1) "b"
bool(true)



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


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

Reply via email to