Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit d94567a

Browse files
committed
Simplify query string removal
Per a comment from @Moln
1 parent 0607502 commit d94567a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/ServerRequestFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,6 @@ public static function marshalRequestUri(array $server)
238238
*/
239239
public static function stripQueryString($path)
240240
{
241-
if (($qpos = strpos($path, '?')) !== false) {
242-
return substr($path, 0, $qpos);
243-
}
244-
return $path;
241+
return explode('?', $path, 2)[0];
245242
}
246243
}

src/functions/marshal_uri_from_sapi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function marshalUriFromSapi(array $server, array $headers)
4949
$path = marshalRequestPath($server);
5050

5151
// Strip query string
52-
$path = false !== ($qpos = strpos($path, '?')) ? substr($path, 0, $qpos) : $path;
52+
$path = explode('?', $path, 2)[0];
5353

5454
// URI query
5555
$query = '';

0 commit comments

Comments
 (0)