]> granicus.if.org Git - php/commitdiff
Manual merge of persistent stream sanity check from php5.
authorWez Furlong <wez@php.net>
Wed, 19 Mar 2003 00:18:12 +0000 (00:18 +0000)
committerWez Furlong <wez@php.net>
Wed, 19 Mar 2003 00:18:12 +0000 (00:18 +0000)
main/streams.c

index 50b6f6504790c89014ade11a34b784789b4760cf..d7f8326521b35d8093866bac1d138c63ad6ba163 100755 (executable)
@@ -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;
        }