Skip to content

Commit 42497c1

Browse files
authored
ext/soap: Deprecate passing an int to SoapServer::addFunction() (#15310)
Also deprecate SOAP_FUNCTIONS_ALL constant. RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
1 parent cbcad9f commit 42497c1

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

NEWS

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ PHP NEWS
4545
. INI settings session.sid_length and session.sid_bits_per_character are now
4646
deprecated. (timwolla)
4747

48+
- SOAP:
49+
. Passing an int to SoapServer::addFunction() is now deprecated.
50+
If all PHP functions need to be provided flatten the array returned by
51+
get_defined_functions(). (Girgias)
52+
. The SOAP_FUNCTIONS_ALL constant is now deprecated. (Girgias)
53+
4854
- SPL:
4955
. The SplFixedArray::__wakeup() method has been deprecated as it implements
5056
__serialize() and __unserialize() which need to be overwritten instead.

UPGRADING

+8
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,14 @@ PHP 8.4 UPGRADE NOTES
473473
hexadecimal session IDs and stop changing these two INI settings.
474474
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
475475

476+
- SOAP:
477+
. Passing an int to SoapServer::addFunction() is now deprecated.
478+
If all PHP functions need to be provided flatten the array returned by
479+
get_defined_functions().
480+
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
481+
. The SOAP_FUNCTIONS_ALL constant is now deprecated.
482+
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
483+
476484
- SPL:
477485
. The SplFixedArray::__wakeup() method has been deprecated as it implements
478486
__serialize() and __unserialize() which need to be overwritten instead.

ext/soap/soap.c

+5
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,11 @@ PHP_METHOD(SoapServer, addFunction)
12061206
zend_string_release_ex(key, 0);
12071207
} else if (Z_TYPE_P(function_name) == IS_LONG) {
12081208
if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) {
1209+
php_error_docref(NULL, E_DEPRECATED, "Enabling all functions via SOAP_FUNCTIONS_ALL is deprecated since 8.4, due to possible security concerns."
1210+
" If all PHP functions should be enabled, the flattened return value of get_defined_functions() can be used");
1211+
if (UNEXPECTED(EG(exception))) {
1212+
RETURN_THROWS();
1213+
}
12091214
if (service->soap_functions.ft != NULL) {
12101215
zend_hash_destroy(service->soap_functions.ft);
12111216
efree(service->soap_functions.ft);

ext/soap/soap.stub.php

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ final class Sdl
4444
/**
4545
* @var int
4646
* @cvalue SOAP_FUNCTIONS_ALL
47+
* @deprecated since 8.4
4748
*/
4849
const SOAP_FUNCTIONS_ALL = UNKNOWN;
4950

ext/soap/soap_arginfo.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/soap/tests/server003.phpt

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ EOF;
2626
$server->handle($HTTP_RAW_POST_DATA);
2727
echo "ok\n";
2828
?>
29-
--EXPECT--
29+
--EXPECTF--
30+
Deprecated: Constant SOAP_FUNCTIONS_ALL is deprecated in %s on line %d
31+
32+
Deprecated: SoapServer::addFunction(): Enabling all functions via SOAP_FUNCTIONS_ALL is deprecated since 8.4, due to possible security concerns. If all PHP functions should be enabled, the flattened return value of get_defined_functions() can be used in %s on line %d
3033
<?xml version="1.0" encoding="UTF-8"?>
3134
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:strlenResponse><return xsi:type="xsd:int">11</return></ns1:strlenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
3235
ok

0 commit comments

Comments
 (0)