]> granicus.if.org Git - php/commitdiff
Add context property to userspace streams object.
authorSara Golemon <pollita@php.net>
Mon, 16 Jun 2003 19:13:39 +0000 (19:13 +0000)
committerSara Golemon <pollita@php.net>
Mon, 16 Jun 2003 19:13:39 +0000 (19:13 +0000)
NEWS
main/streams/userspace.c

diff --git a/NEWS b/NEWS
index a5f496e2b860512c222314186362ff82c41dd5a5..2f60f090aa0961ad0b6eb76fa4650d6a04e62b4a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ PHP                                                                        NEWS
   . "mail.force_extra_paramaters". (Derick)
 
 - Improved streams support: (Wez)
+  . Added context property to userspace streams object. (sara)
   . stream_socket_client() - similar to fsockopen(), but more powerful. 
   . stream_socket_server() - Creates a server socket. 
   . stream_socket_accept() - Accept a client connection.
index 9b1f9418c8e0ede53547a6f3117a5b2b90150452..7ef9a0bcacd94b6b7fd1059d3b007ff48bd10f24 100644 (file)
@@ -185,6 +185,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena
        zval **args[4]; 
        int call_result;
        php_stream *stream = NULL;
+       zval *zcontext = NULL;
 
        /* Try to catch bad usage without preventing flexibility */
        if (FG(user_stream_current_filename) != NULL && strcmp(filename, FG(user_stream_current_filename)) == 0) {
@@ -201,6 +202,17 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena
        object_init_ex(us->object, uwrap->ce);
        ZVAL_REFCOUNT(us->object) = 1;
        PZVAL_IS_REF(us->object) = 1;
+
+       if (context) {
+               MAKE_STD_ZVAL(zcontext);
+               php_stream_context_to_zval(context, zcontext);
+               add_property_zval(us->object, "context", zcontext);
+               /* The object property should be the only reference,
+                  'get rid' of our local reference. */
+               zval_ptr_dtor(&zcontext);
+       } else {
+               add_property_null(us->object, "context");
+       }
        
        /* call it's stream_open method - set up params first */
        MAKE_STD_ZVAL(zfilename);