Default query cache using wrong object #5143

Closed
opened 2026-01-22 14:59:24 +01:00 by admin · 2 comments
Owner

Originally created by @lcobucci on GitHub (Jun 5, 2016).

Originally assigned to: @Ocramius on GitHub.

On the fix of PHP 7 bug, ReflectionProperty#getValue() is now raising a Notice when accessing an undefined property. That change revealed a false positive on ORM tests!

As you can see here the DefaultQueryCache is always trying to fetch data from $entity even when the association is not with that object (the test is failing because DefaultQueryCache is trying to get the country from the City instead of the State).

How to reproduce: execute the test suite while running PHP 7.0.7

Originally created by @lcobucci on GitHub (Jun 5, 2016). Originally assigned to: @Ocramius on GitHub. On the fix of PHP 7 [bug](https://bugs.php.net/bug.php?id=72174), `ReflectionProperty#getValue()` is now raising a `Notice` when accessing an undefined property. That change revealed a false positive on ORM tests! As you can see [here](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Cache/DefaultQueryCache.php#L266) the `DefaultQueryCache` is always trying to fetch data from `$entity` even when the association is not with that object (the test is failing because `DefaultQueryCache` is trying to get the `country` from the `City` instead of the `State`). **How to reproduce:** execute the test suite while running PHP 7.0.7
admin added the BugDuplicate labels 2026-01-22 14:59:24 +01:00
admin closed this issue 2026-01-22 14:59:24 +01:00
Author
Owner

@Ocramius commented on GitHub (Jun 5, 2016):

@lcobucci can you take a look at #5856? It fixes the issue, but also disables some of the SLC caching happening during hydration of multi-level DQL fetch-joins.

@Ocramius commented on GitHub (Jun 5, 2016): @lcobucci can you take a look at #5856? It fixes the issue, but also disables some of the SLC caching happening during hydration of multi-level DQL fetch-joins.
Author
Owner

@lcobucci commented on GitHub (Jan 7, 2017):

@Ocramius I totally forgot to do a follow up on this issue here.

I'd say it's fixed, let's close it?

@lcobucci commented on GitHub (Jan 7, 2017): @Ocramius I totally forgot to do a follow up on this issue here. I'd say it's fixed, let's close it?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5143