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))
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);
# 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);
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;
}
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 {