From ea59c6262dc5fa1803ee6a0e054b98f9c1a0a202 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 19 Mar 2003 00:18:12 +0000 Subject: [PATCH] Manual merge of persistent stream sanity check from php5. --- main/streams.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main/streams.c b/main/streams.c index 50b6f65047..d7f8326521 100755 --- a/main/streams.c +++ b/main/streams.c @@ -2552,6 +2552,16 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio stream = wrapper->wops->stream_opener(wrapper, path_to_open, mode, options ^ REPORT_ERRORS, opened_path, context STREAMS_REL_CC TSRMLS_CC); + + /* if the caller asked for a persistent stream but the wrapper did not + * return one, force an error here */ + if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) { + php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, + "wrapper does not support persistent streams"); + php_stream_close(stream); + stream = NULL; + } + if (stream) stream->wrapper = wrapper; } -- 2.50.1