Bug #73657 [Com]: Reflection property can't access to ArrayObject property
| From: | ilya at antipenko dot pp dot ua | Date: | Mon, 05 Dec 2016 17:02:25 +0000 |
| Subject: | Bug #73657 [Com]: Reflection property can't access to ArrayObject property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205785@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73657&edit=1
ID: 73657
Comment by: ilya at antipenko dot pp dot ua
Reported by: ilya at antipenko dot pp dot ua
Summary: Reflection property can't access to ArrayObject
property
Status: Open
Type: Bug
Package: Reflection related
Operating System: Any
PHP Version: 7.0.13
Block user comment: N
Private report: N
New Comment:
Seems caused by https://bugs.php.net/bug.php?id=72174
Previous Comments:
------------------------------------------------------------------------
[2016-12-05 17:00:11] ilya at antipenko dot pp dot ua
Description:
------------
Hello.
ReflectionObject::getProperties() returns property which added to ArrayObject with offsetSet(), but
this property can't be gotten by ReflectionProperty::getValue().
See https://3v4l.org/Y2CkO
Test script:
---------------
<?php
class A extends \ArrayObject {}
$a = new A;
$a->offsetSet('test', 'testValue');
$reflection = new \ReflectionObject($a);
$properties = $reflection->getProperties();
$c = count($properties);
echo $c . PHP_EOL;
if ($c) {
echo $properties[0]->getValue($a) . PHP_EOL;
}
Expected result:
----------------
I'm not sure what is expected behaviour, but it's strange to have abiliti get property of
ArrayObject and have not ability to get value of this property.
Variants:
1. Properties have not be returned by ReflectionObject::getProperties()
------ EXPECTED -----
1
testValue
------ EXPECTED -----
2. Property values should be accessible by ReflectionProperty::getValue()
------ EXPECTED -----
0
------ EXPECTED -----
Actual result:
--------------
1
Notice: Undefined property: A::$test in /in/FbMbQ on line 14
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73657&edit=1