Skip to content

Commit 26c62fe

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

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/uri/7.0/psr-compliance.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ 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+
134+
<p class="message-notice">This behavior modification is related to <a href="https://framework.zend.com/security/advisory/ZF2015-05">Potential XSS and Open Redirect vectors</a></p>
135+
122136
## PSR-17 compatibility
123137

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