|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75231 ReflectionProperty#getValue() incorrectly works with inherited classes.
Submitted: 2017-09-20 08:22 UTC Modified: 2017-09-20 11:51 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: t at elless dot me Assigned: krakjoe (profile)
Status: Closed Package: Reflection related
PHP Version: 7.1.9 OS: Linux (CentOS)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: t at elless dot me
New email:
PHP Version: OS:


 [2017-09-20 08:22 UTC] t at elless dot me
Relates to

`ReflectionProperty#getValue($object)` probably incorrectly checks the type of $object. 

`ReflectionProperty#invoke($object)` correctly detect inheritance.

Anyway fix 72209 bug has BC which were not specified in the changes 7.0 => 7.1.
And error message kinda incorrect. "Given object is not an instance of the class this property was declared in" bug given object is exactly an instance of the class this property was declared in.

Test script:

Expected result:

Actual result:
PHP Fatal error:  Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in php71reflection.php:23


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-20 11:51 UTC]
-Assigned To: +Assigned To: krakjoe
 [2017-09-20 11:51 UTC]
It seems to me that the current implementation checks whether the given object
is an instance of the ReflectionProperty object's class property[1]. So indeed,
either the exception message is wrong, or the implementation. Not sure which.

[1] <>
 [2018-07-02 16:58 UTC]
Automatic comment on behalf of
Log: Fixed bug #75231
 [2018-07-02 16:58 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 18 09:01:24 2021 UTC