[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Tue, 24 Nov 2026 10:20:57 +0000
Subject: [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144090@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-11-24T11:13:34+01:00 Commit: https://github.com/php/php-src/commit/ee66611f6ebd6286acf45f177f09c2a5a3d8a2ac Raw diff: https://github.com/php/php-src/commit/ee66611f6ebd6286acf45f177f09c2a5a3d8a2ac.diff Merge branch 'PHP-8.5' into PHP-8.6 # Conflicts: # NEWS Changed paths: A ext/soap/tests/soapaction_empty_body_header.phpt A ext/soap/tests/soapaction_empty_body_header.wsdl A ext/soap/tests/soapaction_empty_body_rpc.phpt A ext/soap/tests/soapaction_empty_body_rpc_params.phpt A ext/soap/tests/soapaction_empty_body_rpc_soap12.phpt M NEWS M ext/soap/soap.c Diff: diff --git a/NEWS b/NEWS index b3e69ae2a354..ec4638803c11 100644 --- a/NEWS +++ b/NEWS @@ -203,6 +203,8 @@ PHP NEWS (lazerg) . Fixed bug GH-25303 (NULL encoder dereference in to_xml_list() error message). (lazerg) + . Fixed NULL dereference in SoapServer::handle() with an empty Body and a + SOAPAction matching an RPC operation. (Jorg Sowa) - Sockets: . Fixed bug GH-25530 (socket_last_error() without a socket returns an error diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 486e56897319..bb2856576dd7 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -3587,13 +3587,16 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c } } - if (function && function->binding && function->binding->bindingType == BINDING_SOAP) { - sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes; - if (fnb->style == SOAP_RPC) { + /* func is NULL when the function was resolved via SOAPAction and the Body is empty */ + if (func) { + if (function && function->binding && function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes; + if (fnb->style == SOAP_RPC) { + func = func->children; + } + } else { func = func->children; } - } else { - func = func->children; } deserialize_parameters(func, function, num_params, parameters); diff --git a/ext/soap/tests/soapaction_empty_body_header.phpt b/ext/soap/tests/soapaction_empty_body_header.phpt new file mode 100644 index 000000000000..8b2aad16d3cd --- /dev/null +++ b/ext/soap/tests/soapaction_empty_body_header.phpt @@ -0,0 +1,35 @@ +--TEST-- +SoapServer::handle() with Header, empty Body and SOAPAction matching an RPC operation +--EXTENSIONS-- +soap +--INI-- +soap.wsdl_cache_enabled=0 +--POST-- +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org"> + <SOAP-ENV:Header> + <ns1:Auth SOAP-ENV:mustUnderstand="1">secret</ns1:Auth> + </SOAP-ENV:Header> + <SOAP-ENV:Body/> +</SOAP-ENV:Envelope> +--FILE-- +<?php +class Service { + private string $auth = 'none'; + + public function Auth($value) { + $this->auth = $value; + } + + public function test() { + return "auth: " . $this->auth; + } +} + +$server = new SoapServer(__DIR__.'/soapaction_empty_body_header.wsdl'); +$server->setObject(new Service()); +$_SERVER["HTTP_SOAPACTION"] = "Test"; +$server->handle(); +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org"><SOAP-ENV:Body><ns1:testResponse><result>auth: secret</result></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/soapaction_empty_body_header.wsdl b/ext/soap/tests/soapaction_empty_body_header.wsdl new file mode 100644 index 000000000000..1e62ef6ea847 --- /dev/null +++ b/ext/soap/tests/soapaction_empty_body_header.wsdl @@ -0,0 +1,44 @@ +<?xml version="1.0" ?> +<definitions + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://testuri.org" + xmlns="http://schemas.xmlsoap.org/wsdl/" + targetNamespace="http://testuri.org"> + + <message name="AuthHeader"> + <part name="Auth" type="xsd:string" /> + </message> + <message name="TestRequest"> + </message> + <message name="TestResponse"> + <part name="result" type="xsd:string" /> + </message> + + <portType name="TestServicePortType"> + <operation name="test"> + <input message="tns:TestRequest" /> + <output message="tns:TestResponse" /> + </operation> + </portType> + + <binding name="TestServiceBinding" type="tns:TestServicePortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> + <operation name="test"> + <soap:operation soapAction="Test" style="rpc" /> + <input> + <soap:body namespace="http://testuri.org" use="literal" /> + <soap:header namespace="http://testuri.org" message="tns:AuthHeader" part="Auth" use="literal" /> + </input> + <output> + <soap:body namespace="http://testuri.org" use="literal" /> + </output> + </operation> + </binding> + + <service name="TestService"> + <port name="TestServicePort" binding="tns:TestServiceBinding"> + <soap:address location="http://localhost/" /> + </port> + </service> +</definitions> diff --git a/ext/soap/tests/soapaction_empty_body_rpc.phpt b/ext/soap/tests/soapaction_empty_body_rpc.phpt new file mode 100644 index 000000000000..a43611b26551 --- /dev/null +++ b/ext/soap/tests/soapaction_empty_body_rpc.phpt @@ -0,0 +1,24 @@ +--TEST-- +SoapServer::handle() with empty Body and SOAPAction matching an RPC operation +--EXTENSIONS-- +soap +--INI-- +soap.wsdl_cache_enabled=0 +--POST-- +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> + <SOAP-ENV:Body/> +</SOAP-ENV:Envelope> +--FILE-- +<?php +function getItems() { + return []; +} + +$server = new SoapServer(__DIR__.'/server030.wsdl'); +$server->addFunction("getItems"); +$_SERVER["HTTP_SOAPACTION"] = "http://testuri.orgTestServiceAction"; +$server->handle(); +?> +--EXPECT-- +<?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:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getItemsResponse><getItemsReturn SOAP-ENC:arrayType="ns1:Item[0]" xsi:type="ns1:ItemArray"/></ns1:getItemsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/soapaction_empty_body_rpc_params.phpt b/ext/soap/tests/soapaction_empty_body_rpc_params.phpt new file mode 100644 index 000000000000..738e8f86e76d --- /dev/null +++ b/ext/soap/tests/soapaction_empty_body_rpc_params.phpt @@ -0,0 +1,24 @@ +--TEST-- +SoapServer::handle() with empty Body and SOAPAction matching an RPC operation with parameters +--EXTENSIONS-- +soap +--INI-- +soap.wsdl_cache_enabled=0 +--POST-- +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> + <SOAP-ENV:Body/> +</SOAP-ENV:Envelope> +--FILE-- +<?php +function Add($x, $y) { + return $x + $y; +} + +$server = new SoapServer(__DIR__.'/test.wsdl'); +$server->addFunction("Add"); +$_SERVER["HTTP_SOAPACTION"] = "Add"; +$server->handle(); +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Missing parameter</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/soapaction_empty_body_rpc_soap12.phpt b/ext/soap/tests/soapaction_empty_body_rpc_soap12.phpt new file mode 100644 index 000000000000..7b2364fedee1 --- /dev/null +++ b/ext/soap/tests/soapaction_empty_body_rpc_soap12.phpt @@ -0,0 +1,24 @@ +--TEST-- +SoapServer::handle() with empty SOAP 1.2 Body and SOAPAction matching an RPC operation with parameters +--EXTENSIONS-- +soap +--INI-- +soap.wsdl_cache_enabled=0 +--POST-- +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> + <env:Body/> +</env:Envelope> +--FILE-- +<?php +function Add($x, $y) { + return $x + $y; +} + +$server = new SoapServer(__DIR__.'/test.wsdl', ['soap_version' => SOAP_1_2]); +$server->addFunction("Add"); +$_SERVER["HTTP_SOAPACTION"] = "Add"; +$server->handle(); +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text xml:lang="en">Missing parameter</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>

« previous php.cvs (#144090) next »