Skip to content

Release 1.9

Choose a tag to compare

@igorpocta igorpocta released this 04 Mar 08:11
· 63 commits to main since this release

Bug Fix: Nested validation error paths missing parent prefix

Problem: When a DTO contained a nested object property (e.g. additionalInfo) before an array property (e.g. addresses), validation error paths lost the parent prefix. For example, an invalid address type would report as addresses[0].type instead of the correct client.addresses[0].type.

Root cause: ObjectType and ArrayType reset the denormalizer's pathPrefix to an empty string after processing nested objects, instead of restoring the previous value. This corrupted error paths for any sibling properties processed afterward.

Fix: Both ObjectType and ArrayType now save and restore the previous pathPrefix using a finally block, ensuring parent context is preserved across sibling properties at any nesting depth.

Files changed:

  • src/Types/ObjectType.php
  • src/Types/ArrayType.php
  • tests/PathPrefixRestoreTest.php (7 new tests)