Skip to content

Commit

Permalink
prepare for php 8.4 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Sep 7, 2024
1 parent ede1b63 commit 5c97d09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/Helper/XMLParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,21 @@ public function parse($data, $returnType = self::RETURN_XMLRPCVALS, $accept = 3,
// always set this, in case someone tries to disable it via options...
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1);

xml_set_object($parser, $this);

switch ($returnType) {
case self::RETURN_PHP:
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
xml_set_element_handler($parser, array($this, 'xmlrpc_se'), array($this, 'xmlrpc_ee_fast'));
break;
case self::RETURN_EPIVALS:
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_epi');
xml_set_element_handler($parser, array($this, 'xmlrpc_se'), array($this, 'xmlrpc_ee_epi'));
break;
/// @todo log an error / throw / error-out on unsupported return type
case XMLParser::RETURN_XMLRPCVALS:
default:
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
xml_set_element_handler($parser, array($this, 'xmlrpc_se'), array($this, 'xmlrpc_ee'));
}

xml_set_character_data_handler($parser, 'xmlrpc_cd');
xml_set_default_handler($parser, 'xmlrpc_dh');
xml_set_character_data_handler($parser, array($this, 'xmlrpc_cd'));
xml_set_default_handler($parser, array($this, 'xmlrpc_dh'));

try {
// @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
Expand Down
6 changes: 3 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,15 +998,15 @@ public function methodNameCallback($methodName, $xmlParser, $parser = null)
/// @todo this should be done by a method of the XMLParser
switch ($dmap[$methodName]['parameters_type']) {
case XMLParser::RETURN_PHP:
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
xml_set_element_handler($parser, array($xmlParser, 'xmlrpc_se'), array($xmlParser, 'xmlrpc_ee_fast'));
break;
case XMLParser::RETURN_EPIVALS:
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_epi');
xml_set_element_handler($parser, array($xmlParser, 'xmlrpc_se'), array($xmlParser, 'xmlrpc_ee_epi'));
break;
/// @todo log a warning on unsupported return type
case XMLParser::RETURN_XMLRPCVALS:
default:
xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
xml_set_element_handler($parser, array($xmlParser, 'xmlrpc_se'), array($xmlParser, 'xmlrpc_ee'));
}
}
}
Expand Down

0 comments on commit 5c97d09

Please sign in to comment.