pollita         Sun Mar 26 04:40:11 2006 UTC

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       streamsfuncs.c 
  Log:
  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.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2109&r2=1.2110&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2109 php-src/NEWS:1.2110
--- php-src/NEWS:1.2109 Fri Mar 24 10:11:49 2006
+++ php-src/NEWS        Sun Mar 26 04:40:11 2006
@@ -43,6 +43,8 @@
   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)
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.71&r2=1.72&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.71 
php-src/ext/standard/streamsfuncs.c:1.72
--- php-src/ext/standard/streamsfuncs.c:1.71    Fri Mar 24 22:27:13 2006
+++ php-src/ext/standard/streamsfuncs.c Sun Mar 26 04:40:11 2006
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: streamsfuncs.c,v 1.71 2006/03/24 22:27:13 pollita Exp $ */
+/* $Id: streamsfuncs.c,v 1.72 2006/03/26 04:40:11 pollita Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -1103,21 +1103,25 @@
 }
 /* }}} */
 
-/* {{{ 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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to