Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Request.php

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\HttpFoundation

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal