Bug #63463 [Opn->Fbk]: ReflectionProperty::setValue and ::getValue trigger magic methods

From: Date: Mon, 10 Dec 2012 01:51:32 +0000
Subject: Bug #63463 [Opn->Fbk]: ReflectionProperty::setValue and ::getValue trigger magic methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-175248@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63463&edit=1

 ID:                 63463
 Updated by:         stas@php.net
 Reported by:        ocramius at gmail dot com
 Summary:            ReflectionProperty::setValue and ::getValue trigger
                     magic methods
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Reflection related
 Operating System:   Irrelevant
 PHP Version:        5.4.8
 Block user comment: N
 Private report:     N

 New Comment:

I'm not sure why you think this is what should be happening. When you unset 
properties, they are no longer set. And when you access unset properties, magic 
methods kick in. So where's the problem here?


Previous Comments:
------------------------------------------------------------------------
[2012-11-08 06:22:43] ocramius at gmail dot com

I've added the failing test case as a PR at https://github.com/php/php-src/pull/230

------------------------------------------------------------------------
[2012-11-08 06:15:03] ocramius at gmail dot com

Description:
------------
When unset properties are requested, ReflectionProperty::setValue and ReflectionProperty::getValue
trigger __get and __set magic methods.

Test script:
---------------
https://gist.github.com/4037155

Expected result:
----------------
The test script should report NULL for each of the requested values, and never call __set nor __get

Actual result:
--------------
__set and __get are called when ReflectionProperty tries to read or write to the requested
properties.


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



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


Thread (9 messages)

« previous php.bugs (#175248) next »