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

Fix GH-16237: Segmentation fault when cloning SoapServer

Bisect points to 94ee4f9, however this only reveals the problem.
Cloning an object on a lower branch and trying to call its methods
crashes as well. Cloning the object shouldn't be possible in the first
place because there's an engine constraint that when we have a new
object handler we should also have a clone handler. This constraint is
not fulfilled here.

Closes GH-16245.
This commit is contained in:
Niels Dossche
2024-10-05 12:40:08 +02:00
parent a3ff092c12
commit 809a58bc1b
3 changed files with 19 additions and 0 deletions

1
NEWS
View File

@@ -70,6 +70,7 @@ PHP NEWS
- SOAP:
. Fixed bug #62900 (Wrong namespace on xsd import error message). (nielsdos)
. Fixed bug GH-16237 (Segmentation fault when cloning SoapServer). (nielsdos)
- Standard:
. Fixed bug GH-15613 (overflow on unpack call hex string repeater).

View File

@@ -412,6 +412,7 @@ PHP_MINIT_FUNCTION(soap)
memcpy(&soap_server_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
soap_server_object_handlers.offset = XtOffsetOf(soap_server_object, std);
soap_server_object_handlers.free_obj = soap_server_object_free;
soap_server_object_handlers.clone_obj = NULL;
/* Register SoapFault class */
soap_fault_class_entry = register_class_SoapFault(zend_ce_exception);

View File

@@ -0,0 +1,17 @@
--TEST--
GH-16237 (Segmentation fault when cloning SoapServer)
--EXTENSIONS--
soap
--FILE--
<?php
$server = new SoapServer(null, ['uri'=>"http://testuri.org"]);
try {
clone $server;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Trying to clone an uncloneable object of class SoapServer