Skip to content

[5.x] Remove the request-body Json::getRaw() in favour of getRawBody() - #69

Open
Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-json-getraw-body-removed
Open

Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-json-getraw-body-removed

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Json declares its own getRaw() that returns the raw request body, so the getRaw($name, $default) shorthand that every other input has (via __call()) does not work on $input->json: getRaw('field') ignores its arguments. #60 (4.x) adds getRawBody(), makes getRaw('field') return the unfiltered value and deprecates calling getRaw() without a name. This is the 5.0 step: the request-body getRaw() is removed, so getRaw() on Json is the regular shorthand, and the body is read with getRawBody().

Depends on #60 for the 4.x deprecation, and on #65 (update guide); this branch contains #65's commit until it is merged.

When 4.x-dev is merged up: #60 rewrites getRaw() and adds getRawBody() in the same place. Keep this PR's version (no getRaw() override, getRawBody() only); drop #60's testGetRawWithoutNameIsDeprecated(). With #66 merged, give getRawBody() the native return type it already has here. #61 rewrites the JsonTest body tests to a stream wrapper; testGetRawBody() here then needs the same treatment (it still uses HTTP_RAW_POST_DATA, which #61 removes).

Testing Instructions

JsonTest::testgetRaw() is renamed testGetRawBody() and reads the body through getRawBody(); the new testGetRaw() checks that getRaw('field') returns the unfiltered value. Both fail before the change and pass after it.

Documentation Changes Required

docs/overview.md ("JSON bodies"): getRaw('title') and getRawBody(). docs/v4-to-v5-update.md: new section with the migration.

Depends on #60
Depends on #65

🤖 Generated with Claude Code

Hackwar and others added 2 commits November 13, 2026 06:41
Several 5.x changes add entries to docs/v4-to-v5-update.md; creating the
file once keeps them from conflicting over its creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Json declared its own getRaw() returning the raw request body, which
shadowed the getRaw($name, $default) shorthand of every other input. It is
replaced by getRawBody(), so getRaw('field') returns the unfiltered value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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