Skip to content

Validation rule parser removes unvalidated data from Form Requests #38505

@sander3

Description

@sander3
  • Laravel Version: v8.55.0
  • PHP Version: v8.0.8
  • Database Driver & Version: N/A

Description:

The new (https://github.com/laravel/framework/blob/578a76c2d53e416ce7037bc01c96be7877ed8442/src/Illuminate/Validation/ValidationRuleParser.php) validation rule parser removes any unvalidated data from Form Requests. Previously one could not define validation rules for a certain parameter in order to allow it pass through to the validated result array. While this might be intended behaviour, it is a change that breaks some applications.

Steps To Reproduce:

  1. Create a new Form Request
  2. Define some validation rules
  3. Add a parameter without validation rules
  4. Call $request->validated()
  5. See that the unvalidated data is missing
public function rules()
{
    return [
        'title' => 'required|unique:posts|max:255',
        'body' => '',
    ];
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions