From 13b252cd87a67eb3b6a7eb7e6cd01d85b8f876d8 Mon Sep 17 00:00:00 2001 From: hbrecht Date: Mon, 6 Mar 2023 10:25:40 +0100 Subject: [PATCH] Fix: $this->methodreturn can be array (#99) In function serialize_return, $this->methodreturn can be an array, resulting in "PHP Warning: get_class() expects parameter 1 to be object, array given" Above code change fixes this by checking for object. However, without knowing the complete flow, I am unsure if there is an underlying issue which assigns incorrect type to $this->methodreturn. --- src/nusoap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nusoap.php b/src/nusoap.php index 519434e..dcc8fc4 100755 --- a/src/nusoap.php +++ b/src/nusoap.php @@ -4224,7 +4224,7 @@ function serialize_return() { $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); // if fault - if (isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { + if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { $this->debug('got a fault object from method'); $this->fault = $this->methodreturn; return;