Skip to content

Commit

Permalink
fix deprecation warning on PHP 8.4 with xml_set_object()
Browse files Browse the repository at this point in the history
RuntimeException: Function xml_set_object() is deprecated since 8.4, provide a proper method callable to xml_set_*_handler() functions on line 6808 in file vendor/econea/nusoap/src/nusoap.php
  • Loading branch information
tenzap authored and f3l1x committed Feb 8, 2025
1 parent 96cf200 commit 6e855b7
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1242,16 +1242,13 @@ function parseString($xml, $type)
// Set the options for parsing the XML data.
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);

// Set the object for the parser.
xml_set_object($this->parser, $this);

// Set the element handlers for the parser.
if ($type == "schema") {
xml_set_element_handler($this->parser, 'schemaStartElement', 'schemaEndElement');
xml_set_character_data_handler($this->parser, 'schemaCharacterData');
xml_set_element_handler($this->parser, [$this, 'schemaStartElement'], [$this, 'schemaEndElement']);
xml_set_character_data_handler($this->parser, [$this, 'schemaCharacterData']);
} elseif ($type == "xml") {
xml_set_element_handler($this->parser, 'xmlStartElement', 'xmlEndElement');
xml_set_character_data_handler($this->parser, 'xmlCharacterData');
xml_set_element_handler($this->parser, [$this, 'xmlStartElement'], [$this, 'xmlEndElement']);
xml_set_character_data_handler($this->parser, [$this, 'xmlCharacterData']);
}

// Parse the XML file.
Expand Down Expand Up @@ -5002,11 +4999,9 @@ function parseWSDL($wsdl = '')
// Set the options for parsing the XML data.
// xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
// Set the object for the parser.
xml_set_object($this->parser, $this);
// Set the element handlers for the parser.
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');
xml_set_element_handler($this->parser, [$this, 'start_element'], [$this, 'end_element']);
xml_set_character_data_handler($this->parser, [$this, 'character_data']);
// Parse the XML file.
if (!xml_parse($this->parser, $wsdl_string, true)) {
// Display an error message.
Expand Down Expand Up @@ -6809,11 +6804,9 @@ function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = tru
//xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
// Set the object for the parser.
xml_set_object($this->parser, $this);
// Set the element handlers for the parser.
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');
xml_set_element_handler($this->parser, [$this, 'start_element'], [$this, 'end_element']);
xml_set_character_data_handler($this->parser, [$this, 'character_data']);
$parseErrors = array();
$chunkSize = 4096;
for($pointer = 0; $pointer < strlen($xml) && empty($parseErrors); $pointer += $chunkSize) {
Expand Down Expand Up @@ -6871,9 +6864,8 @@ function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = tru
$this->parser = xml_parser_create($this->xml_encoding);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');
xml_set_element_handler($this->parser, [$this, 'start_element'], [$this, 'end_element']);
xml_set_character_data_handler($this->parser, [$this, 'character_data']);

if(!empty($attachment['content'])) {
$content = $attachment['content'];
Expand Down

0 comments on commit 6e855b7

Please sign in to comment.