Skip to content

Commit 30785ad

Browse files
committed
stream: set context for opened streams
This is limited to non persistent streams to be safe. If it shows problematic for BC reasons, it should be limited to only some context (e.g. if error options set).
1 parent b7d0897 commit 30785ad

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

main/streams/streams.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,9 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
21852185
stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
21862186
stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
21872187
#endif
2188+
if (stream->ctx == NULL && context != NULL && !persistent) {
2189+
php_stream_context_set(stream, context);
2190+
}
21882191
}
21892192

21902193
if (stream != NULL && (options & STREAM_MUST_SEEK)) {

0 commit comments

Comments
 (0)