### Problem/Motivation
Upgrading to Drupal Core 11.4+ results in a fatal error when serialization operations are triggered on Bibcite entities.

This happens because Drupal 11.4 narrowed the return types of standard normalizers across its core serialization components to a strict `: array`. Since `Drupal\bibcite_entity\Normalizer\ReferenceNormalizerBase` extends `Drupal\serialization\Normalizer\ComplexDataNormalizer`, its broader union return type signature (`: ArrayObject|array|string|int|float|bool|null`) now triggers a strict PHP fatal error due to a Liskov Substitution Principle (LSP) violation.

**Error message:**
> Fatal error: Declaration of Drupal\bibcite_entity\Normalizer\ReferenceNormalizerBase::normalize($object, $format = null, array $context = []): ArrayObject|array|string|int|float|bool|null must be compatible with Drupal\serialization\Normalizer\ComplexDataNormalizer::normalize($object, $format = null, array $context = []): array in /var/www/html/web/modules/contrib/bibcite/modules/bibcite_entity/src/Normalizer/ReferenceNormalizerBase.php on line 342

### Steps to reproduce
1. Install Drupal Core 11.4.2 (or any version 11.4+)
2. Install Bibliography & Citation (bibcite) version 3.1.0
3. Trigger normalizer execution (e.g., attempt to export a reference via REST/JSON or trigger bibcite entity operations that leverage core serialization).
4. Witness WSOD / PHP Fatal Error.

### Proposed resolution
Update `ReferenceNormalizerBase::normalize()` to strictly hint a return type of `: array` instead of the broader Symfony 6 mixed types union to match Drupal Core's modern serialization API updates.

Issue fork bibcite-3609991

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mgwisni created an issue. See original summary.

mgwisni’s picture

Title: rupal 11.4 compatibility: Fatal error in ReferenceNormalizerBase due to ComplexDataNormalizer return type strictness » Drupal 11.4 compatibility: Fatal error in ReferenceNormalizerBase due to ComplexDataNormalizer return type strictness

mark_fullmer made their first commit to this issue’s fork.

mark_fullmer’s picture

Thanks for the issue report. However, I don't follow how you came to the conclusion that Bibcite's ReferenceNormalizerBase extends Drupal\serialization\Normalizer\ComplexDataNormalizer , nor under what circumstances you would "attempt to export a reference via REST/JSON"

Can you elaborate on the methodology you used to do this writeup? Thanks!

mark_fullmer’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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