wez             Tue Mar 18 19:18:12 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/main  streams.c 
  Log:
  Manual merge of persistent stream sanity check from php5.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.125.2.44 php4/main/streams.c:1.125.2.45
--- php4/main/streams.c:1.125.2.44      Tue Mar 18 18:39:31 2003
+++ php4/main/streams.c Tue Mar 18 19:18:12 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.44 2003/03/18 23:39:31 wez Exp $ */
+/* $Id: streams.c,v 1.125.2.45 2003/03/19 00:18:12 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -2552,6 +2552,16 @@
                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;
        }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to