Nyholm / psr7-server

Helper classes to use any PSR7 implementation as your main request and response
MIT License
91 stars 21 forks source link

Fix exception when trying to instantiate a slim/psr7 request #51

Open 1ma opened 2 years ago

1ma commented 2 years ago

The value of $_SERVER['SERVER_PORT'] can be a string (at least it is when pairing nginx with php-fpm), and some PSR-7 implementations (such as slim/psr7) validate that the port is indeed an integer, resulting in an exception when calling ServerRequestCreator->fromGlobals() using their set of PSR-17 factories.

This patch should fix this edge case. Also note that the @param annotation of the withPort() method is null|int.