Repository: symfony/symfony
File: src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProvider.php (PHP)

Code before:
            if (\in_array($process['status'], self::FAILED_PROCESS_STATUS, true)) {
                throw new ProviderException(\sprintf('Unable to export translations from Lokalise: "%s".', $response->getContent(false)), $response);
            }
            if (self::SUCESS_PROCESS_STATUS === $process['status']) {
                $downloadUrl = $process['details']['download_url'];
                break;
            }
            ++$attempt;
            usleep(500000 * $attempt);
        }

        $response = $this->client->request('GET', $downloadUrl, ['buffer' => true]);
        if (200 !== $response->getStatusCode()) {
            throw new ProviderException(\sprintf('Unable to download translations file from Lokalise: "%s".', $response->getContent(false)), $response);
        }
        $newfile = \sprintf('%s%s%s.zip', sys_get_temp_dir(), \DIRECTORY_SEPARATOR, uniqid());
        $extractPath = \sprintf('%s%s%s', sys_get_temp_dir(), \DIRECTORY_SEPARATOR, uniqid());
        try {
            $fileHandler = fopen($newfile, 'w');
            foreach ($this->client->stream($response) as $chunk) {
                fwrite($fileHandler, $chunk->getContent());
            }
            fclose($fileHandler);

            $zip = new \ZipArchive();
            if (!$zip->open($newfile, \ZipArchive::CREATE)) {
                throw new LogicException(\sprintf('failed to open zip file "%s".', $newfile));
            }

            try {
                if (!$zip->extractTo($extractPath)) {
                    throw new LogicException(\sprintf('failed to extract content from zip file "%s".', $newfile));
                }
            } finally {
                $zip->close();
            }

            $fileContents = $this->getFileContents($extractPath);

            // Lokalise returns languages with "-" separator, we need to reformat them to "_" separator.
            /** @var array<array-key, array-key> $reformattedLanguages */
            $reformattedLanguages = array_map(static fn ($language) => str_replace('-', '_', $language), array_keys($fileContents));

            return array_combine($reformattedLanguages, $fileContents);
        } finally {
            unlink($newfile);
            $this->removeDir($extractPath);
        }
    }

    private function getFileContents(string $dir, string $baseDir = ''): array

Review comment (suggestion):
```suggestion
            if (!$zip->open($zipFile)) {
```

Code after:
            }
            if (self::SUCESS_PROCESS_STATUS === $process['status']) {
                $downloadUrl = $process['details']['download_url'];
                break;
            }
            usleep(500000);
        }

        $response = $this->client->request('GET', $downloadUrl, ['buffer' => false]);
        if (200 !== $response->getStatusCode()) {
            throw new ProviderException(\sprintf('Unable to download translations file from Lokalise: "%s".', $response->getContent(false)), $response);
        }
        $zipFile = tempnam(sys_get_temp_dir(), 'lokalise');
        $extractPath = $zipFile.'.dir';
        try {
            if (!$h = @fopen($zipFile, 'w')) {
                throw new RuntimeException(error_get_last()['message'] ?? 'Failed to create temporary file.');
            }
            foreach ($this->client->stream($response) as $chunk) {
                fwrite($h, $chunk->getContent());
            }
            fclose($h);

            $zip = new \ZipArchive();
            if (!$zip->open($zipFile)) {
                throw new RuntimeException('Failed to open zipped translations from Lokalise.');
            }

            try {
                if (!$zip->extractTo($extractPath)) {
                    throw new RuntimeException('Failed to unzip translations from Lokalize.');
                }
            } finally {
                $zip->close();
            }

            return $this->getZipContents($extractPath);
        } finally {
            if (is_resource($h)) {
                fclose($h);
            }
            @unlink($zipFile);
            $this->removeDir($extractPath);
        }
    }

    private function getZipContents(string $dir): array
    {
        $contents = [];
        foreach (scandir($dir) as $lang) {
            if (\in_array($lang, ['.', '..'], true)) {