diff options
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/openssl/xp_ssl.c | 4 | ||||
| -rw-r--r-- | ext/standard/file.c | 4 | ||||
| -rw-r--r-- | ext/standard/http_fopen_wrapper.c | 3 | ||||
| -rw-r--r-- | ext/standard/streamsfuncs.c | 21 |
4 files changed, 17 insertions, 15 deletions
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index d1d97940bf..3beefb6d23 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -556,7 +556,9 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_ xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+"); if (xparam->outputs.client) { - xparam->outputs.client->context = stream->context; + if (stream->context) { + zend_list_addref(stream->context->rsrc_id); + } } } diff --git a/ext/standard/file.c b/ext/standard/file.c index e8be7d92eb..af3a962fa3 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -884,10 +884,6 @@ PHP_NAMED_FUNCTION(php_if_fopen) } php_stream_to_zval(stream, return_value); - - if (zcontext) { - zend_list_addref(Z_RESVAL_P(zcontext)); - } } /* }}} */ diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 7382d38882..0140f2e94a 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -611,6 +611,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, if (location[0] != '\0') php_stream_notify_info(context, PHP_STREAM_NOTIFY_REDIRECTED, location, 0); + if (context) { /* keep the context for the next try */ + zend_list_addref(context->rsrc_id); + } php_stream_close(stream); stream = NULL; diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 6649ec4cd6..279dd09ca0 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -100,6 +100,10 @@ PHP_FUNCTION(stream_socket_client) context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + if (context) { + zend_list_addref(context->rsrc_id); + } + if (flags & PHP_STREAM_CLIENT_PERSISTENT) { spprintf(&hashkey, 0, "stream_socket_client__%s", host); } @@ -155,10 +159,7 @@ PHP_FUNCTION(stream_socket_client) } php_stream_to_zval(stream, return_value); - - if (zcontext) { - zend_list_addref(Z_RESVAL_P(zcontext)); - } + } /* }}} */ @@ -182,6 +183,10 @@ PHP_FUNCTION(stream_socket_server) } context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + + if (context) { + zend_list_addref(context->rsrc_id); + } if (zerrno) { zval_dtor(zerrno); @@ -220,10 +225,6 @@ PHP_FUNCTION(stream_socket_server) } php_stream_to_zval(stream, return_value); - - if (zcontext) { - zend_list_addref(Z_RESVAL_P(zcontext)); - } } /* }}} */ @@ -1032,7 +1033,7 @@ PHP_FUNCTION(stream_context_get_default) FG(default_context) = php_stream_context_alloc(); } context = FG(default_context); - + if (params) { parse_context_options(context, params TSRMLS_CC); } @@ -1062,7 +1063,7 @@ PHP_FUNCTION(stream_context_create) parse_context_params(context, params TSRMLS_CC); } - php_stream_context_to_zval(context, return_value); + RETURN_RESOURCE(context->rsrc_id); } /* }}} */ |
