Skip to content

Commit a44256b

Browse files
committed
Move the HTTP_SOAPACTION lookup inside the existing $_SERVER NULL/array
guard; it dereferenced server_vars unconditionally, crashing when $_SERVER was unset or a scalar.
1 parent 6a68331 commit a44256b

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ PHP NEWS
1616
Phar::addEmptyDir() for paths starting with "/.phar", while allowing
1717
non-magic directory names that merely share the ".phar" prefix. (Weilin Du)
1818

19+
- SOAP:
20+
. Fixed bug GH-22218 (SoapServer::handle() crash on $_SERVER not being
21+
an array). (David Carlier / Rex-Reynolds)
22+
1923
- Zlib:
2024
. Fixed memory leak if deflate initialization fails and there is a dict.
2125
(ndossche)

ext/soap/soap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,10 +1393,10 @@ PHP_METHOD(SoapServer, handle)
13931393
return;
13941394
}
13951395
}
1396-
}
13971396

1398-
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) {
1399-
soap_action = Z_STRVAL_P(soap_action_z);
1397+
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) {
1398+
soap_action = Z_STRVAL_P(soap_action_z);
1399+
}
14001400
}
14011401

14021402
doc_request = soap_xmlParseFile("php://input");

ext/soap/tests/gh22218.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ if (php_sapi_name() == 'cli') echo 'skip needs request body (POST)';
2020
$_SERVER = 79;
2121
$server = new SoapServer(null, ['uri' => 'http://test-uri']);
2222
$server->handle();
23-
echo "ALIVE\n";
2423
?>
2524
--EXPECTF--
26-
%A
27-
ALIVE
25+
%AFunction 'test' doesn't exist%A

0 commit comments

Comments
 (0)