php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68069 Overwriting HTTP headers with stream_context_create
Submitted: 2014-09-22 08:27 UTC Modified: -
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: stereoshoots at gmail dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.5.17 OS: FreeBSD
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stereoshoots at gmail dot com
New email:
PHP Version: OS:

 

 [2014-09-22 08:27 UTC] stereoshoots at gmail dot com
Description:
------------
stream_context_create dont overwrite HTTP headers. I'm trying to overwrite my content-type, but its not being overwrited.

Test script:
---------------
arrHttpHeaders = array(
	'http' => array(
	'header' => 'Content-Type: application/soap+xml; charset=utf-8\r\n
		     Warning: Test warning'
	)
);
$streamContext = stream_context_create($arrHttpHeaders);
				
$arrConfig = array_merge(
	self::getSoapClientConfiguration(), 
	array(
	    'local_cert' => self::getAuthCertificatePath(),
	    'passphrase' => self::getAuthCertificatePassphrase(),
	    'stream_context' => $streamContext
        )
);
				
self::$objSoapClient = new SoapClient(
	self::getSoapClientWsdlPath(), 
	$arrConfig
);

Expected result:
----------------
POST **** HTTP/1.1
Host: ****
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.5.16
Content-Type: application/soap+xml; charset=utf-8
SOAPAction: ***
Content-Length: 234
Warning: Test warning

Actual result:
--------------
POST **** HTTP/1.1
Host: ****
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.5.16
Content-Type: text/xml; charset=utf-8
SOAPAction: ***
Content-Length: 234
Warning: Test warning

Patches

Pull Requests

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 12 20:01:32 2025 UTC