PHP SOAP and signal Segmentation fault

I'm using wsdl2php to generate php class service and it has always worked very well.

Today I wanted to add a SoapHeader in this manner:

public function __construct($options = array()) {
    parent::__construct($this->wsdl, $options);
    $header = new SoapHeader($this->namespace, 'UserCredentials',
                            new UserCredentials($this->username, $this->password), false);
    $this->__setSoapHeaders($header);
 }

Blank page on the browser and this message in the /var/log/error_log:

[Mon Mar 26 14:53:21 2012] [notice] child pid 15880 exit signal Segmentation fault (11)
Luckily I found the solution on Stackoverflow and with this simple change to my code, now it works:

private $_myHeader;
public function __construct($options = array()) {
    parent::__construct($this->wsdl, $options);
    $this->$_myHeader = new SoapHeader($this->namespace, 'UserCredentials',
                            new UserCredentials($this->username, $this->password), false);
    $this->__setSoapHeaders($this->$_myHeader);
}

    

Commenti