Skip to content

Commit 15b208d

Browse files
committed
Replaced cli_webserver_workaround client option by a check of CONTENT_TYPE AND HTTP_CONTENT_TYPE entry in SERVER superglobal
1 parent fe67cff commit 15b208d

11 files changed

+19
-60
lines changed

src/BeSimple/SoapClient/SoapClient.php

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ class SoapClient extends \SoapClient
4141
*/
4242
protected $tracingEnabled = false;
4343

44-
/**
45-
* Work around missing header/php://input access in PHP cli webserver by
46-
* setting headers additionally as GET parameters and SOAP request body
47-
* explicitly as POST variable.
48-
*
49-
* @var boolean
50-
*/
51-
private $cliWebserverWorkaround = false;
52-
5344
/**
5445
* cURL instance.
5546
*
@@ -108,10 +99,7 @@ public function __construct($wsdl, array $options = array())
10899
if (isset($options['soap_version'])) {
109100
$this->soapVersion = $options['soap_version'];
110101
}
111-
// activate cli webserver workaround
112-
if (isset($options['cli_webserver_workaround'])) {
113-
$this->cliWebserverWorkaround = $options['cli_webserver_workaround'];
114-
}
102+
115103
$this->curl = new Curl($options);
116104

117105
if (isset($options['extra_options'])) {
@@ -158,25 +146,6 @@ private function __doHttpRequest(SoapRequest $soapRequest)
158146

159147
$location = $soapRequest->getLocation();
160148
$content = $soapRequest->getContent();
161-
/*
162-
* Work around missing header/php://input access in PHP cli webserver by
163-
* setting headers additionally as GET parameters and SOAP request body
164-
* explicitly as POST variable
165-
*/
166-
if ($this->cliWebserverWorkaround === true) {
167-
if (strpos($location, '?') === false) {
168-
$location .= '?';
169-
} else {
170-
$location .= '&';
171-
}
172-
$location .= SoapMessage::CONTENT_TYPE_HEADER.'='.urlencode($soapRequest->getContentType());
173-
$location .= '&';
174-
$location .= SoapMessage::SOAP_ACTION_HEADER.'='.urlencode($soapRequest->getAction());
175-
176-
$content = http_build_query(array('request' => $content));
177-
178-
$headers = array();
179-
}
180149

181150
$headers = $this->filterRequestHeaders($soapRequest, $headers);
182151

@@ -189,6 +158,7 @@ private function __doHttpRequest(SoapRequest $soapRequest)
189158
$headers,
190159
$options
191160
);
161+
192162
// tracing enabled: store last request header and body
193163
if ($this->tracingEnabled === true) {
194164
$this->lastRequestHeaders = $this->curl->getRequestHeaders();

src/BeSimple/SoapClient/Tests/ServerInterop/MTOMClient.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
'base64Binary' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\base64Binary',
1919
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
2020
),
21-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
2221
'connection_timeout' => 1,
2322
);
2423

src/BeSimple/SoapClient/Tests/ServerInterop/MtomServerInteropTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class MtomServerInteropTest extends TestCase
2020
'base64Binary' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\base64Binary',
2121
'AttachmentRequest' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\AttachmentRequest',
2222
),
23-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
2423
);
2524

2625
public function testAttachment()

src/BeSimple/SoapClient/Tests/ServerInterop/SwaClient.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
'uploadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFile',
2525
'uploadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFileResponse',
2626
),
27-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
2827
);
2928

3029
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $options);

src/BeSimple/SoapClient/Tests/ServerInterop/SwaServerInteropTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class SwaServerInteropTest extends TestCase
2323
'uploadFile' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFile',
2424
'uploadFileResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\uploadFileResponse',
2525
),
26-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
2726
);
2827

2928
public function testUploadDownloadText()

src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerClient.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
3232
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
3333
),
34-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
3534
);
3635

3736
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecuritySigEnc.wsdl', $options);

src/BeSimple/SoapClient/Tests/ServerInterop/WsSecuritySigEncServerInteropTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class WsSecuritySigEncServerInteropTest extends TestCase
3030
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
3131
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
3232
),
33-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
3433
);
3534

3635
public function testSigEnc()

src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerClient.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
2929
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
3030
),
31-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
3231
);
3332

3433
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $options);

src/BeSimple/SoapClient/Tests/ServerInterop/WsSecurityUserPassServerInteropTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class WsSecurityUserPassServerInteropTest extends TestCase
2929
'addBookResponse' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\addBookResponse',
3030
'BookInformation' => 'BeSimple\SoapClient\Tests\ServerInterop\Fixtures\BookInformation',
3131
),
32-
'cli_webserver_workaround' => true, // Work around missing header access in PHP cli webserver by setting headers additionally as GET parameters.
3332
);
3433

3534
public function testUserPassText()

src/BeSimple/SoapCommon/SoapMessage.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ abstract class SoapMessage
2828
*/
2929
const CONTENT_TYPE_HEADER = 'CONTENT_TYPE';
3030

31+
/**
32+
* $_SERVER key for 'Content-Type' header (with PHP cli-webserver)
33+
*
34+
* @var string
35+
*/
36+
const HTTP_CONTENT_TYPE_HEADER = 'HTTP_CONTENT_TYPE';
37+
3138
/**
3239
* $_SERVER key for 'SOAPAction' header.
3340
*

0 commit comments

Comments
 (0)