function Request::getUrlencodedPrefix
Returns the prefix as encoded in the string when the string starts with the given prefix, null otherwise.
1 call to Request::getUrlencodedPrefix()
- Request::prepareBaseUrl in vendor/
symfony/ http-foundation/ Request.php - Prepares the base URL.
File
-
vendor/
symfony/ http-foundation/ Request.php, line 1944
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
private function getUrlencodedPrefix(string $string, string $prefix) : ?string {
if ($this->isIisRewrite()) {
// ISS with UrlRewriteModule might report SCRIPT_NAME/PHP_SELF with wrong case
// see https://github.com/php/php-src/issues/11981
if (0 !== stripos(rawurldecode($string), $prefix)) {
return null;
}
}
elseif (!str_starts_with(rawurldecode($string), $prefix)) {
return null;
}
$len = \strlen($prefix);
if (preg_match(\sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) {
return $match[0];
}
return null;
}