All contributions

api-platform/core

API Platform

The server part of API Platform, a Symfony-based PHP framework for building hypermedia REST and GraphQL APIs.

Language
PHP
GitHub stars
2,582
Merged changes
2
Project site
api-platform.com

What we changed

The HAL normaliser counts circular references by spl_object_id() instead of spl_object_hash(), which PHP 8.6 deprecates, and DeserializeProvider collects deserialisation errors without a method Symfony Serializer 8.1 deprecates.

What this work shows

  • HAL and Symfony Serializer normalisers
  • Moving off APIs deprecated in PHP 8.6 and Symfony 8.1
  • PHPUnit tests that catch deprecations
What was broken

A PHP 8.6 deprecation on every HAL item

The HAL ItemNormalizer calls isHalCircularReference() for every item it normalises. That function used spl_object_hash(), which PHP 8.6 deprecates.

How we fixed it

spl_object_id() as the counter key

The hash was only a key for the circular reference counters, so we replaced it with spl_object_id() without changing behaviour. We left ValidationException::getId() alone, because its value ends up in the error IRI.

#8657

What was broken

A deprecated method when collecting errors

When collecting deserialisation errors, DeserializeProvider called PartialDenormalizationException::getErrors(), which Symfony Serializer 8.1 deprecates. The functional tests had to expect that deprecation.

How we fixed it

The new method with a 7.4 fallback

DeserializeProvider uses getNotNormalizableValueErrors() when it exists and falls back to getErrors() on Symfony Serializer 7.4, the same guard as on the 5.0 branch. A new test checks that the error reaches the violation list with no deprecation, and the functional tests no longer expect one.

#8663

Merged changes 2

  1. #8663 fix(state): avoid deprecated PartialDenormalizationException::getErrors() Merged 13 October 2026
  2. #8657 fix(hal): use spl_object_id() for circular reference counters Merged 9 October 2026

What it taught us

We start replacing a deprecated call by checking what the value is for: an array key can be swapped right away, while an identifier in an error address needs a decision of its own. When a project supports several versions of a dependency, we check whether the new method exists instead of raising the requirement.

More about this technology: PHP

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.