]> granicus.if.org Git - php/commitdiff
MFH: Add "params" argument to stream_context_create()
authorHannes Magnusson <bjori@php.net>
Mon, 14 Apr 2008 08:15:11 +0000 (08:15 +0000)
committerHannes Magnusson <bjori@php.net>
Mon, 14 Apr 2008 08:15:11 +0000 (08:15 +0000)
NEWS
ext/standard/streamsfuncs.c

diff --git a/NEWS b/NEWS
index bf0413a2f43efcf57c38571c703d89a4ae7690f5..0ee8a8b6020764f81caf0b6f37d20ab75ed82f0e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -130,6 +130,7 @@ PHP                                                                        NEWS
   . Added "ignore_errors" option to http fopen wrapper. (David Zulke, Sara)
   . Added context parameter for copy() function. (Sara)
   . Added "glob" stream wrapper. (Marcus)
+  . Added "params" as optional parameter for stream_context_create(). (Sara)
 - Improved ext/soap to support element names in context of XMLShema's <any>.
   (Dmitry)
 - Improved ext/openssl: (Dmitry)
@@ -158,7 +159,7 @@ PHP                                                                        NEWS
 - Fixed bug #44214 (Crash using preg_replace_callback() and global variable).
   (Nuno, Scott)
 - Fixed bug #43960 (strtotime() returns timestamp in the future when given a
-  bogus string).
+  bogus string). (Derick)
 - Fixed bug #43832 (mysqli_get_charset() doesn't expose charset comment).
   (Andrey)
 - Fixed bug #43808 (date_create never fails (even when it should)). (Derick)
index a2d3f773118d6e8805f7c65bb3dcd4ae8494e316..d8f39fe638f2f581c075d16dc9b46b0e243dcdf3 100644 (file)
@@ -1041,21 +1041,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", &params) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!a!", &options, &params) == 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);