Issue #3439591 by quietone, mstrelan, pradhumanjain2311, andypost, catch, mfb, longwave, coaston, penyaskito: Add composer dependency on ext-zlib

merge-requests/7603/merge
Dave Long 2024-05-17 10:28:17 +01:00
parent 539c50a257
commit 0a4f122fcb
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
5 changed files with 11 additions and 27 deletions

3
composer.lock generated
View File

@ -495,7 +495,7 @@
"dist": {
"type": "path",
"url": "core",
"reference": "a04ae36ab48fdc8d48a813f739cdfeeddb7517eb"
"reference": "ff1a97312bafb66b9f39cc05fa161d99956a15be"
},
"require": {
"asm89/stack-cors": "^2.1",
@ -517,6 +517,7 @@
"ext-spl": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"ext-zlib": "*",
"guzzlehttp/guzzle": "^7.5",
"guzzlehttp/psr7": "^2.4.5",
"masterminds/html5": "^2.7",

View File

@ -17,6 +17,7 @@
"ext-SPL": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"ext-zlib": "*",
"php": ">=8.3.0",
"symfony/console": "^7.1@beta",
"symfony/dependency-injection": "^7.1@beta",

View File

@ -80,9 +80,6 @@ class UrlHelper {
* 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
@ -104,9 +101,6 @@ class UrlHelper {
* uncompressed.
*/
public static function uncompressQueryParameter(string $compressed): string {
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)));

View File

@ -60,15 +60,14 @@ class AssetDumper implements AssetDumperUriInterface {
catch (FileException $e) {
return FALSE;
}
// If CSS/JS gzip compression is enabled and the zlib extension is available
// then create a gzipped version of this file. This file is served
// conditionally to browsers that accept gzip using .htaccess rules.
// It's possible that the rewrite rules in .htaccess aren't working on this
// server, but there's no harm (other than the time spent generating the
// file) in generating the file anyway. Sites on servers where rewrite rules
// aren't working can set css.gzip to FALSE in order to skip
// generating a file that won't be used.
if (extension_loaded('zlib') && \Drupal::config('system.performance')->get($file_extension . '.gzip')) {
// If CSS/JS gzip compression is enabled then create a gzipped version of
// this file. This file is served conditionally to browsers that accept gzip
// using .htaccess rules. It's possible that the rewrite rules in .htaccess
// aren't working on this server, but there's no harm (other than the time
// spent generating the file) in generating the file anyway. Sites on
// servers where rewrite rules aren't working can set css.gzip to FALSE in
// order to skip generating a file that won't be used.
if (\Drupal::config('system.performance')->get($file_extension . '.gzip')) {
try {
if (!file_exists($uri . '.gz') && !$this->fileSystem->saveData(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FileExists::Replace)) {
return FALSE;

View File

@ -84,17 +84,6 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
*/
protected $strictConfigSchema = FALSE;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
if (!extension_loaded('zlib')) {
$this->markTestSkipped('The zlib extension is not available.');
}
parent::setUp();
}
/**
* Overrides BrowserTestBase::installDrupal() for update testing.
*