summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.c5
-rwxr-xr-xmain/php_streams.h8
-rwxr-xr-xmain/streams.c22
3 files changed, 20 insertions, 15 deletions
diff --git a/main/main.c b/main/main.c
index 5e05ac0018..85f68371b6 100644
--- a/main/main.c
+++ b/main/main.c
@@ -565,6 +565,7 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path
{
FILE *retval = NULL;
php_stream *stream;
+ TSRMLS_FETCH();
stream = php_stream_open_wrapper((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS, opened_path);
if (stream) {
@@ -951,7 +952,7 @@ int php_module_startup(sapi_module_struct *sf)
/* initialize stream wrappers registry
* (this uses configuration parameters from php.ini)
*/
- if (php_init_stream_wrappers() == FAILURE) {
+ if (php_init_stream_wrappers(TSRMLS_C) == FAILURE) {
php_printf("PHP: Unable to initialize stream url wrappers.\n");
return FAILURE;
}
@@ -1056,7 +1057,7 @@ void php_module_shutdown(TSRMLS_D)
zend_shutdown(TSRMLS_C);
- php_shutdown_stream_wrappers();
+ php_shutdown_stream_wrappers(TSRMLS_C);
php_shutdown_info_logos();
UNREGISTER_INI_ENTRIES();
diff --git a/main/php_streams.h b/main/php_streams.h
index 7141da21a1..9f2e4602e5 100755
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -227,10 +227,10 @@ PHPAPI int php_stream_cast(php_stream *stream, int castas, void **ret, int show_
# define IGNORE_URL_WIN 0
#endif
-int php_init_stream_wrappers(void);
-int php_shutdown_stream_wrappers(void);
-PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper);
-PHPAPI int php_unregister_url_stream_wrapper(char *protocol);
+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);
+PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC);
PHPAPI php_stream *_php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path STREAMS_DC);
#define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper((path), (mode), (options), (opened) STREAMS_CC)
diff --git a/main/streams.c b/main/streams.c
index 20cf6c0db5..6f5d8f1149 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -881,30 +881,35 @@ exit_success:
} /* }}} */
-int php_init_stream_wrappers(void)
+int php_init_stream_wrappers(TSRMLS_D)
{
- if (PG(allow_url_fopen))
+ if (PG(allow_url_fopen)) {
return zend_hash_init(&url_stream_wrappers_hash, 0, NULL, NULL, 1);
+ }
return SUCCESS;
}
-int php_shutdown_stream_wrappers(void)
+int php_shutdown_stream_wrappers(TSRMLS_D)
{
- if (PG(allow_url_fopen))
+ if (PG(allow_url_fopen)) {
zend_hash_destroy(&url_stream_wrappers_hash);
+ }
return SUCCESS;
}
-PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper)
+PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC)
{
- if (PG(allow_url_fopen))
+ if (PG(allow_url_fopen)) {
return zend_hash_add(&url_stream_wrappers_hash, protocol, strlen(protocol), wrapper, sizeof(*wrapper), NULL);
+ }
return FAILURE;
}
-PHPAPI int php_unregister_url_stream_wrapper(char *protocol)
+
+PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
{
- if (PG(allow_url_fopen))
+ if (PG(allow_url_fopen)) {
return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol));
+ }
return SUCCESS;
}
@@ -953,7 +958,6 @@ static php_stream *php_stream_open_url(char *path, char *mode, int options, char
PHPAPI php_stream *_php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path STREAMS_DC)
{
php_stream *stream = NULL;
- TSRMLS_FETCH();
if (opened_path)
*opened_path = NULL;