amphp / http

HTTP primitives which can be shared by servers and clients.
https://amphp.org/http
MIT License
88 stars 10 forks source link

Fix: allow int and float in setHeader/addHeader #23

Closed xtrime-ru closed 1 year ago

xtrime-ru commented 1 year ago

Additional fixes for https://github.com/amphp/http/issues/22

If this is ok i will make PR to other packages: http-server, http-client and websocket-client.

PNixx commented 1 year ago

@xtrime-ru I already sent a pull request, it was accepted, but after some time, for some unknown reason, they decided to roll back.

xtrime-ru commented 1 year ago

@trowski rewrote logic and moved casting to setHeaders method. setHeaders supports int and floats in latest 3.x-dev: https://github.com/amphp/http/commit/0dc80698c983980424b6d994110a16e89f95d150

But setHeader still has restrictions.

UPDATE: Issue happens only with declare(strict_types=1); Without strict types php will convert argument.

xtrime-ru commented 1 year ago

Fixed by typecast: https://github.com/danog/MadelineProto/commit/8a2eb8d7a12188824a502521511a92adc7e53d37#diff-fdc8e1737cd2f6c3c87a4757be03a2b4c6997c85409f55eb3c743f9477fc5132R207