mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
Sanity check for when a stream is requested to be persistent but the wrapper
does not respect the flag.
This commit is contained in:
parent
0fd995f9fc
commit
7379f47518
@ -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…
Reference in New Issue
Block a user