Skip to content

Commit e0e9f64

Browse files
authored
Fix PHP 8.5 deprecation for xml_parser_free
Add php version check to xml_parser_free() for PHP 8.5 compatibility.
1 parent ca5b6de commit e0e9f64

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tcpdf.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23268,8 +23268,11 @@ public function ImageSVG($file, $x=null, $y=null, $w=0, $h=0, $link='', $align='
2326823268
$error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser));
2326923269
$this->Error($error_message);
2327023270
}
23271-
// free this XML parser
23272-
xml_parser_free($parser);
23271+
23272+
// free this XML parser (does nothing in PHP >= 8.0)
23273+
if (function_exists('xml_parser_free') && PHP_VERSION_ID < 80000) {
23274+
xml_parser_free($parser);
23275+
}
2327323276

2327423277
// >= PHP 7.0.0 "explicitly unset the reference to parser to avoid memory leaks"
2327523278
unset($parser);

0 commit comments

Comments
 (0)