4.2: Dienst stürzt ab bei Soap Abfrage

Hallo zusammen,

seit dem Update auf die 4.2 stürzt der IP-Symcon-Dienst komplett ab wenn ich eines meiner Soap-Skripte starte, z.B. das für die Verbindung zum Exchange-Server.

Beim Versuch einen neuen Soap-Client zu erstellen bekomme ich in der Konsole folgende Fehlermeldung: „Error receiving data: (12030) Die Serververbindung wurde aufgrund eines Fehlers beendet“.
Im Log ist kein Eintrag mehr zu finden.

Das entscheidende Skript sieht bei mir so aus:

<?
class NTLMSoapClient extends SoapClient {
    function __doRequest($request, $location, $action, $version, $one_way = 0) {
        $headers = array(
            'Method: POST',
            'Connection: Keep-Alive',
            'User-Agent: PHP-SOAP-CURL',
            'Content-Type: text/xml; charset=utf-8',
            'SOAPAction: "'.$action.'"',
        );
        $this->__last_request_headers = $headers;
        $ch = curl_init($location);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
        curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
        curl_setopt($ch, CURLOPT_USERPWD, $this->user.':'.$this->password);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

        $response = curl_exec($ch);
        return $response;
    }
    function __getLastRequestHeaders() {
        return implode("n", $this->__last_request_headers)."n";
    }
}


class ExchangeNTLMSoapClient extends NTLMSoapClient {
    protected $user = 'domain\user';
    protected $password = 'password';
}

class NTLMStream {
    private $path;
    private $mode;
    private $options;
    private $opened_path;
    private $buffer;
    private $pos;

    public function stream_open($path, $mode, $options, $opened_path) {
        echo "[NTLMStream::stream_open] $path , mode=$mode n";
        $this->path = $path;
        $this->mode = $mode;
        $this->options = $options;
        $this->opened_path = $opened_path;
        $this->createBuffer($path);
        return true;
    }

    public function stream_close() {
        echo "[NTLMStream::stream_close] n";
        curl_close($this->ch);
    }

    public function stream_read($count) {
        echo "[NTLMStream::stream_read] $count n";
        if(strlen($this->buffer) == 0) {
            return false;
        }
        $read = substr($this->buffer,$this->pos, $count);
        $this->pos += $count;
        return $read;
    }

    public function stream_write($data) {
        echo "[NTLMStream::stream_write] n";
        if(strlen($this->buffer) == 0) {
            return false;
        }
        return true;
    }

    public function stream_eof() {
        echo "[NTLMStream::stream_eof] ";
        if($this->pos > strlen($this->buffer)) {
            echo "true n";
            return true;
        }
        echo "false n";
        return false;
    }

    /* return the position of the current read pointer */
    public function stream_tell() {
        echo "[NTLMStream::stream_tell] n";
        return $this->pos;
    }

    public function stream_flush() {
        echo "[NTLMStream::stream_flush] n";
        $this->buffer = null;
        $this->pos = null;
    }

    public function stream_stat() {
        echo "[NTLMStream::stream_stat] n";
        $this->createBuffer($this->path);
        $stat = array(
            'size' => strlen($this->buffer),
        );
        return $stat;
    }

    public function url_stat($path, $flags) {
        echo "[NTLMStream::url_stat] n";
        $this->createBuffer($path);
        $stat = array(
            'size' => strlen($this->buffer),
        );
        return $stat;
    }

    /* Create the buffer by requesting the url through cURL */
    private function createBuffer($path) {
        if($this->buffer) {
            return;
        }
        echo "[NTLMStream::createBuffer] create buffer from : $pathn";
        $this->ch = curl_init($path);
        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
        curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
        curl_setopt($this->ch, CURLOPT_USERPWD, $this->user.':'.$this->password);
        echo $this->buffer = curl_exec($this->ch);
        echo "[NTLMStream::createBuffer] buffer size : ".strlen($this->buffer)."bytesn";
        $this->pos = 0;
    }
}


class ExchangeNTLMStream extends NTLMStream {
    protected $user = 'domain\user';
    protected $password = 'password';
}



$existed = in_array("https", stream_get_wrappers());

if ($existed) {
    stream_wrapper_unregister("https");

    stream_wrapper_register('https', 'ExchangeNTLMStream') or die("Failed to register protocol");
    $wsdl = "services.wsdl";
    $client = new ExchangeNTLMSoapClient($wsdl);

    /* Do something with the web service connection */
    stream_wrapper_restore('https');
    }
    else {
        stream_wrapper_register('https', 'ExchangeNTLMStream') or die("Failed to register protocol");
        $wsdl = "services.wsdl";
        $client = new ExchangeNTLMSoapClient($wsdl);
}

?>

Der Absturz erfolgt fast ganz unten bei dem Befehl: $client = new ExchangeNTLMSoapClient($wsdl);

Die php_soap.dll habe ich schon ausgetauscht, phpinfo() zeigt mir eigentlich auch alles korrekt an:

In der Version 4.1 lief das Skript fehlerfrei.
Kann das jemand mal versuchen nachzustellen, oder hat sogar eine Idee woran es liegen könnte?

Vielen Dank und Grüße
Strichcode

Sieht so aus, als hätte ich eine Lösung gefunden.
Das Problem scheint ein allgemeines PHP-Problem zu sein, siehe hier: https://lornajane.net/posts/2015/soapfault-when-switching-php-versions

Wenn ich am Anfang des Skriptes die folgende Zeile hinzufüge, läuft das Skript durch:

ini_set("soap.wsdl_cache_enabled", "0");

Vielleicht hilft es ja dem einen oder anderen…

Gruß und schöne Ostern,
Strichcode

Danke, mir hat es geholfen.

Grüße
galleto

Ich werde zum nächsten Update den Workaround standardmäßig mitliefern…

paresy