Bug #72174 [Csd]: ReflectionProperty#getValue() causes __isset call
| From: | ocramius at gmail dot com | Date: | Thu, 12 May 2016 15:40:30 +0000 |
| Subject: | Bug #72174 [Csd]: ReflectionProperty#getValue() causes __isset call | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201045@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72174&edit=1
ID: 72174
User updated by: ocramius at gmail dot com
Reported by: ocramius at gmail dot com
Summary: ReflectionProperty#getValue() causes __isset call
Status: Closed
Type: Bug
Package: Reflection related
PHP Version: 7.0.6
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Closing, moved remaining bits to https://bugs.php.net/bug.php?id=72209
Previous Comments:
------------------------------------------------------------------------
[2016-05-12 15:39:17] ocramius at gmail dot com
Findings moved to https://bugs.php.net/bug.php?id=72209&thanks=4
------------------------------------------------------------------------
[2016-05-12 15:25:42] ocramius at gmail dot com
@mbeccati this seems to be a failure on doctrine's side. I traced it down, and it seems like:
*
Doctrine\Tests\Models\Cache\City#$state is not defined (property doesn't exist)
* new ReflectionProperty(\Doctrine\Tests\Models\Cache\State::class,
'country') is used as reflection property (wrong class)
* PHP doesn't seem to check that the instance passed to getValue() respects the
original interface ( see https://3v4l.org/0EAZe ), and that
causes the code to fail with a notice rather than with something like a
ReflectionException
I will open a new issue about this.
------------------------------------------------------------------------
[2016-05-12 15:12:28] ocramius at gmail dot com
Saw that failure in my mailbox, thought it was unrelated.
As far as I can remember, doctrine only unsets public properties and uses a reflection
workaround to access them
(https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php),
so something else is going on there.
I'll test against the latest PHP-7.0 ASAP
------------------------------------------------------------------------
[2016-05-12 11:33:27] mbeccati@php.net
it's actually a weird coincidence that it was you who submitted the bug. The fix is actually
causing a regression in Doctrine now:
https://revive.beccati.com/bamboo/browse/PHP-DOCTR-PHP70-720/test/case/30048596
because:
object(ReflectionProperty)#201 (2) {
["name"]=>
string(7) "country"
["class"]=>
string(33) "Doctrine\Tests\Models\Cache\State"
}
and getValue() is called with a Doctrine\Tests\Models\Cache\City entity.
PHP 5.6 doesn't complain, whereas PHP-7.0 current does:
"Undefined property: Doctrine\Tests\Models\Cache\City::$country"
I'll leave it up to you guys to decide what to do ;)
------------------------------------------------------------------------
[2016-05-10 14:14:00] ocramius at gmail dot com
Looks good from here! Related tests seem to pass on 7.0.7-DEV
:beer:
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72174
--
Edit this bug report at https://bugs.php.net/bug.php?id=72174&edit=1