Skip to content

bug in readonly properties & native lazy objects, triggers immedtiatelyΒ #12166

@beberlei

Description

@beberlei

Just found another bug with the readonly IDs and new PHP 8.4 ghost objects - if the ID is readonly of a related entity - when it tries to create a proxy for that related entity - the proxy is immediately initialized from the ReadonlyAccessor - it calls the reflection property->isInitialized on the ID and this triggers the initialization in the foreach right after the proxy generation. Here is the stacktrace from inside of the ghost object function to visualize which flow triggered the initialization.

image

This cascades to a very ugly and hard to trace bug - it sets the originalEntityData to empty array, which then behind the scenes ignores all changes made on that entity on flush. Just spent like 3 hours debugging to find that out. Also couldn't use debugger to trace that issue, because the xdebug itself triggers the initialization of entities so manual logs until my head spins..

Originally posted by @vuryss in doctrine/doctrine-website#479 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions