From e079f0d88e1f3e8b7f56da43b4af1211b6f5d97e Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 7 Oct 2023 14:25:07 +0100 Subject: [PATCH] refector: Drop usage of xml_set_object() Use proper callables instead. Related to: https://github.com/php/php-src/pull/12340 --- parsers/ARC2_AtomParser.php | 7 +++---- parsers/ARC2_LegacyXMLParser.php | 7 +++---- parsers/ARC2_RDFXMLParser.php | 7 +++---- parsers/ARC2_SPOGParser.php | 7 +++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/parsers/ARC2_AtomParser.php b/parsers/ARC2_AtomParser.php index 0d7feeb..ad9fccc 100644 --- a/parsers/ARC2_AtomParser.php +++ b/parsers/ARC2_AtomParser.php @@ -251,10 +251,9 @@ public function initXMLParser() $parser = xml_parser_create($enc); xml_parser_set_option($parser, \XML_OPTION_SKIP_WHITE, 0); xml_parser_set_option($parser, \XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($parser, 'open', 'close'); - xml_set_character_data_handler($parser, 'cData'); - xml_set_start_namespace_decl_handler($parser, 'nsDecl'); - xml_set_object($parser, $this); + xml_set_element_handler($parser, [$this, 'open'], [$this, 'close']); + xml_set_character_data_handler($parser, [$this, 'cData']); + xml_set_start_namespace_decl_handler($parser, [$this, 'nsDecl']); $this->xml_parser = $parser; } } diff --git a/parsers/ARC2_LegacyXMLParser.php b/parsers/ARC2_LegacyXMLParser.php index 43eae05..5eb1172 100644 --- a/parsers/ARC2_LegacyXMLParser.php +++ b/parsers/ARC2_LegacyXMLParser.php @@ -205,10 +205,9 @@ public function initXMLParser() $parser = xml_parser_create_ns($enc, ''); xml_parser_set_option($parser, \XML_OPTION_SKIP_WHITE, 0); xml_parser_set_option($parser, \XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($parser, 'open', 'close'); - xml_set_character_data_handler($parser, 'cData'); - xml_set_start_namespace_decl_handler($parser, 'nsDecl'); - xml_set_object($parser, $this); + xml_set_element_handler($parser, [$this, 'open'], [$this, 'close']); + xml_set_character_data_handler($parser, [$this, 'cData']); + xml_set_start_namespace_decl_handler($parser, [$this, 'nsDecl']); $this->xml_parser = $parser; } } diff --git a/parsers/ARC2_RDFXMLParser.php b/parsers/ARC2_RDFXMLParser.php index 961648a..4a52d57 100644 --- a/parsers/ARC2_RDFXMLParser.php +++ b/parsers/ARC2_RDFXMLParser.php @@ -112,10 +112,9 @@ public function initXMLParser() $parser = xml_parser_create_ns($enc, ''); xml_parser_set_option($parser, \XML_OPTION_SKIP_WHITE, 0); xml_parser_set_option($parser, \XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($parser, 'open', 'close'); - xml_set_character_data_handler($parser, 'cdata'); - xml_set_start_namespace_decl_handler($parser, 'nsDecl'); - xml_set_object($parser, $this); + xml_set_element_handler($parser, [$this, 'open'], [$this, 'close']); + xml_set_character_data_handler($parser, [$this, 'cData']); + xml_set_start_namespace_decl_handler($parser, [$this, 'nsDecl']); $this->xml_parser = $parser; } } diff --git a/parsers/ARC2_SPOGParser.php b/parsers/ARC2_SPOGParser.php index 258d60a..f8c6315 100755 --- a/parsers/ARC2_SPOGParser.php +++ b/parsers/ARC2_SPOGParser.php @@ -100,10 +100,9 @@ public function initXMLParser() $parser = xml_parser_create($enc); xml_parser_set_option($parser, \XML_OPTION_SKIP_WHITE, 0); xml_parser_set_option($parser, \XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($parser, 'open', 'close'); - xml_set_character_data_handler($parser, 'cdata'); - xml_set_start_namespace_decl_handler($parser, 'nsDecl'); - xml_set_object($parser, $this); + xml_set_element_handler($parser, [$this, 'open'], [$this, 'close']); + xml_set_character_data_handler($parser, [$this, 'cdata']); + xml_set_start_namespace_decl_handler($parser, [$this, 'nsDecl']); $this->xml_parser = $parser; } }