From 3dd817b198d64f36941a13bfe953b4db5f884a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Wed, 24 Jul 2024 12:49:20 -0300 Subject: [PATCH] Remove usage of xml_set_object() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The xml_set_object() function will be deprecated in PHP 8.4 as well as passing non-callable strings to the xml_set_*_handler() functions. Instead of using xml_set_object(), the string method names in xml_set_element_handler() and xml_set_character_data_handler() should be replaced with callables. - https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names Signed-off-by: MaurĂ­cio Meneghini Fauth --- tcpdf.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tcpdf.php b/tcpdf.php index 60f93c41..21c90b9a 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -23170,14 +23170,12 @@ public function ImageSVG($file, $x=null, $y=null, $w=0, $h=0, $link='', $align=' $this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y))); // creates a new XML parser to be used by the other XML functions $parser = xml_parser_create('UTF-8'); - // the following function allows to use parser inside object - xml_set_object($parser, $this); // disable case-folding for this XML parser xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); // sets the element handler functions for the XML parser - xml_set_element_handler($parser, 'startSVGElementHandler', 'endSVGElementHandler'); + xml_set_element_handler($parser, [$this, 'startSVGElementHandler'], [$this, 'endSVGElementHandler']); // sets the character data handler function for the XML parser - xml_set_character_data_handler($parser, 'segSVGContentHandler'); + xml_set_character_data_handler($parser, [$this, 'segSVGContentHandler']); // start parsing an XML document if (!xml_parse($parser, $svgdata)) { $error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser));