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

Breadcrumb

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

function UrlHelper::uncompressQueryParameter

Takes a compressed parameter and converts it back to the original.

Parameters

string $compressed: A string as compressed by \Drupal\Component\Utility\UrlHelper::compressQueryParameter().

Return value

string The uncompressed data, or the original string if it cannot be uncompressed.

See also

\Drupal\Component\Utility\UrlHelper::compressQueryParameter()

2 calls to UrlHelper::uncompressQueryParameter()
AjaxPageState::parseAjaxPageState in core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php
Parse the ajax_page_state variable in the request.
AssetControllerBase::deliver in core/modules/system/src/Controller/AssetControllerBase.php
Generates an aggregate, given a filename.

File

core/lib/Drupal/Component/Utility/UrlHelper.php, line 103

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

public static function uncompressQueryParameter(string $compressed) : string {
    // Because this comes from user data, suppress the PHP warning that
    // gzcompress() throws if the base64-encoded string is invalid.
    $return = @gzuncompress(base64_decode(str_replace([
        '-',
        '_',
    ], [
        '+',
        '/',
    ], $compressed)));
    // If we failed to uncompress the query parameter, it may be a stale link
    // from before compression was implemented with the URL parameter
    // uncompressed already, or it may be an incorrectly formatted URL.
    // In either case, pass back the original string to the caller.
    return $return === FALSE ? $compressed : $return;
}

API Navigation

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