Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging Enum to Request throws Expected a scalar, or an array as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::set() #48110

Closed
digvijayad opened this issue Aug 18, 2023 · 1 comment

Comments

@digvijayad
Copy link

Laravel Version

10.19

PHP Version

8.2.9

Database Driver & Version

No response

Description

After upgrade to 10.19 from 10.16 the app throws exception when merging Enum to FormRequest object.

 public function initiateTransaction(CreateTransactionRequest $request): JsonResponse
    {
        $request->merge([
            'status' => TransactionStatus::Initiated,
        ]);
    }
InvalidArgumentException: Expected a scalar, or an array as a 2nd argument to "Symfony\Component\HttpFoundation\InputBag::set()", "App\Enums\TransactionStatus" given. in E:\source\src\laravel10\vendor\symfony\http-foundation\InputBag.php:70

Steps To Reproduce

  1. Create a new FormRequest object.
  2. In the Controller, merge an enum with form request object.
$request->merge([
            'status' => TransactionStatus::Initiated,
        ]);
@crynobone
Copy link
Member

Unfortunately there was a breaking change in Symfony which made us implement #47838. So this will probably stay, sorry.

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

No branches or pull requests

2 participants