From 94df5941c5c6188fffe4f0796f33715b95df7c57 Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:09:04 -0800 Subject: [PATCH 1/2] Upgrade Dompdf to 8.4-Compatible Version --- composer.lock | 12 ++++++------ src/PhpSpreadsheet/Helper/Sample.php | 7 +------ .../Functional/StreamTest.php | 12 +----------- .../Writer/Dompdf/PaperSizeArrayTest.php | 18 ++---------------- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/composer.lock b/composer.lock index 585ebaf0c7..b217d08ce5 100644 --- a/composer.lock +++ b/composer.lock @@ -788,16 +788,16 @@ }, { "name": "dompdf/dompdf", - "version": "v3.0.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/dompdf/dompdf.git", - "reference": "fbc7c5ee5d94f7a910b78b43feb7931b7f971b59" + "reference": "2d622faf9aa1f8f7f24dd094e49b5cf6c0c5d4e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/fbc7c5ee5d94f7a910b78b43feb7931b7f971b59", - "reference": "fbc7c5ee5d94f7a910b78b43feb7931b7f971b59", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/2d622faf9aa1f8f7f24dd094e49b5cf6c0c5d4e6", + "reference": "2d622faf9aa1f8f7f24dd094e49b5cf6c0c5d4e6", "shasum": "" }, "require": { @@ -846,9 +846,9 @@ "homepage": "https://github.com/dompdf/dompdf", "support": { "issues": "https://github.com/dompdf/dompdf/issues", - "source": "https://github.com/dompdf/dompdf/tree/v3.0.0" + "source": "https://github.com/dompdf/dompdf/tree/v3.0.1" }, - "time": "2024-04-29T14:01:28+00:00" + "time": "2024-12-05T14:59:38+00:00" }, { "name": "dompdf/php-font-lib", diff --git a/src/PhpSpreadsheet/Helper/Sample.php b/src/PhpSpreadsheet/Helper/Sample.php index 136c458d44..420e80b7be 100644 --- a/src/PhpSpreadsheet/Helper/Sample.php +++ b/src/PhpSpreadsheet/Helper/Sample.php @@ -9,7 +9,6 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Writer\IWriter; -use PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use RecursiveRegexIterator; @@ -129,11 +128,7 @@ public function write(Spreadsheet $spreadsheet, string $filename, array $writers $writerCallback($writer); } $callStartTime = microtime(true); - if (PHP_VERSION_ID >= 80400 && $writer instanceof Dompdf) { - @$writer->save($path); - } else { - $writer->save($path); - } + $writer->save($path); $this->logWrite($writer, $path, $callStartTime); if ($this->isCli() === false) { // @codeCoverageIgnoreStart diff --git a/tests/PhpSpreadsheetTests/Functional/StreamTest.php b/tests/PhpSpreadsheetTests/Functional/StreamTest.php index c67c1ab22c..3430b7a31b 100644 --- a/tests/PhpSpreadsheetTests/Functional/StreamTest.php +++ b/tests/PhpSpreadsheetTests/Functional/StreamTest.php @@ -8,12 +8,6 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PHPUnit\Framework\TestCase; -/** - * Not clear that Dompdf will be Php8.4 compatible in time. - * Run in separate process and add version test till it is ready. - * - * @runTestsInSeparateProcesses - */ class StreamTest extends TestCase { public static function providerFormats(): array @@ -48,11 +42,7 @@ public function testAllWritersCanWriteToStream(string $format): void } else { self::assertSame(0, $stat['size']); - if ($format === 'Dompdf' && PHP_VERSION_ID >= 80400) { - @$writer->save($stream); - } else { - $writer->save($stream); - } + $writer->save($stream); self::assertIsResource($stream, 'should not close the stream for further usage out of PhpSpreadsheet'); $stat = fstat($stream); diff --git a/tests/PhpSpreadsheetTests/Writer/Dompdf/PaperSizeArrayTest.php b/tests/PhpSpreadsheetTests/Writer/Dompdf/PaperSizeArrayTest.php index ccd0e84f05..4c0b86b637 100644 --- a/tests/PhpSpreadsheetTests/Writer/Dompdf/PaperSizeArrayTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Dompdf/PaperSizeArrayTest.php @@ -10,12 +10,6 @@ use PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf; use PHPUnit\Framework\TestCase; -/** - * Not clear that Dompdf will be Php8.4 compatible in time. - * Run in separate process and add version test till it is ready. - * - * @runTestsInSeparateProcesses - */ class PaperSizeArrayTest extends TestCase { private string $outfile = ''; @@ -42,11 +36,7 @@ public function testPaperSizeArray(): void $sheet->setCellValue('A7', 'Lorem Ipsum'); $writer = new Dompdf($spreadsheet); $this->outfile = File::temporaryFilename(); - if (PHP_VERSION_ID >= 80400) { // hopefully temporary - @$writer->save($this->outfile); - } else { - $writer->save($this->outfile); - } + $writer->save($this->outfile); $spreadsheet->disconnectWorksheets(); unset($spreadsheet); $contents = file_get_contents($this->outfile); @@ -66,11 +56,7 @@ public function testPaperSizeNotArray(): void $sheet->setCellValue('A7', 'Lorem Ipsum'); $writer = new Dompdf($spreadsheet); $this->outfile = File::temporaryFilename(); - if (PHP_VERSION_ID >= 80400) { // hopefully temporary - @$writer->save($this->outfile); - } else { - $writer->save($this->outfile); - } + $writer->save($this->outfile); $spreadsheet->disconnectWorksheets(); unset($spreadsheet); $contents = file_get_contents($this->outfile); From e8e8b3cd261cfb6817e61a678e742d4c6d34c3dd Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Sat, 7 Dec 2024 22:32:19 -0800 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b0bfe17b2..67915c7052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com) and this project adheres to [Semantic Versioning](https://semver.org). -## TBD - 3.6.0 +## 2024-12-08 - 3.6.0 ### Added @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Swapped row and column indexes in ReferenceHelper. [Issue #4246](https://github.com/PHPOffice/PhpSpreadsheet/issues/4246) [PR #4247](https://github.com/PHPOffice/PhpSpreadsheet/pull/4247) - Fix minor break handling drawings. [Issue #4241](https://github.com/PHPOffice/PhpSpreadsheet/issues/4241) [PR #4244](https://github.com/PHPOffice/PhpSpreadsheet/pull/4244) - Ignore cell formatting when the format is a single @. [Issue #4242](https://github.com/PHPOffice/PhpSpreadsheet/issues/4242) [PR #4243](https://github.com/PHPOffice/PhpSpreadsheet/pull/4243) +- Upgrade Dompdf to Php-8.4 compatible version [PR #4267](https://github.com/PHPOffice/PhpSpreadsheet/pull/4267) ## 2024-11-22 - 3.5.0