mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Deprecate calling stream_context_set_option() with 2 arguments
This commit is contained in:
@@ -177,6 +177,10 @@ PHP 8.4 UPGRADE NOTES
|
||||
. Calling session_set_save_handler() with more than 2 arguments is
|
||||
deprecated. Use the 2-parameter signature instead.
|
||||
|
||||
- Standard:
|
||||
. Calling stream_context_set_option() with 2 arguments is deprecated.
|
||||
Use stream_context_set_options() instead.
|
||||
|
||||
========================================
|
||||
5. Changed Functions
|
||||
========================================
|
||||
|
||||
@@ -1021,6 +1021,15 @@ PHP_FUNCTION(stream_context_set_option)
|
||||
size_t optionname_len;
|
||||
zval *zvalue = NULL;
|
||||
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
zend_error(E_DEPRECATED, "Calling stream_context_set_option() with 2 arguments is deprecated, "
|
||||
"use stream_context_set_options() instead"
|
||||
);
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(2, 4)
|
||||
Z_PARAM_RESOURCE(zcontext)
|
||||
Z_PARAM_ARRAY_HT_OR_STR(options, wrappername)
|
||||
|
||||
@@ -21,8 +21,10 @@ var_dump(stream_context_set_option($context, $options));
|
||||
|
||||
var_dump(stream_context_get_options($context));
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Deprecated: Calling stream_context_set_option() with 2 arguments is deprecated, use stream_context_set_options() instead in %s on line %d
|
||||
bool(true)
|
||||
array(1) {
|
||||
["http"]=>
|
||||
|
||||
@@ -26,8 +26,10 @@ try {
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
stream_context_set_option(): Argument #3 ($option_name) must be null when argument #2 ($wrapper_or_options) is an array
|
||||
stream_context_set_option(): Argument #4 ($value) cannot be provided when argument #2 ($wrapper_or_options) is an array
|
||||
|
||||
Deprecated: Calling stream_context_set_option() with 2 arguments is deprecated, use stream_context_set_options() instead in %s on line %d
|
||||
stream_context_set_option(): Argument #3 ($option_name) cannot be null when argument #2 ($wrapper_or_options) is a string
|
||||
stream_context_set_option(): Argument #4 ($value) must be provided when argument #2 ($wrapper_or_options) is a string
|
||||
|
||||
Reference in New Issue
Block a user