- π³π±Netherlands Martijn de Wit π³π± The Netherlands
Ran into this problem during a project. Where we use the JSON API to unlock Drupal fields to a decoupled front end.
After installing the patch we get values back and the error message regarding sterilization is gone.
Our error message:
TypeError: Drupal\serialization\Normalizer\PrimitiveDataNormalizer::normalize(): Return value must be of type ArrayObject|array|string|int|float|bool|null, DateInterval returned in Drupal\serialization\Normalizer\PrimitiveDataNormalizer->normalize()
- π«π·France GPZ
Same problem here, With drupal 9.5 and the JSONAPI we had no problem (but the duration field was null).
with drupal D10.1.5 we ran into the same prvious error message in the JSONAPI.
And the patch fixed the error and also now the duration field is not null"field_duration": { "seconds": 3600, "duration": "PT1H" },
- πΊπΈUnited States kdomenick Pennsylvania
After upgrading to D10, we had the same issue and error with JSONAPI endpoints that contained Duration fields. Endpoints with Duration fields were unavailable and this error displayed in the error logs when trying to access them:
TypeError: Drupal\serialization\Normalizer\PrimitiveDataNormalizer::normalize(): Return value must be of type ArrayObject|array|string|int|float|bool|null, DateInterval returned in Drupal\serialization\Normalizer\PrimitiveDataNormalizer->normalize() (line 36 of /var/www/html/web/core/modules/serialization/src/Normalizer/PrimitiveDataNormalizer.php).
Just confirming that the patch resolved the issue for us.
- Status changed to RTBC
12 months ago 10:15am 6 December 2023 - π«π·France bakop Lille
Same here, the patch #7 resolved the issue for me.
I'm on a Drupal 10.1.6 - Status changed to Needs review
10 months ago 11:51am 7 February 2024 - πΊπ¦Ukraine sickness29
Fixed minor issues with #7 patch and added Unit Test for normalizer
- last update
10 months ago 61 pass -
sickness29 β
committed d7461d27 on 8.x-2.x
Issue #3086368 by sickness29, webflo, garphy: class DateInterval is not...
-
sickness29 β
committed d7461d27 on 8.x-2.x
- Status changed to Fixed
6 months ago 12:55pm 21 May 2024 Automatically closed - issue fixed for 2 weeks with no activity.