laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.73k stars 288 forks source link

Fatal error with Swoole on a PUT request with application/x-www-form-urlencoded content type #859

Closed L3o-pold closed 4 months ago

L3o-pold commented 4 months ago

Octane Version

2.3.5

Laravel Version

11.0.7

PHP Version

8.3.4

What server type are you using?

Swoole

Server Version

5.1.1 and 5.1.2

Database Driver & Version

No response

Description

Since Laravel 11 executing a PUT request with a Content-Type: application/x-www-form-urlencoded header result in a 500 error.

It occurs with PUT or DELETE method (not POST).

Steps To Reproduce

Using Laravel 11 and Octane (Swoole server)

Route::put('/api/test', function () {
    return response('OK');
});
curl --location --fail --request PUT 'http://0.0.0.0/api/test' --header 'Content-Type: application/x-www-form-urlencoded'
curl: (22) The requested URL returned error: 500

Error logs (using sail)

laravel.test-1  | PHP Fatal error:  Uncaught TypeError: Cannot assign Symfony\Component\HttpFoundation\ParameterBag to property Symfony\Component\HttpFoundation\Request::$request of type Symfony\Component\HttpFoundation\InputBag in /var/www/html/vendor/laravel/octane/src/Swoole/Actions/ConvertSwooleRequestToIlluminateRequest.php:38
laravel.test-1  | Stack trace:
laravel.test-1  | #0 /var/www/html/vendor/laravel/octane/src/Swoole/SwooleClient.php(40): Laravel\Octane\Swoole\Actions\ConvertSwooleRequestToIlluminateRequest->__invoke()
laravel.test-1  | #1 /var/www/html/vendor/laravel/octane/bin/swoole-server(120): Laravel\Octane\Swoole\SwooleClient->marshalRequest()
laravel.test-1  | #2 [internal function]: {closure}()
laravel.test-1  | #3 /var/www/html/vendor/laravel/octane/bin/swoole-server(170): Swoole\Server->start()
laravel.test-1  | #4 {main}
laravel.test-1  |   thrown in /var/www/html/vendor/laravel/octane/src/Swoole/Actions/ConvertSwooleRequestToIlluminateRequest.php on line 38
driesvints commented 4 months ago

Thanks @L3o-pold. Seems @sy-records has already sent in a PR.