note 94490 added to soapclient.dorequest

From: Date: Sun, 08 Nov 2009 12:35:51 +0000
Subject: note 94490 added to soapclient.dorequest
Groups: php.notes 
Request: Send a blank email to php-notes+get-162630@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. 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; } ---- Server IP: 194.24.174.37 Probable Submitter: 82.210.157.150 ---- Manual Page -- http://www.php.net/manual/en/soapclient.dorequest.php Edit -- https://master.php.net/note/edit/94490 Del: integrated -- https://master.php.net/note/delete/94490/integrated Del: useless -- https://master.php.net/note/delete/94490/useless Del: bad code -- https://master.php.net/note/delete/94490/bad+code Del: spam -- https://master.php.net/note/delete/94490/spam Del: non-english -- https://master.php.net/note/delete/94490/non-english Del: in docs -- https://master.php.net/note/delete/94490/in+docs Del: other reasons-- https://master.php.net/note/delete/94490 Reject -- https://master.php.net/note/reject/94490 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#162630) next »