Skip to content

Commit f3d011d

Browse files
Update src/mServer/Response.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent ee4f620 commit f3d011d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/mServer/Response.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,14 @@ public function useCaller(Client $caller): void
8383
$this->caller = $caller;
8484
if ($caller->lastCurlResponse) {
8585
$this->rawXML = $caller->lastCurlResponse;
86-
$xml = simplexml_load_string($this->rawXML);
86+
$xml = simplexml_load_string($this->rawXML, 'SimpleXMLElement', \LIBXML_NONET | \LIBXML_NOCDATA);
8787
if ($xml) {
88-
$this->state = (string) $xml->attributes('rsp', true)->state;
89-
$this->note = (string) $xml->attributes('rsp', true)->note;
90-
foreach ($xml->children('rsp', true) as $responsePackItem) {
88+
$attrsRsp = $xml->attributes('rsp', true);
89+
$attrs = $xml->attributes();
90+
$this->state = (string) (($attrsRsp['state'] ?? $attrs['state'] ?? '') );
91+
$this->note = (string) (($attrsRsp['note'] ?? $attrs['note'] ?? '') );
92+
$children = iterator_to_array($xml->children('rsp', true) ?: $xml->children());
93+
foreach ($children as $responsePackItem) {
9194
$this->processResponsePackItem($responsePackItem);
9295
}
9396
}

0 commit comments

Comments
 (0)