Sanity check for when a stream is requested to be persistent but the wrapper

does not respect the flag.
This commit is contained in:
Wez Furlong 2003-03-19 00:17:15 +00:00
parent 0fd995f9fc
commit 7379f47518

View File

@ -1461,6 +1461,15 @@ 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;