Skip to content

After upgrading Laravel from v12.54.1 to v12.55.1, Orchid form validation errors started crashing #3082

@taiwanleaftea

Description

@taiwanleaftea

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:

  • src/Screen/Field.php

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

  1. Create any Orchid Screen with normal Laravel validation.
  2. Submit invalid data.
  3. On Laravel v12.55.1, Orchid crashes while rendering the field error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions