From 821b603ec272d3116db44656333c655fa49fbd92 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 27 Jun 2003 01:32:26 +0000 Subject: [PATCH] MFH streamsfuncs.c r-1.22 --- ext/standard/file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index f783c43cac..c77aaa0018 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -924,10 +924,6 @@ static int parse_context_params(php_stream_context *context, zval *params) parse_context_options(context, *tmp); } - if (ret != SUCCESS) { - php_stream_context_free(context); - } - return ret; } @@ -938,16 +934,20 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC) { 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()); + } } } -- 2.40.0