fix(api): silence api-platform legacy parameter-validator deprecation#494
Merged
turegjorup merged 1 commit intoJun 10, 2026
Merged
Conversation
API Platform 3.4 registers its legacy query-parameter validation system by default, and the validator classes it instantiates (Bounds et al.) trigger_deprecation() on load — logging a deprecation on every request, including plain 404s. Disable it via legacy_query_parameter_validation: false. No behavior change: all our filters declare required => false and none of the constraints (enum/bounds/length) the legacy validator enforces, and the modern replacement (Metadata\Parameter::$constraints) is not used. Also drop the now-dead ValidationExceptionInterface exception_to_status entry. The component is removed entirely in API Platform 4. Verified locally: after cache:clear, API and 404 requests no longer log the deprecation, and the exported OpenAPI spec is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
API Platform 3.4 registers its legacy query-parameter validation system by default (
legacy_query_parameter_validationdefaults totrue), and the validator classes it instantiates (ApiPlatform\ParameterValidator\Validator\Boundset al.) calltrigger_deprecation()when loaded — so every request, including plain 404s from scanner probes, logs a deprecation to thephpchannel in production.This PR disables the legacy system with one config line. No behavior change: the legacy validator only enforces constraints filters declare in
getDescription()(required, enum, bounds, length), and all four project filters (SharedWithMe,PublishedFilter,MultipleSearchFilter,CampaignFilter) declarerequired => falseand none of those constraint keys — it currently enforces nothing. The modern replacement (Metadata\Parameter::$constraints) is not used in this codebase either. The component is removed entirely in API Platform 4, so this is also a small step toward that upgrade.Files Changed
config/packages/api_platform.yaml- setvalidator.legacy_query_parameter_validation: false; drop the now-deadApiPlatform\ParameterValidator\Exception\ValidationExceptionInterface: 400entry fromexception_to_status(nothing can throw it anymore)CHANGELOG.md- entry under[Unreleased]Test Plan
Verified locally:
cache:clear, then requests to/v2/layouts(API route) and/js/twint_ch.js(the 404 probe path from the original report) — neither logs theBoundsdeprecation anymore; the last occurrence invar/log/dev.logpredates the change.task generate:api-spec— the exported OpenAPI spec is byte-identical (the legacy validator plays no part in spec generation), so the apispec CI gate sees no drift.🤖 Generated with Claude Code