diff --git a/NEWS b/NEWS index ae8cf7dbb874..9a98aadadf82 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,10 @@ PHP NEWS Phar::addEmptyDir() for paths starting with "/.phar", while allowing non-magic directory names that merely share the ".phar" prefix. (Weilin Du) +- SOAP: + . Fixed bug GH-22218 (SoapServer::handle() crash on $_SERVER not being + an array). (David Carlier / Rex-Reynolds) + - Zlib: . Fixed memory leak if deflate initialization fails and there is a dict. (ndossche) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 5213928885b2..b7ed44929872 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1393,10 +1393,10 @@ PHP_METHOD(SoapServer, handle) return; } } - } - if ((soap_action_z = zend_hash_str_find(Z_ARRVAL_P(server_vars), ZEND_STRL("HTTP_SOAPACTION"))) != NULL && Z_TYPE_P(soap_action_z) == IS_STRING) { - soap_action = Z_STRVAL_P(soap_action_z); + if ((soap_action_z = zend_hash_str_find(Z_ARRVAL_P(server_vars), ZEND_STRL("HTTP_SOAPACTION"))) != NULL && Z_TYPE_P(soap_action_z) == IS_STRING) { + soap_action = Z_STRVAL_P(soap_action_z); + } } doc_request = soap_xmlParseFile("php://input"); diff --git a/ext/soap/tests/gh22218.phpt b/ext/soap/tests/gh22218.phpt new file mode 100644 index 000000000000..5b0714037a0a --- /dev/null +++ b/ext/soap/tests/gh22218.phpt @@ -0,0 +1,25 @@ +--TEST-- +GH-22218 (SoapServer::handle() segfault on non-array/unset $_SERVER) +--EXTENSIONS-- +soap +--CREDITS-- +Rex-Reynolds +--SKIPIF-- + +--POST-- + + + + + +--FILE-- + 'http://test-uri']); +$server->handle(); +?> +--EXPECTF-- +%AFunction 'test' doesn't exist%A