|  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: Assigned Package: Reflection related
PHP Version: 7.1.9 OS: Linux (CentOS)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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] <>
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC