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

Accessing merged params in request on form-url-encoded content type #47896

Closed
ElnazNrz opened this issue Jul 30, 2023 · 1 comment
Closed

Accessing merged params in request on form-url-encoded content type #47896

ElnazNrz opened this issue Jul 30, 2023 · 1 comment

Comments

@ElnazNrz
Copy link

Laravel Version

9.52.9

PHP Version

8.2

Database Driver & Version

No response

Description

When merge an extra param in request and send request body in form-url-encoded type, merged param is not accessible on request but it is accessible on request helper

Steps To Reproduce

<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;

class HasAvailableProviderRule implements Rule
{
    /**
     * Create a new rule instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Determine if the validation rule passes.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        ...
        request()->merge(['bank_provider_id' => $bankProvider->id]);
        ...
    }
}
//in my controller
$request->input('bank_provider_id'); //this line return null
request()->bank_provider_id; //this line return the merged value
@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