From:             jeremiahh at allstardirectories dot com
Operating system: Linux
PHP version:      5.1.4
PHP Bug Type:     SOAP related
Bug description:  Reference counting bug in SoapClient::__setSoapHeaders()

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 bug report at http://bugs.php.net/?id=37850&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37850&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37850&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37850&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37850&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37850&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37850&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37850&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37850&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37850&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37850&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37850&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37850&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37850&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37850&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37850&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37850&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37850&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37850&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37850&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37850&r=mysqlcfg

Reply via email to