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;