Repository navigation
Conversation
Input documents getRaw($name, $default) as the accessor for an unfiltered
value, but Json declares a real getRaw() that returns the request body, so
$input->json->getRaw('field') ignored its arguments and returned the whole
body (or null when the data was passed in). An unfiltered JSON field could
not be read through the documented API.
getRaw() now returns the unfiltered value when a name is given. Called
without a name it still returns the body, but that is deprecated in favour
of the new getRawBody().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
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 of Changes
InputdocumentsgetRaw($name, $default)as the accessor for an unfiltered value (via__call()), butJsondeclares a realgetRaw()that returns the raw request body. So$input->json->getRaw('field')ignores its arguments and returns the whole body, ornullwhen the data was passed to the constructor:(new Json(['field' => 'value']))->getRaw('field') === null. An unfiltered JSON field can only be read withget('field', null, 'raw').This change:
Json::getRawBody(), which returns the raw body (nullif the data was passed to the constructor);getRaw(?string $name = null, mixed $default = null)return the unfiltered value when a name is given, like on every other input;getRaw()without a name returning the body for BC, with a deprecation pointing togetRawBody(). In 5.0 that variant goes away.Subclasses of
Jsonthat overridegetRaw()without parameters become incompatible with the new signature. I do not know of any.Testing Instructions
New tests in
JsonTest:testGetRawWithName()andtestGetRawWithoutNameIsDeprecated()fail before the change;testGetRawBodyWithSource()covers the new method. The existingtestgetRaw()(body via the deprecated call) still passes.Documentation Changes Required
docs/overview.md("JSON bodies"):getRaw('name'),getRawBody()and the deprecation of the no-argument call.🤖 Generated with Claude Code