Verified Commit b3a83764 authored by Dave Long's avatar Dave Long
Browse files

Issue #3439591 by quietone, mstrelan, pradhumanjain2311, andypost, catch, mfb,...

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

(cherry picked from commit 0a4f122f)
parent 55c348aa
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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",
+1 −0
Original line number Diff line number Diff line
@@ -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",
+0 −6
Original line number Diff line number Diff line
@@ -80,9 +80,6 @@ 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
@@ -104,9 +101,6 @@ public static function compressQueryParameter(string $data): string {
   *   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)));
+8 −9
Original line number Diff line number Diff line
@@ -60,15 +60,14 @@ public function dumpToUri(string $data, string $file_extension, string $uri): st
    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;
+0 −11
Original line number Diff line number Diff line
@@ -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.
   *