Bug #73657 [NEW]: Reflection property can't access to ArrayObject property
| From: | ilya at antipenko dot pp dot ua | Date: | Mon, 05 Dec 2016 17:00:15 +0000 |
| Subject: | Bug #73657 [NEW]: Reflection property can't access to ArrayObject property | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205784@lists.php.net to get a copy of this message | ||
From: ilya at antipenko dot pp dot ua
Operating system: Any
PHP version: 7.0.13
Package: Reflection related
Bug Type: Bug
Bug description:Reflection property can't access to ArrayObject property
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 bug report at https://bugs.php.net/bug.php?id=73657&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73657&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73657&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73657&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73657&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73657&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73657&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73657&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73657&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73657&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73657&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73657&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73657&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73657&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73657&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73657&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73657&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73657&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73657&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73657&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73657&r=mysqlcfg