|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60329 New SoapClient keep_alive option
Submitted: 2011-11-18 13:18 UTC Modified: 2011-11-18 13:24 UTC
Avg. Score:4.4 ± 0.7
Reproduced:18 of 19 (94.7%)
Same Version:4 (22.2%)
Same OS:4 (22.2%)
From: Assigned:
Status: Open Package: SOAP related
PHP Version: 5.4.0RC1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [2011-11-18 13:18 UTC]
When using the SoapClient you may sometime have this error :

SoapClient::__doRequest(): send of 776 bytes failed with errno=32 Broken pipe

The problem is that some servers that you're calling are closing the connection 
after some time. To fix this problem you need to use the "Connection: close" 
HTTP Header. The only way to do it currently is to use a stream_context with the 
1.0 HTTP protocol version :

$socket_context = stream_context_create(
       array('http' => array('protocol_version'  => 1.0))
$soapClient = new \SOAPClient($serviceUrl, array('stream_context' => 

It would be nice to have a new option "keep_alive" that you can disable like 
this :

$soapClient = new \SOAPClient(ServiceUrl, array('keep_alive' => false));

Test script:
$soapClient = new \SOAPClient(ServiceUrl, array('keep_alive' => false));

Expected result:
Request with "Connection: close" header

Actual result:
Request with "Connection: Keep-alive" header


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-18 13:24 UTC]
Automatic comment from SVN on behalf of pierrick
Log: Added new SoapClient option "keep_alive". FR #60329
 [2011-11-18 13:24 UTC]
-Summary: New keep_alive option +Summary: New SoapClient keep_alive option -Status: Open +Status: To be documented
 [2011-11-18 13:24 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 18:01:31 2024 UTC