mirror of
https://github.com/php/php-src.git
synced 2024-09-23 19:07:26 +00:00
Expand stream_context_create() to allow specifying params
as well as options. Ignore the internal name change of the first arg. The first arg is still for options, the second arg is for actual params.
This commit is contained in:
parent
c254b21cca
commit
a64789a452
2
NEWS
2
NEWS
@ -43,6 +43,8 @@ PHP NEWS
|
||||
the part of haystack before or after first occurence of needle. (Johannes)
|
||||
- Added possibility to check in which extension an internal function was
|
||||
defined using reflection API. (Johannes)
|
||||
- Added second optional parameter to stream_context_create() to set params
|
||||
during context creation. (Sara)
|
||||
- Fixed bug #36840 (Memory leak if cast operator throws an exception that is
|
||||
caught). (Dmitry)
|
||||
- Fixed bug #36630 (umask not reset at the end of the request). (Ilia)
|
||||
|
@ -1103,21 +1103,25 @@ PHP_FUNCTION(stream_context_get_default)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource stream_context_create([array options])
|
||||
/* {{{ proto resource stream_context_create([array options[, array params]])
|
||||
Create a file context and optionally set parameters */
|
||||
PHP_FUNCTION(stream_context_create)
|
||||
{
|
||||
zval *params = NULL;
|
||||
zval *options = NULL, *params = NULL;
|
||||
php_stream_context *context;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", ¶ms) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &options, ¶ms) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
context = php_stream_context_alloc();
|
||||
|
||||
if (options) {
|
||||
parse_context_options(context, options TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (params) {
|
||||
parse_context_options(context, params TSRMLS_CC);
|
||||
parse_context_params(context, params TSRMLS_CC);
|
||||
}
|
||||
|
||||
php_stream_context_to_zval(context, return_value);
|
||||
|
Loading…
Reference in New Issue
Block a user