1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix GH-16259: Soap segfault when classmap instantiation fails
This commit is contained in:
Niels Dossche
2024-10-07 17:43:10 +02:00
3 changed files with 40 additions and 5 deletions

2
NEWS
View File

@@ -106,6 +106,8 @@ PHP NEWS
. Fix Soap leaking http_msg on error. (nielsdos)
. Fixed bug GH-16256 (Assertion failure in ext/soap/php_encoding.c:460).
(nielsdos)
. Fixed bug GH-16259 (Soap segfault when classmap instantiation fails).
(nielsdos)
- Standard:
. Fixed bug GH-16053 (Assertion failure in Zend/zend_hash.c). (Arnaud)

View File

@@ -1457,7 +1457,9 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
return ret;
}
object_init_ex(ret, ce);
if (object_init_ex(ret, ce) != SUCCESS) {
return ret;
}
master_to_zval_int(&base, enc, data);
set_zval_property(ret, "_", &base);
} else {
@@ -1466,7 +1468,9 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
if (soap_check_xml_ref(ret, data)) {
return ret;
}
object_init_ex(ret, ce);
if (object_init_ex(ret, ce) != SUCCESS) {
return ret;
}
soap_add_xml_ref(ret, data);
}
} else if (sdlType->kind == XSD_TYPEKIND_EXTENSION &&
@@ -1511,7 +1515,9 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
return ret;
}
object_init_ex(ret, ce);
if (object_init_ex(ret, ce) != SUCCESS) {
return ret;
}
soap_add_xml_ref(ret, data);
master_to_zval_int(&base, sdlType->encode, data);
set_zval_property(ret, "_", &base);
@@ -1522,7 +1528,9 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
if (soap_check_xml_ref(ret, data)) {
return ret;
}
object_init_ex(ret, ce);
if (object_init_ex(ret, ce) != SUCCESS) {
return ret;
}
soap_add_xml_ref(ret, data);
}
if (sdlType->model) {
@@ -1582,7 +1590,9 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
return ret;
}
object_init_ex(ret, ce);
if (object_init_ex(ret, ce) != SUCCESS) {
return ret;
}
soap_add_xml_ref(ret, data);
trav = data->children;

View File

@@ -0,0 +1,23 @@
--TEST--
GH-16259 (Soap segfault when classmap instantiation fails)
--EXTENSIONS--
soap
--FILE--
<?php
abstract class CT_A1 {
}
class CT_A2 extends CT_A1 {
}
$classMap = array("A1" => "CT_A1", "A2" => "CT_A2");
$client = new SoapClient(__DIR__."/bug36575.wsdl", array("trace" => 1, "exceptions" => 0));
$a2 = new CT_A2();
$client->test($a2);
$soapRequest = $client->__getLastRequest();
$server = new SoapServer(__DIR__."/bug36575.wsdl", array("classmap" => $classMap));
$server->handle($soapRequest);
?>
--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:Server</faultcode><faultstring>Cannot instantiate abstract class CT_A1</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>