Browse Source

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

does not respect the flag.
migration/unlabaled-1.3.2
Wez Furlong 24 years ago
parent
commit
7379f47518
  1. 9
      main/streams/streams.c

9
main/streams/streams.c

@ -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;

Loading…
Cancel
Save