Skip to content

Commit 690af96

Browse files
committed
Replace (int) parser conversion with spl_object_hash
The (int) conversion does not work anymore since PHP 8 changed the xml parser from being a resource to being an object. Hardcoding it to a number, the initial fix, destroys the logic of having multiple parsers available and was not done everywhere. The object hash approach should be a valid replacement.
1 parent a6619f7 commit 690af96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bundled-libs/XML/RPC.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function XML_RPC_se($parser_resource, $name, $attrs)
245245
{
246246
global $XML_RPC_xh, $XML_RPC_valid_parents;
247247

248-
$parser = (int) $parser_resource;
248+
$parser = spl_object_hash($parser_resource);
249249

250250
// if invalid xmlrpc already detected, skip all processing
251251
if ($XML_RPC_xh[$parser]['isf'] >= 2) {
@@ -374,7 +374,7 @@ function XML_RPC_ee($parser_resource, $name)
374374
{
375375
global $XML_RPC_xh;
376376

377-
$parser = (int) $parser_resource;
377+
$parser = spl_object_hash($parser_resource);
378378

379379
if ($XML_RPC_xh[$parser]['isf'] >= 2) {
380380
return;
@@ -511,7 +511,7 @@ function XML_RPC_cd($parser_resource, $data)
511511
{
512512
global $XML_RPC_xh, $XML_RPC_backslash;
513513

514-
$parser = (int) $parser_resource;
514+
$parser = spl_object_hash($parser_resource);
515515

516516
if ($XML_RPC_xh[$parser]['lv'] != 3) {
517517
// "lookforvalue==3" means that we've found an entire value
@@ -1433,7 +1433,7 @@ function parseResponse($data = '')
14331433

14341434
$encoding = $this->getEncoding($data);
14351435
$parser_resource = xml_parser_create($encoding);
1436-
$parser = 1;
1436+
$parser = spl_object_hash($parser_resource);
14371437

14381438
$XML_RPC_xh = array();
14391439
$XML_RPC_xh[$parser] = array();

0 commit comments

Comments
 (0)