slimphp / Slim-Psr7

PSR-7 implementation for use with Slim 4
MIT License
133 stars 45 forks source link

Fix test Uri with multiple slashes #203

Closed t0mmy742 closed 3 years ago

t0mmy742 commented 3 years ago

String construction of $path was not respecting PSR-7.

The path can be concatenated without delimiters. But there are two cases where the path has to be adjusted to make the URI reference valid as PHP does not allow to throw an exception in __toString():

  • If the path is rootless and an authority is present, the path MUST be prefixed by "/".
  • If the path is starting with more than one "/" and no authority is present, the starting slashes MUST be reduced to one.

Fix #202

(This PR also fix one PHPCS warning from Cookies class)

l0gicgate commented 3 years ago

Thank you for this @t0mmy742 I really appreciate your contributions.