Skip to content

Commit bad4466

Browse files
committed
Update PSR compliance documentation
1 parent 0d9a875 commit bad4466

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/uri/7.0/psr-compliance.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ echo (string) Uri::new('http://example.com/path/to?#');
119119

120120
<p class="message-info">This improved compliance is available since version <code>7.5.0</code></p>
121121

122+
Because `PSR-7` UriInterface implementing object `getPath` may be used in
123+
header. A security issue may rise if the path is not stripped of multiple starting `/`.
124+
As such, `getPath` yield a different result depending on its raw value:
125+
126+
~~~php
127+
echo Http::new('https://example.com//miscillaneous.tld')->getPath();
128+
// returns '/miscillaneous.tld' the extra leading slashes are removed
129+
130+
echo Uri::new('https://example.com//miscillaneous.tld')->getPath();
131+
// returns '//miscillaneous.tld' the leading slashes are preserved
132+
~~~
133+
122134
## PSR-17 compatibility
123135

124136
The package also provides an implementation of the `UriFactoryInterface` from [PSR-17](https://www.php-fig.org/psr/psr-17/)

0 commit comments

Comments
 (0)