diff options
Diffstat (limited to 'ext/standard/streamsfuncs.c')
| -rw-r--r-- | ext/standard/streamsfuncs.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 6384478a6e..a1eddf63f2 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1038,6 +1038,34 @@ PHP_FUNCTION(stream_context_set_params) } /* }}} */ +/* {{{ proto bool stream_context_get_params(resource context|resource stream) + Get parameters of a file context */ +PHP_FUNCTION(stream_context_get_params) +{ + zval *zcontext, *options; + php_stream_context *context; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zcontext) == FAILURE) { + RETURN_FALSE; + } + + context = decode_context_param(zcontext TSRMLS_CC); + if (!context) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter"); + RETURN_FALSE; + } + + array_init(return_value); + if (context->notifier && context->notifier->ptr && context->notifier->func == user_space_stream_notifier) { + add_assoc_zval_ex(return_value, ZEND_STRS("notification"), context->notifier->ptr); + Z_ADDREF_P(context->notifier->ptr); + } + ALLOC_INIT_ZVAL(options); + ZVAL_ZVAL(options, context->options, 1, 0); + add_assoc_zval_ex(return_value, ZEND_STRS("options"), options); +} +/* }}} */ + /* {{{ proto resource stream_context_get_default([array options]) Get a handle on the default file/stream context and optionally set parameters */ PHP_FUNCTION(stream_context_get_default) |
