Skip to content

ext/soap: Deprecate passing an int to SoapServer::addFunction() #15310

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

Merged
merged 2 commits into from
Aug 9, 2024
Merged
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
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ PHP NEWS
. INI settings session.sid_length and session.sid_bits_per_character are now
deprecated. (timwolla)

- SOAP:
. Passing an int to SoapServer::addFunction() is now deprecated.
If all PHP functions need to be provided flatten the array returned by
get_defined_functions(). (Girgias)
. The SOAP_FUNCTIONS_ALL constant is now deprecated. (Girgias)

- SPL:
. The SplFixedArray::__wakeup() method has been deprecated as it implements
__serialize() and __unserialize() which need to be overwritten instead.
Expand Down
8 changes: 8 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,14 @@ PHP 8.4 UPGRADE NOTES
hexadecimal session IDs and stop changing these two INI settings.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4

- SOAP:
. Passing an int to SoapServer::addFunction() is now deprecated.
If all PHP functions need to be provided flatten the array returned by
get_defined_functions().
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
. The SOAP_FUNCTIONS_ALL constant is now deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction

- SPL:
. The SplFixedArray::__wakeup() method has been deprecated as it implements
__serialize() and __unserialize() which need to be overwritten instead.
Expand Down
5 changes: 5 additions & 0 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,11 @@ PHP_METHOD(SoapServer, addFunction)
zend_string_release_ex(key, 0);
} else if (Z_TYPE_P(function_name) == IS_LONG) {
if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) {
php_error_docref(NULL, E_DEPRECATED, "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");
if (UNEXPECTED(EG(exception))) {
RETURN_THROWS();
}
if (service->soap_functions.ft != NULL) {
zend_hash_destroy(service->soap_functions.ft);
efree(service->soap_functions.ft);
Expand Down
1 change: 1 addition & 0 deletions ext/soap/soap.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ final class Sdl
/**
* @var int
* @cvalue SOAP_FUNCTIONS_ALL
* @deprecated since 8.4
*/
const SOAP_FUNCTIONS_ALL = UNKNOWN;

Expand Down
4 changes: 2 additions & 2 deletions ext/soap/soap_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion ext/soap/tests/server003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ EOF;
$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
--EXPECTF--
Deprecated: Constant SOAP_FUNCTIONS_ALL is deprecated in %s on line %d

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
<?xml version="1.0" encoding="UTF-8"?>
<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>
ok
Loading