Fix bug #61525: SOAP functions require at least one space after HTTP header colon

HTTP/1.1 does not require a single whitespace after the colon, and
SoapServer does implement HTTP/1.1. The header value is already correctly
whitespace-trimmed, so no behaviour change happens w.r.t. header values.

Closes GH-15793.
This commit is contained in:
Niels Dossche 2024-09-08 00:06:22 +02:00
parent 0f3b2e506b
commit 7771ec07e5
No known key found for this signature in database
GPG key ID: A17A7C526FE17078
3 changed files with 49 additions and 12 deletions

4
NEWS
View file

@ -49,6 +49,10 @@ PHP NEWS
. Fixed bug GH-15718 (Segfault on ReflectionProperty::get{Hook,Hooks}() on
dynamic properties). (DanielEScherzer)
- SOAP:
. Fixed bug #61525 (SOAP functions require at least one space after HTTP
header colon). (nielsdos)
- Standard:
. Fixed bug GH-15552 (Signed integer overflow in ext/standard/scanf.c). (cmb)
. Implemented GH-15685 (improve proc_open error reporting on Windows). (cmb)

View file

@ -0,0 +1,33 @@
--TEST--
Bug #61525 (SOAP functions require at least one space after HTTP header colon)
--EXTENSIONS--
soap
--SKIPIF--
<?php
if (@!include __DIR__."/../../../standard/tests/http/server.inc") die('skip server.inc not available');
http_server_skipif();
?>
--FILE--
<?php
require __DIR__."/../../../standard/tests/http/server.inc";
$response = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:AddResponse>
<return xsi:type="xsd:int">7</return>
</ns1:AddResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML;
$length = strlen($response);
$server_response = "data://text/xml;base64," . base64_encode("HTTP/1.1 200 OK\r\nConnection:close\r\nContent-Length:$length\r\n\r\n$response");
['pid' => $pid, 'uri' => $uri] = http_server([$server_response]);
$client = new SoapClient(NULL, ['location' => $uri, 'uri' => $uri]);
var_dump($client->Add(3, 4));
http_server_kill($pid);
?>
--EXPECT--
int(7)