PHP Fatal error: Declaration of Drupal\entity_reference_revisions\Normalizer\EntityReferenceRevisionItemNormalizer::normalize

Created on 27 June 2022, about 2 years ago
Updated 19 October 2023, 8 months ago

Problem/Motivation

After updating core from 9.3 to 9.4
I got this error
PHP Fatal error: Declaration of Drupal\entity_reference_revisions\Normalizer\EntityReferenceRevisionItemNormalizer::normalize($field_item, $format = null, array $context = []) must be compatible with Drupal\hal\Normalizer\EntityReferenceItemNormalizer::normalize($field_item, $format = null, array $context = []): ArrayObject|array|string|int|float|bool|null in /app/docroot/modules/contrib/entity_reference_revisions/src/Normalizer/EntityReferenceRevisionItemNormalizer.php on line 34

Steps to reproduce

- Update from core 9.3 to 9.4
- Check the status report (Deprecated modules enabled Deprecated modules found: HAL.)
- Run composer require drupal/hal-hal command ( issue β†’ )
- The error will appear

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Ahmad Abbad Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    I needed to update the method signature for the normaliser to allow the update to Drupal. Patch is attached for anyone that needs it.

  • πŸ‡¨πŸ‡­Switzerland Berdir Switzerland

    How is that code loaded? Are you using some kind of devel or similar module?

    As mentioned above, this service is not defined when using d10 and the class should not be loaded.

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    We extended this class in our custom code. Not sure if this is still needed and if we should just implement our own version.

  • πŸ‡¨πŸ‡­Switzerland Berdir Switzerland

    Ok, if you actually use the hal module then you want to update your code and extend from the version in the hal module now. If you don't have hal enabled you should be able to safely remove this.

    In our case, we just needed this for default_content integration, but v2 doesn't rely on this or the hal module.

  • πŸ‡³πŸ‡±Netherlands seanB Netherlands

    Thanks, I'll create an issue on our backlog to update our code!

Production build 0.69.0 2024