Description
After upgrading Laravel from v12.54.1 to v12.55.1, Orchid form validation errors started crashing during field rendering instead of being displayed normally.
This happens in Orchid Screen forms when validation fails and the field view is rendered.
Environment
- PHP 8.2+
- Laravel
v12.55.1
- Orchid Platform: current installed version
- Previously worked on Laravel
v12.54.1
Error
ArgumentCountError
array_push() does not accept unknown named parameters
Root cause
The issue appears to be in src/Screen/Field.php
Field::render() currently does:
->withErrors($this->getErrorsMessage());
and getErrorsMessage() returns the current session errors.
When session errors are already a ViewErrorBag, Laravel's View::withErrors() does not preserve that object as-is. It reformats it, which results in a malformed MessageBagstructure. Later, rendering crashes inside Laravel's MessageBag::all()
While debugging, the malformed payload looked like this:
[
"key" => "\0*\0bags",
"raw_messages" => [
"default" => MessageBag(...)
],
]
So the original validation error itself is valid. The crash happens while Orchid re-passes the existing error bag into the field view.
Relevant files
Orchid:
Laravel:
Illuminate\View\View::withErrors()
Illuminate\Support\ViewErrorBag
Illuminate\Support\MessageBag::all()
Expected behavior
Validation errors should be displayed normally in Orchid fields.
Actual behavior
The request fails during view rendering with:
ArgumentCountError: array_push() does not accept unknown named parameters
Local workaround
Replacing:
->withErrors($this->getErrorsMessage())
with:
->with('errors', $this->getErrorsMessage())
and returning a ViewErrorBag from getErrorsMessage() fixes the issue locally.
Reproduction
- Create any Orchid Screen with normal Laravel validation.
- Submit invalid data.
- On Laravel
v12.55.1, Orchid crashes while rendering the field error.
Description
After upgrading Laravel from
v12.54.1tov12.55.1, Orchid form validation errors started crashing during field rendering instead of being displayed normally.This happens in Orchid
Screenforms when validation fails and the field view is rendered.Environment
v12.55.1v12.54.1Error
Root cause
The issue appears to be in
src/Screen/Field.phpField::render()currently does:and
getErrorsMessage()returns the current session errors.When session errors are already a
ViewErrorBag, Laravel'sView::withErrors()does not preserve that object as-is. It reformats it, which results in a malformedMessageBagstructure. Later, rendering crashes inside Laravel'sMessageBag::all()While debugging, the malformed payload looked like this:
[ "key" => "\0*\0bags", "raw_messages" => [ "default" => MessageBag(...) ], ]So the original validation error itself is valid. The crash happens while Orchid re-passes the existing error bag into the field view.
Relevant files
Orchid:
src/Screen/Field.phpLaravel:
Illuminate\View\View::withErrors()Illuminate\Support\ViewErrorBagIlluminate\Support\MessageBag::all()Expected behavior
Validation errors should be displayed normally in Orchid fields.
Actual behavior
The request fails during view rendering with:
Local workaround
Replacing:
with:
and returning a
ViewErrorBagfromgetErrorsMessage()fixes the issue locally.Reproduction
v12.55.1, Orchid crashes while rendering the field error.