@@ -40,6 +40,13 @@ public function save($filename, int $flags = 0): void
4040
4141 // Create PDF
4242 $ config = ['tempDir ' => $ this ->tempDir . '/mpdf ' ];
43+ $ restoreHandler = false ;
44+ if (PHP_VERSION_ID >= self ::$ temporaryVersionCheck ) {
45+ // @codeCoverageIgnoreStart
46+ set_error_handler (self ::specialErrorHandler (...));
47+ $ restoreHandler = true ;
48+ // @codeCoverageIgnoreEnd
49+ }
4350 $ pdf = $ this ->createExternalWriterInstance ($ config );
4451 $ ortmp = $ orientation ;
4552 $ pdf ->_setPageSize ($ paperSize , $ ortmp );
@@ -83,9 +90,30 @@ public function save($filename, int $flags = 0): void
8390 $ str = $ pdf ->Output ('' , 'S ' );
8491 fwrite ($ fileHandle , $ str );
8592
93+ if ($ restoreHandler ) {
94+ restore_error_handler (); // @codeCoverageIgnore
95+ }
8696 parent ::restoreStateAfterSave ();
8797 }
8898
99+ protected static int $ temporaryVersionCheck = 80500 ;
100+
101+ /**
102+ * Temporary handler for Php8.5 waiting for Dompdf release.
103+ *
104+ * @codeCoverageIgnore
105+ */
106+ public function specialErrorHandler (int $ errno , string $ errstr , string $ filename , int $ lineno ): bool
107+ {
108+ if ($ errno === E_DEPRECATED ) {
109+ if (preg_match ('/Providing an empty string is deprecated/ ' , $ errstr ) === 1 ) {
110+ return true ;
111+ }
112+ }
113+
114+ return false ; // continue error handling
115+ }
116+
89117 /**
90118 * Convert inches to mm.
91119 */
0 commit comments