Skip to content

Fix GH-16237: Segmentation fault when cloning SoapServer #16245

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
wants to merge 1 commit into from
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
1 change: 1 addition & 0 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions ext/soap/tests/bugs/gh16237.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
GH-16237 (Segmentation fault when cloning SoapServer)
--EXTENSIONS--
soap
--FILE--
<?php

$server = new SoapServer(null, ['uri'=>"http://testuri.org"]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to connect to a server, the test should be marked as offline test. Otherwise, me may use an .invalid domain here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't connect to a server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I suggest to use an invalid domain per RFC 6761, sec. 6.4.

try {
clone $server;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Trying to clone an uncloneable object of class SoapServer
Loading