Skip to content

feat(metadata): immutable parameters - #8855

Merged
soyuka merged 9 commits into
api-platform:mainfrom
soyuka:feat/immutable-parameters-5.1
Dec 1, 2026
Merged

soyuka merged 9 commits into
api-platform:mainfrom
soyuka:feat/immutable-parameters-5.1

Conversation

@soyuka

@soyuka soyuka commented Nov 16, 2026

Copy link
Copy Markdown
Member

Follow-up of GHSA-xmq6-3c6q-fr8m: request values were written into cached operation metadata through Parameter::setValue(). 4.4.9/5.0.8 fixed it with request-local copies, this removes the mutators so it cannot come back.

  • Parameters::with(), without() and sorted() return a new instance
  • parameter providers may return the resolved Parameter (return $parameter->withValue($value)) or an operation holding it, ParameterProviderInterface::provide() now returns Operation|Parameter|null (existing ?Operation implementations stay valid)
  • ParameterProvider no longer overwrites the operation a provider returned
  • built-in providers, response header providers and metadata factories stop mutating parameters
  • deprecate Parameter::setValue() and Parameters::add()/remove()/sort(), to be removed in 6.0

Old providers calling setValue() keep working with a deprecation. No measurable request-time cost (24-parameter operation: +0.2 ms at a ~7.4 ms median, below run-to-run noise).

Docs: the Base64 link provider example in state-providers.md and the custom parameter provider prose in filters.md need to return withValue(), separate PR.

@soyuka soyuka added this to the 5.1 milestone Nov 24, 2026
@soyuka
soyuka force-pushed the feat/immutable-parameters-5.1 branch from 13dfcf7 to 5a0506e Compare December 1, 2026 13:58
@soyuka
soyuka merged commit 5dd8bcd into api-platform:main Dec 1, 2026
76 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant