From 784c9b2956a8a234d3ccd043224b52a2956eea20 Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Fri, 14 Aug 2026 13:53:49 -0700 Subject: [PATCH] Remove Php8.6 Workaround for Mpdf They have fixed the problem. (And the change to add the workaround should not have targeted this branch, which is restricted to Php8.5-.) --- src/PhpSpreadsheet/Writer/Pdf/Mpdf.php | 28 -------------------------- 1 file changed, 28 deletions(-) diff --git a/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php b/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php index ceb8285b3..1c6ee30a0 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php +++ b/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php @@ -40,13 +40,6 @@ class Mpdf extends Pdf // Create PDF $config = ['tempDir' => $this->tempDir . '/mpdf']; - $restoreHandler = false; - if (PHP_VERSION_ID >= self::$temporaryVersionCheck) { - // @codeCoverageIgnoreStart - set_error_handler(self::specialErrorHandler(...)); - $restoreHandler = true; - // @codeCoverageIgnoreEnd - } $pdf = $this->createExternalWriterInstance($config); $ortmp = $orientation; $pdf->_setPageSize($paperSize, $ortmp); @@ -90,30 +83,9 @@ class Mpdf extends Pdf $str = $pdf->Output('', 'S'); fwrite($fileHandle, $str); - if ($restoreHandler) { - restore_error_handler(); // @codeCoverageIgnore - } parent::restoreStateAfterSave(); } - protected static int $temporaryVersionCheck = 80600; - - /** - * Temporary handler for Php8.6 mb_regex_encoding deprecation. - * - * @codeCoverageIgnore - */ - public function specialErrorHandler(int $errno, string $errstr, string $filename, int $lineno): bool - { - if ($errno === E_DEPRECATED) { - if (preg_match('/Function mb_\w+[(][)] is deprecated since 8[.]6/', $errstr) === 1) { - return true; - } - } - - return false; // continue error handling - } - /** * Convert inches to mm. */