You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the example from: https://www.swoole.co.uk/article/swoole-and-psr
I use last verison of Slim4 (v4.8), PHP 8.0.6, swoole (v4.6.7), psr-swoole-native (v0.0.4)
If I make a POST or GET request with data everything works as it should, but when I make a request whether POST or GET without data (body) it returns an error:
Fatal error: Uncaught InvalidArgumentException: Unsupported argument type in /var/www/vendor/imefisto/psr-swoole-native/src/ServerRequest.php:99
Stack trace:
#0 /var/www/vendor/slim/slim/Slim/Middleware/BodyParsingMiddleware.php(65): Imefisto\PsrSwoole\ServerRequest->withParsedBody(NULL) #1 /var/www/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\BodyParsingMiddleware->process(Object(Imefisto\PsrSwoole\ServerRequest), Object(Slim\Routing\RouteRunner)) #2 /var/www/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(59): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Imefisto\PsrSwoole\ServerRequest)) #3 /var/www/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\RoutingMiddleware->process(Object(Imefisto\PsrSwoole\ServerRequest), Object(Psr\Http\Server\RequestHandlerInterface@anonymous)) #4 /var/www/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Imefisto\PsrSwoole\ServerRequest)) #5 /var/www/vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle(Object(Imefisto\PsrSwoole\ServerRequest)) #6 /var/www/cli/server.php(89): Slim\App->handle(Object(Imefisto\PsrSwoole\ServerRequest)) #7 {main}
thrown in /var/www/vendor/imefisto/psr-swoole-native/src/ServerRequest.php on line 99
The text was updated successfully, but these errors were encountered:
Good catch. The standard says the $data argument for the withParsedBody function can receive null:
Deserialization/parsing returns structured data, and, as such, this method ONLY accepts arrays or objects, or a null value if nothing was available to parse
I use the example from: https://www.swoole.co.uk/article/swoole-and-psr
I use last verison of Slim4 (v4.8), PHP 8.0.6, swoole (v4.6.7), psr-swoole-native (v0.0.4)
If I make a POST or GET request with data everything works as it should, but when I make a request whether POST or GET without data (body) it returns an error:
Fatal error: Uncaught InvalidArgumentException: Unsupported argument type in /var/www/vendor/imefisto/psr-swoole-native/src/ServerRequest.php:99
Stack trace:
#0 /var/www/vendor/slim/slim/Slim/Middleware/BodyParsingMiddleware.php(65): Imefisto\PsrSwoole\ServerRequest->withParsedBody(NULL)
#1 /var/www/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\BodyParsingMiddleware->process(Object(Imefisto\PsrSwoole\ServerRequest), Object(Slim\Routing\RouteRunner))
#2 /var/www/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(59): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Imefisto\PsrSwoole\ServerRequest))
#3 /var/www/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\RoutingMiddleware->process(Object(Imefisto\PsrSwoole\ServerRequest), Object(Psr\Http\Server\RequestHandlerInterface@anonymous))
#4 /var/www/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Imefisto\PsrSwoole\ServerRequest))
#5 /var/www/vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle(Object(Imefisto\PsrSwoole\ServerRequest))
#6 /var/www/cli/server.php(89): Slim\App->handle(Object(Imefisto\PsrSwoole\ServerRequest))
#7 {main}
thrown in /var/www/vendor/imefisto/psr-swoole-native/src/ServerRequest.php on line 99
The text was updated successfully, but these errors were encountered: