Pico::evaluateRequestUrl(): Replace strpos()+substr() with strstr()
This commit is contained in:
parent
3ebb51a55e
commit
bea610dbf4
@ -699,9 +699,7 @@ class Pico
|
|||||||
// use QUERY_STRING; e.g. /pico/?sub/page
|
// use QUERY_STRING; e.g. /pico/?sub/page
|
||||||
$pathComponent = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
|
$pathComponent = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
|
||||||
if (!empty($pathComponent)) {
|
if (!empty($pathComponent)) {
|
||||||
if (($pathComponentLength = strpos($pathComponent, '&')) !== false) {
|
$pathComponent = strstr($pathComponent, '&', true) ?: $pathComponent;
|
||||||
$pathComponent = substr($pathComponent, 0, $pathComponentLength);
|
|
||||||
}
|
|
||||||
if (strpos($pathComponent, '=') === false) {
|
if (strpos($pathComponent, '=') === false) {
|
||||||
$this->requestUrl = trim(rawurldecode($pathComponent), '/');
|
$this->requestUrl = trim(rawurldecode($pathComponent), '/');
|
||||||
}
|
}
|
||||||
@ -715,9 +713,7 @@ class Pico
|
|||||||
$requestUri = $_SERVER['REQUEST_URI'];
|
$requestUri = $_SERVER['REQUEST_URI'];
|
||||||
if (substr($requestUri, 0, $basePathLength) === $basePath) {
|
if (substr($requestUri, 0, $basePathLength) === $basePath) {
|
||||||
$requestUri = substr($requestUri, $basePathLength);
|
$requestUri = substr($requestUri, $basePathLength);
|
||||||
if (($requestUriLength = strpos($requestUri, '?')) !== false) {
|
$requestUri = strstr($requestUri, '?', true) ?: $requestUri;
|
||||||
$requestUri = substr($requestUri, 0, $requestUriLength);
|
|
||||||
}
|
|
||||||
$this->requestUrl = rtrim(rawurldecode($requestUri), '/');
|
$this->requestUrl = rtrim(rawurldecode($requestUri), '/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user