ReflectionProperty::getValue(): Argument #1 ($object) must be provided for instance properties #7249

Open
opened 2026-01-22 15:48:07 +01:00 by admin · 6 comments
Owner

Originally created by @mostafasy on GitHub (Nov 18, 2023).

Bug Report

I recently updated Doctrine to version 2.17.1 and encountered an error. I'm currently using doctrine/persistence v3.2, and downgrading Doctrine to version 2.16.3 resolved the issue.

ReflectionProperty::getValue(): Argument #1 ($object) must be provided for instance properties

doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php

Q A
BC Break no
Version 2.17.1

Summary

doctrine v2.17.1 does not working fine with doctrine/persistence v3.2

Current behavior

ReflectionProperty::getValue(): Argument #1 ($object) must be provided for instance properties

How to reproduce

the object is empty but when i downgrad the doctrine version...it works fine..

Expected behavior

that everthing work as usaul ...what is the changes in this version that my app not working and get this error? any ideas ?
schema is also valid!

Originally created by @mostafasy on GitHub (Nov 18, 2023). ### Bug Report I recently updated Doctrine to version 2.17.1 and encountered an error. I'm currently using doctrine/persistence v3.2, and downgrading Doctrine to version 2.16.3 resolved the issue. ReflectionProperty::getValue(): Argument #1 ($object) must be provided for instance properties doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php | Q | A |------------ | ------ | BC Break | no | Version | 2.17.1 #### Summary doctrine v2.17.1 does not working fine with doctrine/persistence v3.2 #### Current behavior ReflectionProperty::getValue(): Argument #1 ($object) must be provided for instance properties #### How to reproduce the object is empty but when i downgrad the doctrine version...it works fine.. #### Expected behavior that everthing work as usaul ...what is the changes in this version that my app not working and get this error? any ideas ? schema is also valid!
Author
Owner

@greg0ire commented on GitHub (Nov 18, 2023):

Please provide a stack trace.

