From f6a88a5cfec7f29ff971fe646cea399e11059ea9 Mon Sep 17 00:00:00 2001 From: dominservice Date: Wed, 20 Jul 2022 09:59:46 +0200 Subject: [PATCH] Fix bux by empty response from SOAP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stristr(): Argument #1 ($haystack) must be of type string, null given at domains/______.pl/public_html/vendor/mrcnpdlk/regon-api/src/RegonSoapClient.php:78 74▕ $hdr->appendChild(new DOMElement('To', $location, 'http://www.w3.org/2005/08/addressing')); 75▕ $dom->documentElement->insertBefore($hdr, $dom->documentElement->firstChild); 76▕ $request = $dom->saveXML(); 77▕ $response = parent::__doRequest($request, $location, $action, $version, $oneWay); ➜ 78▕ $response = stristr(stristr($response, '', true) . ''; 79▕ 80▕ return $response; 81▕ } 82▕ --- src/RegonSoapClient.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/RegonSoapClient.php b/src/RegonSoapClient.php index 69bb303..d37adb0 100644 --- a/src/RegonSoapClient.php +++ b/src/RegonSoapClient.php @@ -74,10 +74,12 @@ public function __doRequest($request, $location, $action, $version, $oneWay = 0) $hdr->appendChild(new DOMElement('To', $location, 'http://www.w3.org/2005/08/addressing')); $dom->documentElement->insertBefore($hdr, $dom->documentElement->firstChild); $request = $dom->saveXML(); - $response = parent::__doRequest($request, $location, $action, $version, $oneWay); - $response = stristr(stristr($response, '', true) . ''; + if ($response = parent::__doRequest($request, $location, $action, $version, $oneWay)) { + $response = stristr(stristr($response, '', true) . ''; + return $response; + } - return $response; + return ''; } /**