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

PSR-7 $request->getServerParams should be upper case (?) #355

Open
jsanahuja opened this issue Feb 12, 2024 · 0 comments
Open

PSR-7 $request->getServerParams should be upper case (?) #355

jsanahuja opened this issue Feb 12, 2024 · 0 comments

Comments

@jsanahuja
Copy link

  1. What did you do? If possible, provide a simple script for reproducing the error.
    I was trying to migrate from imefisto/psr-swoole-native to OpenSwoole PSR-7 and started using
$server->setHandler($app)
  1. What did you expect to see?
    I expected everything to work but seems like all the middlewares I use (third party) expect getServerParams keys to be uppercase. Openswoole sets them lowercase. I haven't found any specification to be uppercase but the interface stats:
    /**
     * Retrieve server parameters.
     *
     * Retrieves data related to the incoming request environment,
     * typically derived from PHP's $_SERVER superglobal. The data IS NOT
     * REQUIRED to originate from $_SERVER.
     *
     * @return array
     */
    public function getServerParams();

And since $_SERVER keys are uppercase, I would say this is an error in Openswoole.

  1. What did you see instead?
(
    [request_method] => POST
    [request_uri] => /my/super/special/api
    [path_info] => /my/super/special/api
    [request_time] => 1707756857
    [request_time_float] => 1707756857.8345
    [server_protocol] => HTTP/1.0
    [server_port] => 10001
    [remote_port] => 50396
    [remote_addr] => 172.22.0.3
    [master_time] => 1707756857
)
  1. What version of OpenSwoole are you using (show your php --ri openswoole)?
# php --ri openswoole

openswoole

Open Swoole => enabled
Author => Open Swoole Group <[email protected]>
Version => 22.1.2
Built => Dec 10 2023 21:17:21
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1w  11 Sep 2023
dtls => enabled
http2 => enabled
hook-curl => enabled
pcre => enabled
zlib => 1.2.12
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
postgresql => enabled

Directive => Local Value => Master Value
openswoole.enable_coroutine => On => On
openswoole.enable_preemptive_scheduler => Off => Off
openswoole.display_errors => On => On
openswoole.unixsock_buffer_size => 8388608 => 8388608
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
    Docker image openswoole/swoole:22.1-php8.2-alpine with some adds
# uname -a && php -v && gcc -v
Linux 8156544c9d25 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 Linux
PHP 8.2.0 (cli) (built: Dec  8 2022 20:14:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
sh: gcc: not found
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

1 participant