facebook / facebook/hhvm

ReflectionClass::getProperty returns incorrect class attribute

Open
#7,193 1 comment 0 reactions 0 assignees View on GitHub
php5 incompatibility probably easy
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

See https://3v4l.org/v0vtF for output of the test cases for a number of php and hhvm versions.
### HHVM Version

Initially seen in 3.6.6, also confirmed with 3.12.0
### Standalone code, or other way to reproduce the problem

``` php
getProperty('test');

var_dump($property);
```
### Expected result

```
object(ReflectionProperty)#3 (2) {
["name"]=> string(4) "test"
["class"]=> string(1) "a"
}
```
### Actual result

```
object(ReflectionProperty)#4 (4) {
["info"]=> array(10) {
["name"]=> string(4) "test"
["default"]=> bool(true)
["defaultValue"]=> NULL
["access"]=> string(9) "protected"
["accessible"]=> bool(false)
["modifiers"]=> int(513)
["static"]=> bool(true)
["class"]=> string(1) "a"
["doc"]=> bool(false)
["type"]=> bool(false)
}
["name"]=> string(4) "test"
["class"]=> string(1) "b" // should be "a"
["forceAccessible":"ReflectionProperty":private]=> bool(false)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.