summaryrefslogtreecommitdiff
path: root/ext/standard/streamsfuncs.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-08-07 15:55:37 +0400
committerDmitry Stogov <dmitry@zend.com>2014-08-07 15:55:37 +0400
commit417ed16d11d2d7376b1a74028c42cd87818bfffb (patch)
tree98a9d9001152ff8e24d7407416476b32b2b7612c /ext/standard/streamsfuncs.c
parent414762fc12acef00733121ae515c9aba32e8bce3 (diff)
downloadphp-git-417ed16d11d2d7376b1a74028c42cd87818bfffb.tar.gz
Make stream->context indirect trough zend_resource (stream->ctx->ptr).
Fixed ext/standard/tests/streams/bug61115.phpt
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r--ext/standard/streamsfuncs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index fe51f48d52..9ba10edb13 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -40,7 +40,7 @@ typedef unsigned long long php_timeout_ull;
typedef unsigned __int64 php_timeout_ull;
#endif
-#define GET_CTX_OPT(stream, wrapper, name, val) (stream->context && NULL != (val = php_stream_context_get_option(stream->context, wrapper, name)))
+#define GET_CTX_OPT(stream, wrapper, name, val) (PHP_STREAM_CONTEXT(stream) && NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), wrapper, name)))
static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC);
@@ -939,13 +939,14 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC)
stream = zend_fetch_resource(contextresource TSRMLS_CC, -1, NULL, NULL, 2, php_file_le_stream(), php_file_le_pstream);
if (stream) {
- context = stream->context;
+ context = PHP_STREAM_CONTEXT(stream);
if (context == NULL) {
/* Only way this happens is if file is opened with NO_DEFAULT_CONTEXT
param, but then something is called which requires a context.
Don't give them the default one though since they already said they
didn't want it. */
- context = stream->context = php_stream_context_alloc(TSRMLS_C);
+ context = php_stream_context_alloc(TSRMLS_C);
+ stream->ctx = context->res;
}
}
}