diff options
author | Wez Furlong <wez@php.net> | 2003-03-19 00:18:12 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-03-19 00:18:12 +0000 |
commit | ea59c6262dc5fa1803ee6a0e054b98f9c1a0a202 (patch) | |
tree | d366b03715a86ee5af3a18f53f7be796bac04679 /main | |
parent | 4a8de5c704c30c9b67c8e0cab55c193dc8e92341 (diff) | |
download | php-git-ea59c6262dc5fa1803ee6a0e054b98f9c1a0a202.tar.gz |
Manual merge of persistent stream sanity check from php5.
Diffstat (limited to 'main')
-rwxr-xr-x | main/streams.c | 10 |
1 files changed, 10 insertions, 0 deletions
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; } |