pollita         Thu Jun 26 21:32:26 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/standard       file.c 
  Log:
  MFH streamsfuncs.c r-1.22
  
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.27 php-src/ext/standard/file.c:1.279.2.28
--- php-src/ext/standard/file.c:1.279.2.27      Thu Jun 19 12:35:29 2003
+++ php-src/ext/standard/file.c Thu Jun 26 21:32:26 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.279.2.27 2003/06/19 16:35:29 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.28 2003/06/27 01:32:26 pollita Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -924,10 +924,6 @@
                parse_context_options(context, *tmp);
        }
 
-       if (ret != SUCCESS) {
-               php_stream_context_free(context);
-       }
-
        return ret;
 }
 
@@ -938,16 +934,20 @@
 {
        php_stream_context *context = NULL;
 
-       context = zend_fetch_resource(&contextresource TSRMLS_CC, -1, 
"Stream-Context", NULL, 1, le_stream_context);
+       context = zend_fetch_resource(&contextresource TSRMLS_CC, -1, NULL, NULL, 1, 
php_le_stream_context());
        if (context == NULL) {
                php_stream *stream;
 
-               php_stream_from_zval_no_verify(stream, &contextresource);
+               stream = zend_fetch_resource(&contextresource TSRMLS_CC, -1, NULL, 
NULL, 2, php_file_le_stream(), php_file_le_pstream);
 
                if (stream) {
                        context = stream->context;
-                       if (context == NULL)
+                       if (context == NULL) {
                                context = stream->context = php_stream_context_alloc();
+                               /* Register this magical context so that it'll
+                                  get cleaned up later. PHP5 does this more cleanly */
+                               ZEND_REGISTER_RESOURCE(NULL, context, 
php_le_stream_context());
+                       }
                }
        }
 



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

Reply via email to