Skip to content

Commit 95c33c1

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

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/uri/7.0/psr-compliance.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ 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+
$uri = Http::new('https://example.com///miscillaneous.tld');
128+
echo (string) $uri;
129+
// returns 'https://example.com///miscillaneous.tld'
130+
131+
echo $uri->getPath();
132+
// returns '/miscillaneous.tld' the extra leading slashes are removed
133+
~~~
134+
122135
## PSR-17 compatibility
123136

124137
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)