Skip to content

Commit 95b5b48

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix GH-22218: SoapServer::handle() crash on non-array `$_SERVER`.
2 parents ecd6cd8 + 80d580b commit 95b5b48

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

ext/soap/soap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,10 +1413,10 @@ PHP_METHOD(SoapServer, handle)
14131413
return;
14141414
}
14151415
}
1416-
}
14171416

1418-
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) {
1419-
soap_action = Z_STRVAL_P(soap_action_z);
1417+
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) {
1418+
soap_action = Z_STRVAL_P(soap_action_z);
1419+
}
14201420
}
14211421

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

ext/soap/tests/gh22218.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
GH-22218 (SoapServer::handle() segfault on non-array/unset $_SERVER)
3+
--EXTENSIONS--
4+
soap
5+
--CREDITS--
6+
Rex-Reynolds
7+
--SKIPIF--
8+
<?php
9+
if (php_sapi_name() == 'cli') echo 'skip needs request body (POST)';
10+
?>
11+
--POST--
12+
<SOAP-ENV:Envelope
13+
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
14+
<SOAP-ENV:Body>
15+
<test/>
16+
</SOAP-ENV:Body>
17+
</SOAP-ENV:Envelope>
18+
--FILE--
19+
<?php
20+
$_SERVER = 79;
21+
$server = new SoapServer(null, ['uri' => 'http://test-uri']);
22+
$server->handle();
23+
?>
24+
--EXPECTF--
25+
%AFunction 'test' doesn't exist%A

0 commit comments

Comments
 (0)