In a API endpoint taking "emails" as an array, I am validating values with a Request Class. In this Request class' prepareForValidation method:
$this->merge([
'emails' => array_unique($this->emails)
]);
I have this lines. And a controller like this:
foreach ($request->get('emails') as $email) {
//process
}
In local environment, I have no error or bug. It works expected. I am giving "aaa@bbb.com" twice, and it works only once. But in server (with octane, no other changes), when I give "aaa@bbb.com" twice again, it works twice.
I have finally solved the problem with using
$request->input()
instead of "$request->get()". But I am curious, why $request works fine in local but causing problems in server? Is it related to Octane? Has anyone encountered such a problem before?