Skip to content

feat(metadata): immutable parameters - #8855

Open
soyuka wants to merge 10 commits into
api-platform:mainfrom
soyuka:feat/immutable-parameters-5.1
Open

soyuka wants to merge 10 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.

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