@greg0ire commented on GitHub (Nov 18, 2023): Please [provide a stack trace](https://symfony.com/doc/current/contributing/code/stack_trace.html#getting-stack-traces-with-symfony).
Author
Owner

@mostafasy commented on GitHub (Nov 19, 2023):

Thank fpr reply,,,here is a stack trace and with Doctrine version 2.16.3 works fine ..the error occurs only with v 2.17.1, 2.17.0 ...
ps: i am using php 8.2

TypeError
…/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php42
133
ReflectionProperty getValue
…/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php42
132
Doctrine\Persistence\Reflection\RuntimeReflectionProperty getValue
…/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php892
131
Doctrine\ORM\Mapping\ClassMetadataInfo getIdentifierValues
…/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3190
130
Doctrine\ORM\UnitOfWork eagerLoadCollections
…/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3156
129
Doctrine\ORM\UnitOfWork triggerEagerLoads
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php68
128
Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateAllData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270
127
Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll
…/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php779
126
Doctrine\ORM\Persisters\Entity\BasicEntityPersister load
…/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php789
125
Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadById
…/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php521
124
Doctrine\ORM\EntityManager find
…/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3067
123
Doctrine\ORM\UnitOfWork createEntity
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php173
122
Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateRowData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php65
121
Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateAllData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270
120
Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll
…/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php779
119
Doctrine\ORM\Persisters\Entity\BasicEntityPersister load
…/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php815
118
Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadOneToOneEntity
…/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3041
117
Doctrine\ORM\UnitOfWork createEntity
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php173
116
Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateRowData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php65
115
Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateAllData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270
114
Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll
…/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php779
113
Doctrine\ORM\Persisters\Entity\BasicEntityPersister load
…/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php815
112
Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadOneToOneEntity
…/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3041
111
Doctrine\ORM\UnitOfWork createEntity
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php272
110
Doctrine\ORM\Internal\Hydration\ObjectHydrator getEntity
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php498
109
Doctrine\ORM\Internal\Hydration\ObjectHydrator hydrateRowData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php149
108
Doctrine\ORM\Internal\Hydration\ObjectHydrator hydrateAllData
…/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270
107
Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll
…/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php1225
106
Doctrine\ORM\AbstractQuery executeIgnoreQueryCache
…/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php1166
105
Doctrine\ORM\AbstractQuery execute
…/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php953
104
Doctrine\ORM\AbstractQuery getOneOrNullResult
…/vendor/mostafasy/location/src/Service/LocationService.php410
103
Mostafasy\Location\Service\LocationService getLocationById
@mostafasy commented on GitHub (Nov 19, 2023): Thank fpr reply,,,here is a stack trace and with Doctrine version 2.16.3 works fine ..the error occurs only with v 2.17.1, 2.17.0 ... ps: i am using php 8.2 ``` TypeError …/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php42 133 ReflectionProperty getValue …/vendor/doctrine/persistence/src/Persistence/Reflection/RuntimeReflectionProperty.php42 132 Doctrine\Persistence\Reflection\RuntimeReflectionProperty getValue …/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php892 131 Doctrine\ORM\Mapping\ClassMetadataInfo getIdentifierValues …/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3190 130 Doctrine\ORM\UnitOfWork eagerLoadCollections …/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3156 129 Doctrine\ORM\UnitOfWork triggerEagerLoads …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php68 128 Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateAllData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270 127 Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll …/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php779 126 Doctrine\ORM\Persisters\Entity\BasicEntityPersister load …/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php789 125 Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadById …/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php521 124 Doctrine\ORM\EntityManager find …/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3067 123 Doctrine\ORM\UnitOfWork createEntity …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php173 122 Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateRowData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php65 121 Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateAllData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270 120 Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll …/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php779 119 Doctrine\ORM\Persisters\Entity\BasicEntityPersister load …/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php815 118 Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadOneToOneEntity …/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3041 117 Doctrine\ORM\UnitOfWork createEntity …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php173 116 Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateRowData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php65 115 Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator hydrateAllData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270 114 Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll …/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php779 113 Doctrine\ORM\Persisters\Entity\BasicEntityPersister load …/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php815 112 Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadOneToOneEntity …/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php3041 111 Doctrine\ORM\UnitOfWork createEntity …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php272 110 Doctrine\ORM\Internal\Hydration\ObjectHydrator getEntity …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php498 109 Doctrine\ORM\Internal\Hydration\ObjectHydrator hydrateRowData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php149 108 Doctrine\ORM\Internal\Hydration\ObjectHydrator hydrateAllData …/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php270 107 Doctrine\ORM\Internal\Hydration\AbstractHydrator hydrateAll …/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php1225 106 Doctrine\ORM\AbstractQuery executeIgnoreQueryCache …/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php1166 105 Doctrine\ORM\AbstractQuery execute …/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php953 104 Doctrine\ORM\AbstractQuery getOneOrNullResult …/vendor/mostafasy/location/src/Service/LocationService.php410 103 Mostafasy\Location\Service\LocationService getLocationById ```
Author
Owner

@greg0ire commented on GitHub (Nov 19, 2023):

There is a call to egaerLoadCollections in the stack trace. That method was introduced in https://github.com/doctrine/orm/pull/8391

@beberlei , can you please take a look at this?

@greg0ire commented on GitHub (Nov 19, 2023): There is a call to `egaerLoadCollections` in the stack trace. That method was introduced in https://github.com/doctrine/orm/pull/8391 @beberlei , can you please take a look at this?
Author
Owner

@JonasKraska commented on GitHub (Nov 23, 2023):

Not too sure if it fits the same issue, but i might have a problem in the same area. Having an eager loaded many to one relation via an UuidV7 returns an empty collection always. The \Doctrine\DBAL\Logging\DebugStack reveals:

[
  "queries" => array:7 [
    1 => array:4 [
      "sql" => "SELECT t0.id AS id_1 FROM user t0 WHERE t0.id = ?"
      "params" => array:1 [
        0 => "018bfb3b-3f21-7358-adef-fe384bfba23a"
      ]
      "types" => array:1 [
        0 => "uuid"
      ]
      "executionMS" => 0.00029301643371582
    ]
    2 => array:4 [
      "sql" => "SELECT t0.id AS id_1, t0.user_id AS user_id_6 FROM subscription t0 WHERE t0.user_id IN (?)"
      "params" => array:1 [
        0 => array:1 [
          0 => Symfony\Component\Uid\UuidV7 {#1617
            #uid: "018bfb3d-d3f4-74c5-99bf-da78a4d131c4"
            toBase58: "1C5YWr8nowcAGcze6qwjGf"
            toBase32: "01HFXKVMZMEK2SKFYTF2JD2CE4"
            time: "2023-11-23 08:13:35.092000 UTC"
          }
        ]
      ]
      "types" => array:1 [
        0 => 102
      ]
      "executionMS" => 0.00073695182800293
    ]
@JonasKraska commented on GitHub (Nov 23, 2023): Not too sure if it fits the same issue, but i might have a problem in the same area. Having an eager loaded many to one relation via an `UuidV7` returns an empty collection always. The `\Doctrine\DBAL\Logging\DebugStack` reveals: ``` [ "queries" => array:7 [ 1 => array:4 [ "sql" => "SELECT t0.id AS id_1 FROM user t0 WHERE t0.id = ?" "params" => array:1 [ 0 => "018bfb3b-3f21-7358-adef-fe384bfba23a" ] "types" => array:1 [ 0 => "uuid" ] "executionMS" => 0.00029301643371582 ] 2 => array:4 [ "sql" => "SELECT t0.id AS id_1, t0.user_id AS user_id_6 FROM subscription t0 WHERE t0.user_id IN (?)" "params" => array:1 [ 0 => array:1 [ 0 => Symfony\Component\Uid\UuidV7 {#1617 #uid: "018bfb3d-d3f4-74c5-99bf-da78a4d131c4" toBase58: "1C5YWr8nowcAGcze6qwjGf" toBase32: "01HFXKVMZMEK2SKFYTF2JD2CE4" time: "2023-11-23 08:13:35.092000 UTC" } ] ] "types" => array:1 [ 0 => 102 ] "executionMS" => 0.00073695182800293 ] ```
Author
Owner

@greg0ire commented on GitHub (Nov 23, 2023):

An SQL debug stack and a PHP stack trace are 2 different things. How does the DebugStack help here?

@greg0ire commented on GitHub (Nov 23, 2023): An SQL debug stack and a PHP stack trace are 2 different things. How does the `DebugStack` help here?
Author
Owner

@rik702 commented on GitHub (Nov 27, 2023):

I'm getting the same problem on 2.17.x with a OneToMany indexed by a Symfony Uid.
Problem goes away after removing all the applicable fetch:'EAGER' for the trx.

also see #11088

@rik702 commented on GitHub (Nov 27, 2023): I'm getting the same problem on 2.17.x with a OneToMany indexed by a Symfony Uid. Problem goes away after removing all the applicable fetch:'EAGER' for the trx. also see #11088
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7249