]> granicus.if.org Git - php/commitdiff
register some constants for user streams
authorWez Furlong <wez@php.net>
Tue, 19 Mar 2002 14:35:55 +0000 (14:35 +0000)
committerWez Furlong <wez@php.net>
Tue, 19 Mar 2002 14:35:55 +0000 (14:35 +0000)
ext/standard/basic_functions.c
ext/standard/file.h
main/php_streams.h
main/streams.c
main/user_streams.c

index 410b8152e9f0d9acb926797f57dda6f07e24306c..5dbc1a1a02e234045b1d525bce41e45496b0ea18 100644 (file)
@@ -1004,6 +1004,8 @@ PHP_MINIT_FUNCTION(basic)
 
 
        if (PG(allow_url_fopen)) {
+               PHP_MINIT(user_streams) (INIT_FUNC_ARGS_PASSTHRU);
+
                if (FAILURE == php_register_url_stream_wrapper("http", &php_stream_http_wrapper TSRMLS_CC))
                        return FAILURE;
                if (FAILURE == php_register_url_stream_wrapper("php", &php_stream_php_wrapper TSRMLS_CC))
index d3230fbc35f6bdd2e9463d0293e5e6a848ba117b..ba9fb54daeaabca26c9c9ef96c9402e9cdb16fdf 100644 (file)
@@ -72,6 +72,7 @@ PHP_NAMED_FUNCTION(php_if_fstat);
 
 PHP_FUNCTION(file_get_wrapper_data);
 PHP_FUNCTION(file_register_wrapper);
+PHP_MINIT_FUNCTION(user_streams);
 
 PHPAPI int php_set_sock_blocking(int socketd, int block);
 PHPAPI int php_file_le_stream(void);
index 4a4690253638cdc83a91d5245bbd252aae6ed8a4..8d264f021da99b22ca3789ca9a1409f0071b2048 100755 (executable)
@@ -254,7 +254,6 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
 # define IGNORE_URL_WIN 0
 #endif
 
-int php_init_user_streams(TSRMLS_D);
 int php_init_stream_wrappers(TSRMLS_D);
 int php_shutdown_stream_wrappers(TSRMLS_D);
 PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC);
index 2cdbd6f27a3f40b7050fc06322806a2496e8fdd9..24393fed1dfd24cdac50f5798d7edd22a287c883 100755 (executable)
@@ -891,9 +891,7 @@ exit_success:
 int php_init_stream_wrappers(TSRMLS_D)
 {
        if (PG(allow_url_fopen)) {
-               if (zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1) == SUCCESS)
-                       return php_init_user_streams(TSRMLS_C);
-               return FAILURE;
+               return zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1);
        }
        return SUCCESS;
 }
index 226e42192cfdc25344cfdc7097fbad99946c0d59..99c2079df07455a24a16e301499680c1a73e07f8 100644 (file)
@@ -41,10 +41,20 @@ static void stream_wrapper_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
        efree(uwrap);
 }
 
-int php_init_user_streams(TSRMLS_D)
+
+PHP_MINIT_FUNCTION(user_streams)
 {
        le_protocols = zend_register_list_destructors_ex(stream_wrapper_dtor, NULL, "stream factory", 0);
-       return le_protocols == FAILURE ? FAILURE : SUCCESS;
+       if (le_protocols == FAILURE)
+               return FAILURE;
+
+       REGISTER_LONG_CONSTANT("STREAM_USE_PATH",                       USE_PATH, CONST_CS|CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("STREAM_IGNORE_URL",             IGNORE_URL, CONST_CS|CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("STREAM_ENFORCE_SAFE_MODE",      ENFORCE_SAFE_MODE, CONST_CS|CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("STREAM_REPORT_ERRORS",          REPORT_ERRORS, CONST_CS|CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("STREAM_MUST_SEEK",                      STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT);
+
+       return SUCCESS;
 }
 
 struct _php_userstream_data {