Skip to content

Add regression test for dirty ReferenceMany collection change detection - #3021

Merged
GromNaN merged 1 commit into
doctrine:2.17.xfrom
GromNaN:add-dirty-reference-many-regression-test
Jun 29, 2026
Merged

Add regression test for dirty ReferenceMany collection change detection#3021
GromNaN merged 1 commit into
doctrine:2.17.xfrom
GromNaN:add-dirty-reference-many-regression-test

Conversation

@GromNaN

@GromNaN GromNaN commented Jun 24, 2026

Copy link
Copy Markdown
Member

computeOrRecomputeChangeSet() must detect a ReferenceMany PersistentCollection as changed when it is dirty (same instance, element added or removed). Unlike EmbedMany collections, ReferenceMany are explicitly skipped in the association changeset loop (line 879 of UnitOfWork.php), so detection relies solely on the dirty flag check in the field comparison block.

This test covers a regression introduced by #3017, where replacing the $orgValue === $actualValue guard with spl_object_hash() — functionally equivalent for live objects — causes the dirty collection to be skipped instead of falling through to the changeset.

Ensures that a ReferenceMany PersistentCollection marked as dirty (same
instance, new element added) is detected as changed by computeChangeSets().
Unlike EmbedMany, ReferenceMany collections are excluded from the
association changeset loop, so detection relies solely on the dirty flag
check in computeOrRecomputeChangeSet().
@GromNaN GromNaN added the Task label Jun 24, 2026
@GromNaN GromNaN added this to the 2.17.0 milestone Jun 24, 2026
@GromNaN
GromNaN enabled auto-merge (squash) June 25, 2026 10:22
@GromNaN
GromNaN merged commit 04ca24a into doctrine:2.17.x Jun 29, 2026
31 of 32 checks passed
@GromNaN
GromNaN deleted the add-dirty-reference-many-regression-test branch June 29, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants