ID:               37850
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jeremiahh at allstardirectories dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         SOAP related
 Operating System: Linux
 PHP Version:      5.1.4
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------

[2006-06-19 18:00:06] jeremiahh at allstardirectories dot com

It is important to note that this bug only seems to happen in the case
where a single SoapHeader object is passed to __setSoapHeaders().  If
you pass an array of SoapHeaders, such as array(soapHeaderObj) then the
problem is non-existent.  When you pass it in an array the reference
counting happens automatically by the array constructor.

Also, this problem does not exist in the SoapHeader()::__call method
which correctly adds a reference when a single SoapHeader object is
passed:

ZVAL_ADDREF(headers);

------------------------------------------------------------------------

[2006-06-19 17:46:03] jeremiahh at allstardirectories dot com

Description:
------------
The undocumented method SoapClient::__setSoapHeaders() incorrectly
handles reference counting when a single SoapHeader object is passed.

Reproduce code:
---------------
function someMethod()
{
  $headers = new SoapHeader(...);
  $client = new SoapClient(...);
  $client->__setSoapHeaders($headers);

  $this->saved_client = $client;
}

function someOtherMethod()
{
  $client = $this->saved_client;
  $client->__soapCall(...);
}

Expected result:
----------------
For the code

$obj->someMethod();
$obj->someOtherMethod();

you would expect the call $client->__soapCall() to succeed with the
appropriate soap headers.

Actual result:
--------------
It crashes.  If one does a print_r($this->saved_client) in both methods
the problem is obvious.  The reference count for $headers is not
incremented in __setSoapHeaders() and so when  someMethod() finished
the object is destroyed while the SoapClient object is still
referencing it.  Then in someOtherMethod() the SoapHeader object is no
longer available.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37850&edit=1

Reply via email to