While working on #2824851: EntityResource::patch() makes an incorrect assumption about entity keys, hence results in incorrect behavior, I ran into an explicable bug. A second item on a single-cardinality field was being set. Which should have caused tests to fail, because the field was different.

But, when normalized … the field was actually still the same! WTF, right?!

Turns out \Drupal\jsonapi\Normalizer\Value\FieldNormalizerValue::rasterizeValue() helpfully respects the cardinality of the field … but then also silently ignores any additional fields. An assertion verifying this precondition would have saved me tons of time.

CommentFileSizeAuthor
#2 2939800-2.patch631 bytesWim Leers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

Status: Active » Needs review
FileSize
631 bytes
Wim Leers’s picture

Issue tags: +Runtime assertion
Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Great, tests pass, let's do this.

  • Wim Leers committed bacbb0f on 8.x-1.x
    Issue #2939800 by Wim Leers: FieldNormalizerValue::rasterizeValue()...
Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.