[PR #12066] fix: handle DateTime, arrays, and nulls properly in value comparison #13452

Closed
opened 2026-01-22 16:17:09 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/12066

State: closed
Merged: No


Patch Summary

This patch improves the value comparison logic in Doctrine’s UnitOfWork class during change detection.

Key Changes

  • Introduces a private method valuesAreEqual() that compares values with special handling for:

    • null values,
    • DateTimeInterface instances using the spaceship operator (<=>),
    • arrays recursively, checking keys and values,
    • and falls back to strict comparison (===) for other types.
  • Replaces existing strict equality checks with valuesAreEqual() to prevent false positives.

Benefit

Enhances reliability in detecting changes for entities with DateTime and array fields.

**Original Pull Request:** https://github.com/doctrine/orm/pull/12066 **State:** closed **Merged:** No --- ### Patch Summary This patch improves the value comparison logic in Doctrine’s `UnitOfWork` class during change detection. #### Key Changes - Introduces a private method `valuesAreEqual()` that compares values with special handling for: - `null` values, - `DateTimeInterface` instances using the spaceship operator (`<=>`), - arrays recursively, checking keys and values, - and falls back to strict comparison (`===`) for other types. - Replaces existing strict equality checks with `valuesAreEqual()` to prevent false positives. #### Benefit Enhances reliability in detecting changes for entities with `DateTime` and array fields.
admin added the pull-request label 2026-01-22 16:17:09 +01:00
admin closed this issue 2026-01-22 16:17:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#13452