note 94490 modified in soapclient.dorequest by danbrown
| From: | danbrown@php.net | Date: | Sun, 08 Nov 2009 16:15:57 +0000 |
| Subject: | note 94490 modified in soapclient.dorequest by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162638@lists.php.net to get a copy of this message | ||
Beware of PHP incosistent behaviour in __doRequest() method. It seems that some arguments passed to
this method are passed by reference!
If you try to create your own __doRequest() method and store it's arguments as SoapClient
properties you will find that after __soapCall all of them will be null or unknown.
<?php
protected $__soapAction = '';
public function __doRequest($request, $location, $action, $version, $oneWay = 0) {
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
$this->__soapAction = $action;
return $response;
}
?>
In above example $this->__soapAction will be null after $obj->__soapCall()..
To store $action value, you must cast it to a string (so PHP will be forced to create a new variable
with different memory pointer):
<?php
public function __doRequest($request, $location, $action, $version, $oneWay = 0) {
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
$this->__soapAction = (string)$action;
return $response;
}
?>
--was--
Beware of PHP incosistent behaviour in __doRequest() method. It seems that some arguments passed to
this method are passed by reference!
If you try to create your own __doRequest() method and store it's arguments as SoapClient
properties you will find that after __soapCall all of them will be null or unknown.
protected $__soapAction = '';
public function __doRequest($request, $location, $action, $version, $oneWay = 0) {
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
$this->__soapAction = $action;
return $response;
}
In above example $this->__soapAction will be null after $obj->__soapCall()..
To store $action value, you must cast it to a string (so PHP will be forced to create a new variable
with different memory pointer):
public function __doRequest($request, $location, $action, $version, $oneWay = 0) {
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
$this->__soapAction = (string)$action;
return $response;
}
http://php.net/manual/en/soapclient.dorequest.php