Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix GH-20011: Array of SoapVar of unknown type causes crash #20030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nielsdos wants to merge 1 commit into php:PHP-8.3 from nielsdos:fix-20011
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ext/soap/php_encoding.c
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3584,6 +3584,11 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type)
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
}
cur_type = Z_LVAL_P(ztype);
if (cur_type == UNKNOWN_TYPE) {
/* Mimic guess_xml_convert() where we use the type of the data.
* UNDEFs are handled transparently as it will error out upon encoding the data. */
cur_type = Z_TYPE_P(Z_VAR_ENC_VALUE_P(tmp));
}

zval *zstype = Z_VAR_ENC_STYPE_P(tmp);
if (Z_TYPE_P(zstype) == IS_STRING) {
Expand Down
20 changes: 20 additions & 0 deletions ext/soap/tests/bugs/gh20011.phpt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
GH-20011 (Array of SoapVar of unknown type causes crash)
--EXTENSIONS--
soap
--FILE--
<?php
class TestSoapClient extends SoapClient {
public function __doRequest($request, $location, $action, $version, $one_way = false): ?string {
die($request);
}
}

$array = [new SoapVar('test string', NULL)];

$client = new TestSoapClient(NULL, ['location' => 'test://', 'uri' => 'http://soapinterop.org/']);
$client->echoStringArray($array);
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringArray><param0 SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">test string</item></param0></ns1:echoStringArray></SOAP-ENV:Body></SOAP-ENV:Envelope>
Loading

AltStyle によって変換されたページ (->オリジナル) /