Skip to content
Snippets Groups Projects
Verified Commit 6c9babd4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3439647 by catch: Skip query string compression if zlib extension isn't available

(cherry picked from commit 26e9f32d)
parent 580a6841
No related branches found
No related tags found
5 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type"
Pipeline #143663 passed with warnings
+7
......@@ -80,6 +80,9 @@ public static function buildQuery(array $query, $parent = '') {
* The data compressed into a URL-safe string.
*/
public static function compressQueryParameter(string $data): string {
if (!\extension_loaded('zlib')) {
return $data;
}
// Use 'base64url' encoding. Note that the '=' sign is only used for padding
// on the right of the string, and is otherwise not part of the data.
// @see https://datatracker.ietf.org/doc/html/rfc4648#section-5
......@@ -100,6 +103,9 @@ public static function compressQueryParameter(string $data): string {
* The uncompressed data or FALSE on failure.
*/
public static function uncompressQueryParameter(string $compressed): string|bool {
if (!\extension_loaded('zlib')) {
return $compressed;
}
// 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)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment