Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit323ea3b

Browse files
authored
Merge pull request#203 from t0mmy742/bugfix/202
Fix test Uri with multiple slashes
2 parents4325f19 +9131791 commit323ea3b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

‎src/Cookies.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ protected function toHeader(string $name, array $properties): string
170170
$result .='; HttpOnly';
171171
}
172172

173-
if (isset($properties['samesite']) &&in_array(strtolower($properties['samesite']), ['lax','strict','none'],true)) {
173+
if (
174+
isset($properties['samesite'])
175+
&&in_array(strtolower($properties['samesite']), ['lax','strict','none'],true)
176+
) {
174177
// While strtolower is needed for correct comparison, the RFC doesn't care about case
175178
$result .='; SameSite=' .$properties['samesite'];
176179
}

‎src/Uri.php‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,20 @@ public function __toString(): string
484484
$query =$this->getQuery();
485485
$fragment =$this->getFragment();
486486

487-
$path ='/' .ltrim($path,'/');
487+
if ($path !=='') {
488+
if ($path[0] !=='/') {
489+
if ($authority !=='') {
490+
// If the path is rootless and an authority is present, the path MUST be prefixed by "/".
491+
$path ='/' .$path;
492+
}
493+
}elseif (isset($path[1]) &&$path[1] ==='/') {
494+
if ($authority ==='') {
495+
// If the path is starting with more than one "/" and no authority is present,
496+
// the starting slashes MUST be reduced to one.
497+
$path ='/' .ltrim($path,'/');
498+
}
499+
}
500+
}
488501

489502
return ($scheme !=='' ?$scheme .':' :'')
490503
. ($authority !=='' ?'//' .$authority :'')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp