Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-9720: Null pointer dereference while serializing the response
When traversing the result array, we need to cater to `param_name` possibly being `NULL`. Prior to PHP 7.0.0, this was implicitly done because `param_name` was of type `char*`. Closes GH-9739.
- Loading branch information
Showing
4 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--TEST-- | ||
Bug GH-9720 (Null pointer dereference while serializing the response) | ||
--SKIPIF-- | ||
<?php require_once("skipif.inc"); ?> | ||
--FILE-- | ||
<?php | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
ini_set("soap.wsdl_cache_enabled", 0); | ||
|
||
class SoapService { | ||
function openSession($user) { | ||
return ["OK", "200"]; | ||
} | ||
} | ||
|
||
$server = new SoapServer(__DIR__ . '/gh9720.wsdl'); | ||
$server->setClass(SoapService::class); | ||
$request = <<<XML | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:soapService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> | ||
<SOAP-ENV:Body> | ||
<ns1:openSession> | ||
<user xsi:type="xsd:string">istoph</user> | ||
</ns1:openSession> | ||
</SOAP-ENV:Body> | ||
</SOAP-ENV:Envelope> | ||
XML; | ||
|
||
$server->handle($request); | ||
?> | ||
--EXPECT-- | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:soapService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:openSessionResponse><status xsi:type="xsd:string">OK</status><error_code xsi:type="xsd:string">200</error_code></ns1:openSessionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<definitions name="soapService" targetNamespace="urn:soapService" xmlns:typens="urn:soapService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> | ||
<message name="openSession"> | ||
<part name="user" type="xsd:string" /> | ||
</message> | ||
<message name="openSessionResponse"> | ||
<part name="status" type="xsd:string" /> | ||
<part name="error_code" type="xsd:string" /> | ||
</message> | ||
<portType name="soapServicePortType"> | ||
<operation name="openSession"> | ||
<documentation>Service Call: openSession</documentation> | ||
<input message="typens:openSession" /> | ||
<output message="typens:openSessionResponse" /> | ||
</operation> | ||
</portType> | ||
<binding name="soapServiceBinding" type="typens:soapServicePortType"> | ||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> | ||
<operation name="openSession"> | ||
<soap:operation soapAction="urn:openSession" /> | ||
<input> | ||
<soap:body namespace="urn:soapService" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> | ||
</input> | ||
<output> | ||
<soap:body namespace="urn:soapService" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> | ||
</output> | ||
</operation> | ||
</binding> | ||
<service name="soapServiceService"> | ||
<port name="soapServicePort" binding="typens:soapServiceBinding"> | ||
<soap:address location="###PHP_SELF###" /> | ||
</port> | ||
</service> | ||
</definitions> |