Skip to content

Commit 6d007ea

Browse files
committed
ci: Add PHP 8.5
1 parent fcdc71d commit 6d007ea

2 files changed

Lines changed: 36 additions & 8 deletions

File tree

.github/workflows/testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
- '8.2'
7777
- '8.3'
7878
- '8.4'
79+
- '8.5'
7980
dependencies:
8081
- lowest
8182
- locked

src/Module/Archive/Internal/GzArchive.php

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,72 @@ final class GzArchive extends Archive
1818
{
1919
public function extract(): \Generator
2020
{
21+
\fwrite(\STDERR, "[GzArchive] Starting extraction\n");
22+
\fwrite(\STDERR, "[GzArchive] zlib loaded: " . (\extension_loaded('zlib') ? 'yes' : 'NO') . "\n");
23+
2124
$sourcePath = $this->asset->getRealPath() ?: $this->asset->getPathname();
25+
\fwrite(\STDERR, "[GzArchive] Source: {$sourcePath}\n");
26+
\fwrite(\STDERR, "[GzArchive] Source exists: " . (\file_exists($sourcePath) ? 'yes' : 'NO') . "\n");
27+
\fwrite(\STDERR, "[GzArchive] Source size: " . (\file_exists($sourcePath) ? \filesize($sourcePath) : 'N/A') . "\n");
2228

2329
$gz = \gzopen($sourcePath, 'rb');
24-
$gz !== false or throw new ArchiveException(
25-
\sprintf('Could not open "%s" for reading.', $this->asset->getPathname()),
26-
);
30+
if ($gz === false) {
31+
\fwrite(\STDERR, "[GzArchive] gzopen FAILED\n");
32+
throw new ArchiveException(
33+
\sprintf('Could not open "%s" for reading.', $this->asset->getPathname()),
34+
);
35+
}
36+
37+
\fwrite(\STDERR, "[GzArchive] gzopen OK\n");
2738

2839
try {
2940
// Derive output filename by stripping .gz extension
3041
$outputName = \preg_replace('/\.gz$/i', '', $this->asset->getFilename());
3142
$tempPath = \sys_get_temp_dir() . \DIRECTORY_SEPARATOR . $outputName;
43+
\fwrite(\STDERR, "[GzArchive] Temp output: {$tempPath}\n");
3244

3345
$out = \fopen($tempPath, 'wb');
34-
$out !== false or throw new ArchiveException(
35-
\sprintf('Could not create temporary file "%s".', $tempPath),
36-
);
46+
if ($out === false) {
47+
\fwrite(\STDERR, "[GzArchive] fopen temp FAILED\n");
48+
throw new ArchiveException(
49+
\sprintf('Could not create temporary file "%s".', $tempPath),
50+
);
51+
}
3752

3853
try {
54+
$bytesWritten = 0;
3955
while (!\gzeof($gz)) {
4056
$chunk = \gzread($gz, 8192);
4157
if ($chunk === false) {
58+
\fwrite(\STDERR, "[GzArchive] gzread returned false\n");
4259
break;
4360
}
44-
\fwrite($out, $chunk);
61+
$bytesWritten += \fwrite($out, $chunk);
4562
}
63+
\fwrite(\STDERR, "[GzArchive] Decompressed bytes: {$bytesWritten}\n");
4664
} finally {
4765
\fclose($out);
4866
}
4967

5068
$fileInfo = new \SplFileInfo($tempPath);
69+
\fwrite(\STDERR, "[GzArchive] Temp file exists: " . ($fileInfo->isFile() ? 'yes' : 'NO') . "\n");
70+
\fwrite(\STDERR, "[GzArchive] Temp file size: " . ($fileInfo->isFile() ? $fileInfo->getSize() : 'N/A') . "\n");
71+
\fwrite(\STDERR, "[GzArchive] Yielding: {$fileInfo->getFilename()}\n");
5172

5273
/** @var \SplFileInfo|null $fileTo */
5374
$fileTo = yield $fileInfo->getPathname() => $fileInfo;
5475

76+
\fwrite(\STDERR, "[GzArchive] fileTo received: " . ($fileTo instanceof \SplFileInfo ? $fileTo->getPathname() : 'null') . "\n");
77+
5578
if ($fileTo instanceof \SplFileInfo) {
56-
\copy($tempPath, $fileTo->getRealPath() ?: $fileTo->getPathname());
79+
$destPath = $fileTo->getRealPath() ?: $fileTo->getPathname();
80+
\fwrite(\STDERR, "[GzArchive] Copying to: {$destPath}\n");
81+
$copyResult = \copy($tempPath, $destPath);
82+
\fwrite(\STDERR, "[GzArchive] Copy result: " . ($copyResult ? 'OK' : 'FAILED') . "\n");
5783
}
5884
} finally {
5985
\gzclose($gz);
86+
\fwrite(\STDERR, "[GzArchive] Done\n");
6087
}
6188
}
6289
}

0 commit comments

Comments
 (0)