]> granicus.if.org Git - php/commitdiff
More TSRMLS_FETCH annihilation. Enough for today...
authorZeev Suraski <zeev@php.net>
Tue, 31 Jul 2001 07:09:49 +0000 (07:09 +0000)
committerZeev Suraski <zeev@php.net>
Tue, 31 Jul 2001 07:09:49 +0000 (07:09 +0000)
26 files changed:
ext/db/db.c
ext/dbase/dbase.c
ext/filepro/filepro.c
ext/gd/gd.c
ext/gd/gd_ctx.c
ext/hyperwave/hw.c
ext/oci8/oci8.c
ext/pgsql/pgsql.c
ext/standard/basic_functions.c
ext/standard/basic_functions.h
ext/standard/file.c
ext/standard/ftp_fopen_wrapper.c
ext/standard/http_fopen_wrapper.c
ext/standard/image.c
ext/standard/php_fopen_wrapper.c
ext/standard/php_fopen_wrappers.h
ext/standard/url_scanner_ex.c
ext/zlib/php_zlib.h
ext/zlib/zlib.c
ext/zlib/zlib_fopen_wrapper.c
main/fopen_wrappers.c
main/fopen_wrappers.h
main/main.c
main/php_ini.c
sapi/cgi/cgi_main.c
sapi/servlet/servlet.c

index 8a59b91c75b91a4c41935222d50ab5bc6a95a9ff..7cdfe7ae63506525eeed43eaf3a08d614c8277d6 100644 (file)
@@ -307,7 +307,7 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
                return NULL;
        }
 
-       if (php_check_open_basedir(filename)) {
+       if (php_check_open_basedir(filename TSRMLS_CC)) {
                return NULL;
        }
 
index c9d870a61ca1da1fde46bfaa6a491d3ac064712b..8394720fec3ffe4a56af7d250103bd9c043cf720 100644 (file)
@@ -132,7 +132,7 @@ PHP_FUNCTION(dbase_open) {
                RETURN_FALSE;
        }
        
-       if (php_check_open_basedir(dbf_name->value.str.val)) {
+       if (php_check_open_basedir(dbf_name->value.str.val TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
@@ -599,7 +599,7 @@ PHP_FUNCTION(dbase_create) {
                RETURN_FALSE;
        }
        
-       if (php_check_open_basedir(Z_STRVAL_P(filename))) {
+       if (php_check_open_basedir(Z_STRVAL_P(filename) TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
index a997934bdacde2caa8b2eca1c375839f423510a1..ed5613688215fd289343a6f3f7939394729f0363 100644 (file)
@@ -218,7 +218,7 @@ PHP_FUNCTION(filepro)
                RETURN_FALSE;
        }
        
-       if (php_check_open_basedir(workbuf)) {
+       if (php_check_open_basedir(workbuf TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
@@ -316,7 +316,7 @@ PHP_FUNCTION(filepro_rowcount)
                RETURN_FALSE;
        }
        
-       if (php_check_open_basedir(workbuf)) {
+       if (php_check_open_basedir(workbuf TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
@@ -540,7 +540,7 @@ PHP_FUNCTION(filepro_retrieve)
                RETURN_FALSE;
        }
        
-       if (php_check_open_basedir(workbuf)) {
+       if (php_check_open_basedir(workbuf TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
index e866f57811298eec4c5c7f0b2c392a4e275d4aa0..6e44cb74f3ad28764f46b5b87e6f72e8b4addfbe 100644 (file)
@@ -409,7 +409,7 @@ PHP_FUNCTION(imageloadfont)
 #ifdef PHP_WIN32
        fp = VCWD_FOPEN(Z_STRVAL_PP(file), "rb");
 #else
-       fp = php_fopen_wrapper(Z_STRVAL_PP(file), "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper(Z_STRVAL_PP(file), "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL TSRMLS_CC);
 #endif
        if (fp == NULL) {
                php_error(E_WARNING, "ImageFontLoad: unable to open file");
@@ -1100,7 +1100,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
 #ifdef PHP_WIN32
        fp = VCWD_FOPEN(fn, "rb");
 #else
-       fp = php_fopen_wrapper(fn, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper(fn, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL TSRMLS_CC);
 #endif
        if (!fp && !socketd) {
                php_strip_url_passwd(fn);
@@ -1312,7 +1312,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
        }
 
        if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) {
-               if (!fn || fn == empty_string || php_check_open_basedir(fn)) {
+               if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) {
                        php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn);
                        RETURN_FALSE;
                }
@@ -3404,13 +3404,13 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
                }
 
                /* Check origin file */
-               if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org)) {
+               if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org TSRMLS_CC)) {
                        php_error (E_WARNING, "%s: invalid origin filename '%s'", get_active_function_name(TSRMLS_C), fn_org);
                        RETURN_FALSE;
                }
 
                /* Check destination file */
-               if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest)) {
+               if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest TSRMLS_CC)) {
                        php_error (E_WARNING, "%s: invalid destination filename '%s'", get_active_function_name(TSRMLS_C), fn_dest);
                        RETURN_FALSE;
                }
index b6c5df5986c1ffb9802aa231f493b15285199581..3c389a38bafad374af61f711c3c7bc9aa5155533 100644 (file)
@@ -49,7 +49,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
        }
 
        if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) {
-               if (!fn || fn == empty_string || php_check_open_basedir(fn)) {
+               if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) {
                        php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(TSRMLS_C), fn);
                        RETURN_FALSE;
                }
index 1f612b5281bcbd12d5108dfc64f873e7d0c7935c..fe1eec534adcef501eedb7095525c517231bd441 100644 (file)
@@ -2800,7 +2800,8 @@ PHP_FUNCTION(hw_insertdocument) {
 
 /* {{{ proto hwdoc hw_new_document(string objrec, string data, int size)
    Create a new document */
-PHP_FUNCTION(hw_new_document) {
+PHP_FUNCTION(hw_new_document)
+{
        pval *arg1, *arg2, *arg3;
        char *ptr;
        hw_document *doc;
@@ -2835,7 +2836,8 @@ PHP_FUNCTION(hw_new_document) {
 #define BUFSIZE 8192
 /* {{{ proto hwdoc hw_new_document_from_file(string objrec, string filename)
    Create a new document from a file */
-PHP_FUNCTION(hw_new_document_from_file) {
+PHP_FUNCTION(hw_new_document_from_file)
+{
        pval **arg1, **arg2;
        int len, type;
        char *ptr;
@@ -2854,7 +2856,7 @@ PHP_FUNCTION(hw_new_document_from_file) {
        convert_to_string_ex(arg1);
        convert_to_string_ex(arg2);
 
-       fp = php_fopen_wrapper((*arg2)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper((*arg2)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
        if (!fp && !socketd){
                if (issock != BAD_URL) {
                        char *tmp = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
index 593ea10ab04c56433da3ef202a5a9415d4bf064c..7ad8eaf90f9634846c0d374b7333522a8300fc90 100644 (file)
@@ -2930,7 +2930,7 @@ PHP_FUNCTION(ocisavelobfile)
 
                convert_to_string_ex(arg);
 
-               if (php_check_open_basedir((*arg)->value.str.val)) {
+               if (php_check_open_basedir((*arg)->value.str.val TSRMLS_CC)) {
                        RETURN_FALSE;
                }
 
@@ -3050,7 +3050,7 @@ PHP_FUNCTION(ociwritelobtofile)
                }
 
                if (filename && *filename) {
-                       if (php_check_open_basedir(filename)) {
+                       if (php_check_open_basedir(filename TSRMLS_CC)) {
                                goto bail;
                        }
 
index 8ff51b8968e844dbc12b06b75437d69284afa31b..2b3d8b764f8d163589fc97ef601ee8e38b15c01b 100644 (file)
@@ -1436,7 +1436,7 @@ PHP_FUNCTION(pg_trace)
     ZEND_FETCH_RESOURCE2(pgsql, PGconn *, z_pgsql_link, id, "PostgreSQL link", le_link, le_plink);
        convert_to_string_ex(z_filename);
 
-       fp = php_fopen_wrapper(Z_STRVAL_PP(z_filename), mode, ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper(Z_STRVAL_PP(z_filename), mode, ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
 
        if (!fp) {
                php_error(E_WARNING, "Unable to open %s for logging", Z_STRVAL_PP(z_filename));
index 8323bfb0f01ad46ebc8e5fe228eea15855d4661b..f3378da6784188054f7ae053d3295119ee119eef 100644 (file)
@@ -1552,7 +1552,7 @@ PHP_FUNCTION(error_log)
                headers=Z_STRVAL_PP(emailhead);
        }
 
-       if (_php_error_log(opt_err,message,opt,headers)==FAILURE) {
+       if (_php_error_log(opt_err, message, opt, headers TSRMLS_CC)==FAILURE) {
                RETURN_FALSE;
        }
 
@@ -1560,7 +1560,7 @@ PHP_FUNCTION(error_log)
 }
 /* }}} */
 
-PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers)
+PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC)
 {
        FILE *logfile;
        int issock=0, socketd=0;;
@@ -1582,7 +1582,7 @@ PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers)
                        return FAILURE;
                        break;
                case 3: /*save to a file*/
-                       logfile=php_fopen_wrapper(opt,"a", (IGNORE_URL|ENFORCE_SAFE_MODE), &issock, &socketd, NULL);
+                       logfile=php_fopen_wrapper(opt,"a", (IGNORE_URL|ENFORCE_SAFE_MODE), &issock, &socketd, NULL TSRMLS_CC);
                        if(!logfile) {
                                php_error(E_WARNING,"error_log: Unable to write to %s",opt);
                                return FAILURE;
index 8fac9cb70e1a1bf635c430ff68527eb8e669d5f0..1364a3b11f8d67243975e817ca899dce828df9fd 100644 (file)
@@ -122,7 +122,7 @@ typedef unsigned int php_stat_len;
 typedef int php_stat_len;
 #endif
 
-PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers);
+PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
 
 #if SIZEOF_INT == 4
 /* Most 32-bit and 64-bit systems have 32-bit ints */
index 99b94ed3b570759c72aa2fef625084497f0cb4c9..5e84472cd5b3f39eaf91145c76fbce77cb104a5b 100644 (file)
@@ -317,7 +317,7 @@ PHP_FUNCTION(get_meta_tags)
        }
        convert_to_string_ex(filename);
 
-       md.fp = php_fopen_wrapper((*filename)->value.str.val, "rb", use_include_path|ENFORCE_SAFE_MODE, &md.issock, &md.socketd, NULL);
+       md.fp = php_fopen_wrapper((*filename)->value.str.val, "rb", use_include_path|ENFORCE_SAFE_MODE, &md.issock, &md.socketd, NULL TSRMLS_CC);
        if (!md.fp && !md.socketd) {
                if (md.issock != BAD_URL) {
                        char *tmp = estrndup(Z_STRVAL_PP(filename), Z_STRLEN_PP(filename));
@@ -497,7 +497,7 @@ PHP_FUNCTION(file)
        }
        convert_to_string_ex(filename);
 
-       fp = php_fopen_wrapper((*filename)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper((*filename)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
        if (!fp && !socketd) {
                if (issock != BAD_URL) {
                        char *tmp = estrndup(Z_STRVAL_PP(filename), Z_STRLEN_PP(filename));
@@ -667,7 +667,7 @@ PHP_NAMED_FUNCTION(php_if_fopen)
         * We need a better way of returning error messages from
         * php_fopen_wrapper().
         */
-       fp = php_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
        if (!fp && !socketd) {
                if (issock != BAD_URL) {
                        char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
@@ -1629,7 +1629,7 @@ PHP_FUNCTION(readfile)
         * We need a better way of returning error messages from
         * php_fopen_wrapper().
         */
-       fp = php_fopen_wrapper((*arg1)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper((*arg1)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
        if (!fp && !socketd){
                if (issock != BAD_URL) {
                        char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
index 1478970b02a9369b1730909d2e6c08d3d3b22dff..f246ffeeabcb129d81fab14260c59bdaffec500b 100644 (file)
@@ -79,7 +79,7 @@ static int php_get_ftp_result(int socketd)
 
 /* {{{ php_fopen_url_wrap_ftp
  */
-FILE *php_fopen_url_wrap_ftp(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
+FILE *php_fopen_url_wrap_ftp(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC)
 {
        FILE *fp=NULL;
        php_url *resource=NULL;
index f83fb7b3ae2028c1029695712842adeb3447e2c1..745e57ff00fc61dfda6c122803015ec644110567 100644 (file)
@@ -70,7 +70,7 @@
 
 /* {{{ php_fopen_url_wrap_http
  */
-FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
+FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC)
 {
        FILE *fp=NULL;
        php_url *resource=NULL;
@@ -85,7 +85,6 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock,
        zval *response_header;
        char *http_header_line;
        int http_header_line_length, http_header_line_size;
-       TSRMLS_FETCH();
 
        resource = php_url_parse((char *) path);
        if (resource == NULL) {
@@ -276,7 +275,7 @@ FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock,
                if (location[0] != '\0') {
                        zval **response_header_new, *entry, **entryp;
 
-                       fp = php_fopen_url_wrap_http(location, mode, options, issock, socketd, opened_path);
+                       fp = php_fopen_url_wrap_http(location, mode, options, issock, socketd, opened_path TSRMLS_CC);
                        if (zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &response_header_new) == SUCCESS) {
                                entryp = &entry;
                                MAKE_STD_ZVAL(entry);
index 6294cd60b29466160f8c803b7763d93f0a707731..cb93b19b8b7df53bb322e5d84a34db817ce9a1ec 100644 (file)
@@ -436,7 +436,7 @@ PHP_FUNCTION(getimagesize)
                break;
        }
 
-       fp = php_fopen_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
+       fp = php_fopen_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
 
        if (!fp && !socketd) {
                if (issock != BAD_URL) {
index b5367198e2c3915df81e5abd30bd33e7d8692959..068191ee4c742fb8205959b998d817dcd6e3c476 100644 (file)
@@ -33,7 +33,7 @@
 
 /* {{{ php_fopen_url_wrap_php
  */
-FILE *php_fopen_url_wrap_php(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
+FILE *php_fopen_url_wrap_php(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC)
 {
        const char *res = path + 6;
 
index 8e4427e8b32df8aeeb9c42d05f687e596ca76d93..0f873183c08f945d4412bf51480f3b5d1f49a441 100644 (file)
@@ -23,8 +23,8 @@
 #ifndef PHP_FOPEN_WRAPPERS_H
 #define PHP_FOPEN_WRAPPERS_H
 
-extern FILE *php_fopen_url_wrap_http(char *, char *, int, int *, int *, char **);
-extern FILE *php_fopen_url_wrap_ftp(char *, char *, int, int *, int *, char **);
-extern FILE *php_fopen_url_wrap_php(char *, char *, int, int *, int *, char **);
+FILE *php_fopen_url_wrap_http(char *, char *, int, int *, int *, char ** TSRMLS_DC);
+FILE *php_fopen_url_wrap_ftp(char *, char *, int, int *, int *, char ** TSRMLS_DC);
+FILE *php_fopen_url_wrap_php(char *, char *, int, int *, int *, char ** TSRMLS_DC);
 
 #endif
index 10abc5450678c9461da33280b47a1ce7135c244a..7746da4c733c409b4b90ff026a8e8b8ef13950e0 100644 (file)
@@ -887,12 +887,9 @@ PHP_RSHUTDOWN_FUNCTION(url_scanner)
 PHP_MINIT_FUNCTION(url_scanner)
 {
        url_adapt_state_ex_t *ctx;
-       //TSRMLS_FETCH();
        
        ctx = &BG(url_adapt_state_ex);
-
-       ctx->tags = NULL;
-       
+       ctx->tags = NULL;       
        REGISTER_INI_ENTRIES();
        return SUCCESS;
 }
index f0732ded316ccca68f5fb37de3b244947d38234a..d4fe9af97d156c8a74a257a529fb9ee0411ea663 100644 (file)
@@ -64,7 +64,7 @@ PHP_FUNCTION(gzinflate);
 PHP_FUNCTION(gzencode);
 PHP_FUNCTION(ob_gzhandler);
 
-FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path);
+FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC);
 int php_enable_output_compression(int buffer_size);
 
 
index e70d9fa49d7bbcc051c5c42b2ff5a1f831a6bcb9..45dee373647159b7167e4bafd4a7803202542ffc 100644 (file)
@@ -165,7 +165,7 @@ PHP_MINIT_FUNCTION(zlib)
 #if HAVE_FOPENCOOKIE
 
        if(PG(allow_url_fopen)) {
-               php_register_url_wrapper("zlib",zlib_fopen_wrapper TSRMLS_CC);
+               php_register_url_wrapper("zlib", zlib_fopen_wrapper TSRMLS_CC);
        }
 #endif
 
@@ -229,12 +229,12 @@ PHP_MINFO_FUNCTION(zlib)
 
 /* {{{ php_gzopen_wrapper
  */
-static gzFile php_gzopen_wrapper(char *path, char *mode, int options)
+static gzFile php_gzopen_wrapper(char *path, char *mode, int options TSRMLS_DC)
 {
        FILE *f;
        int issock=0, socketd=0;
 
-       f = php_fopen_wrapper(path, mode, options, &issock, &socketd, NULL);
+       f = php_fopen_wrapper(path, mode, options, &issock, &socketd, NULL TSRMLS_CC);
 
        if (!f) {
                return NULL;
@@ -272,7 +272,7 @@ PHP_FUNCTION(gzfile)
        }
        convert_to_string_ex(filename);
 
-       zp = php_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE);
+       zp = php_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE TSRMLS_CC);
        if (!zp) {
                php_error(E_WARNING,"gzFile(\"%s\") - %s",(*filename)->value.str.val,strerror(errno));
                RETURN_FALSE;
@@ -332,7 +332,7 @@ PHP_FUNCTION(gzopen)
         * We need a better way of returning error messages from
         * php_gzopen_wrapper().
         */
-       zp = php_gzopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE);
+       zp = php_gzopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE TSRMLS_CC);
        if (!zp) {
                php_error(E_WARNING,"gzopen(\"%s\",\"%s\") - %s",
                                        (*arg1)->value.str.val, p, strerror(errno));
@@ -640,7 +640,7 @@ PHP_FUNCTION(readgzfile)
         * We need a better way of returning error messages from
         * php_gzopen_wrapper().
         */
-       zp = php_gzopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE);
+       zp = php_gzopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE TSRMLS_CC);
        if (!zp){
                php_error(E_WARNING,"ReadGzFile(\"%s\") - %s",(*arg1)->value.str.val,strerror(errno));
                RETURN_FALSE;
index ad87ba705f77e2c3165f2311ed2f5550d125741f..f9328025ebbd42a291338c21dc3f638ab512ee96 100644 (file)
@@ -59,7 +59,7 @@ static COOKIE_IO_FUNCTIONS_T gz_cookie_functions =
 , gz_closer
 };
 
-FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
+FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC)
 {
        struct gz_cookie *gc = NULL;
        FILE *fp;
@@ -75,7 +75,7 @@ FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *
                
                path++;
 
-               fp = php_fopen_wrapper(path, mode, options|IGNORE_URL, &fissock, &fsocketd, NULL);
+               fp = php_fopen_wrapper(path, mode, options|IGNORE_URL, &fissock, &fsocketd, NULL TSRMLS_CC);
                
                if (!fp) {
                        free(gc);
index b3ecfcbfa30f20032f89b44503576c3706c95df3..d009dbbf44af3dd9579542e7ab4d4177889bc731 100644 (file)
 #endif
 /* }}} */
 
-typedef FILE * (*php_fopen_url_wrapper_t) (const char *, char *, int, int *, int *, char **) ;
-
-static FILE *php_fopen_url_wrapper(const char *, char *, int, int *, int *, char **);
-
-HashTable fopen_url_wrappers_hash;
+static FILE *php_fopen_url_wrapper(const char *, char *, int, int *, int *, char ** TSRMLS_DC);
+static HashTable fopen_url_wrappers_hash;
 
 /* {{{ php_register_url_wrapper
  */
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) TSRMLS_DC)
+PHPAPI int php_register_url_wrapper(char *protocol, php_fopen_url_wrapper_t wrapper TSRMLS_DC)
 {
        if(PG(allow_url_fopen)) {
                return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol), &wrapper, sizeof(wrapper), NULL);
@@ -226,10 +223,9 @@ PHPAPI int php_check_open_basedir(char *path TSRMLS_DC)
 
 /* {{{ php_fopen_and_set_opened_path
  */
-static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **opened_path)
+static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **opened_path TSRMLS_DC)
 {
        FILE *fp;
-       TSRMLS_FETCH();
 
        if (php_check_open_basedir((char *)path TSRMLS_CC)) {
                return NULL;
@@ -244,43 +240,42 @@ static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **
 
 /* {{{ php_fopen_wrapper
  */
-PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
+PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC)
 {
-       TSRMLS_FETCH();
-
-    if(!path) return NULL;
-       if(!*path) return NULL;
-
        if (opened_path) {
                *opened_path = NULL;
        }
 
+    if(!path || !*path) {
+               return NULL;
+       }
+
+
        if(PG(allow_url_fopen)) {
                if (!(options & IGNORE_URL)) {
-                       return php_fopen_url_wrapper(path, mode, options, issock, socketd, opened_path);
+                       return php_fopen_url_wrapper(path, mode, options, issock, socketd, opened_path TSRMLS_CC);
                }
        }
 
        if (options & USE_PATH && PG(include_path) != NULL) {
-               return php_fopen_with_path(path, mode, PG(include_path), opened_path);
+               return php_fopen_with_path(path, mode, PG(include_path), opened_path TSRMLS_CC);
        } else {
                if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM))) {
                        return NULL;
                }
-               return php_fopen_and_set_opened_path(path, mode, opened_path);
+               return php_fopen_and_set_opened_path(path, mode, opened_path TSRMLS_CC);
        }
 }
 /* }}} */
 
 /* {{{ php_fopen_primary_script
  */
-PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle)
+PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
 {
        FILE *fp;
        struct stat st;
        char *path_info, *filename;
        int length;
-       TSRMLS_FETCH();
 
        filename = SG(request_info).path_translated;
        path_info = SG(request_info).request_uri;
@@ -375,7 +370,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle)
  * Tries to open a file with a PATH-style list of directories.
  * If the filename starts with "." or "/", the path is ignored.
  */
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path)
+PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path TSRMLS_DC)
 {
        char *pathbuf, *ptr, *end;
        char *exec_fname;
@@ -388,7 +383,6 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
        int filename_length;
        int safe_mode_include_dir_length;
        int exec_fname_length;
-       TSRMLS_FETCH();
 
        if (opened_path) {
                *opened_path = NULL;
@@ -405,7 +399,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
                        return NULL;
                }
-               return php_fopen_and_set_opened_path(filename, mode, opened_path);
+               return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
        }
        
        /*
@@ -429,7 +423,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
 #endif
                        {
                                /* absolute path matches safe_mode_include_dir */
-                               fp = php_fopen_and_set_opened_path(trypath, mode, opened_path);
+                               fp = php_fopen_and_set_opened_path(trypath, mode, opened_path TSRMLS_CC);
                                if (fp) {
                                        return fp;
                                }
@@ -438,14 +432,14 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
                        return NULL;
                }
-               return php_fopen_and_set_opened_path(filename, mode, opened_path);
+               return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
        }
 
        if (!path || (path && !*path)) {
                if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
                        return NULL;
                }
-               return php_fopen_and_set_opened_path(filename, mode, opened_path);
+               return php_fopen_and_set_opened_path(filename, mode, opened_path TSRMLS_CC);
        }
 
        /* check in provided path */
@@ -491,7 +485,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
 #endif
                        {
                                /* trypath is in safe_mode_include_dir */
-                               fp = php_fopen_and_set_opened_path(trydir, mode, opened_path);
+                               fp = php_fopen_and_set_opened_path(trydir, mode, opened_path TSRMLS_CC);
                                if (fp) {
                                        efree(pathbuf);
                                        return fp;
@@ -504,7 +498,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                                return NULL;
                        }
                }
-               fp = php_fopen_and_set_opened_path(trypath, mode, opened_path);
+               fp = php_fopen_and_set_opened_path(trypath, mode, opened_path TSRMLS_CC);
                if (fp) {
                        efree(pathbuf);
                        return fp;
@@ -519,14 +513,13 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
  
 /* {{{ php_fopen_url_wrapper
  */
-static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
+static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC)
 {
        FILE *fp = NULL;
        const char *p;
        const char *protocol=NULL;
        int n=0;
 
-
        for (p=path; isalnum((int)*p); p++) {
                n++;
        }
@@ -542,13 +535,11 @@ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, in
                        protocol=NULL;
                }
                if (wrapper) {
-                       return (*wrapper)(path, mode, options, issock, socketd, opened_path);   
+                       return (*wrapper)(path, mode, options, issock, socketd, opened_path TSRMLS_CC);
                }
        } 
 
        if (!protocol || !strncasecmp(protocol, "file",n)){
-               TSRMLS_FETCH();
-               
                *issock = 0;
                
                if(protocol) {
@@ -562,12 +553,12 @@ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, in
                }               
 
                if (options & USE_PATH) {
-                       fp = php_fopen_with_path((char *) path, mode, PG(include_path), opened_path);
+                       fp = php_fopen_with_path((char *) path, mode, PG(include_path), opened_path TSRMLS_CC);
                } else {
                        if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM))) {
                                fp = NULL;
                        } else {
-                               fp = php_fopen_and_set_opened_path(path, mode, opened_path);
+                               fp = php_fopen_and_set_opened_path(path, mode, opened_path TSRMLS_CC);
                        }
                }
                return (fp);
index 040dae6cb69253b0dcb8b663913e7b981c5314f5..079156be065a22fdbad73b68100a82c88568d74b 100644 (file)
 #define IS_SOCKET              1
 #define BAD_URL                        2
 
-PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path);
+typedef FILE *(*php_fopen_url_wrapper_t)(const char *, char *, int, int *, int *, char ** TSRMLS_DC);
 
-PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle);
+PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC);
+
+PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC);
 PHPAPI char *expand_filepath(const char *filepath, char *real_path);
 
 PHPAPI int php_check_open_basedir(char *path TSRMLS_DC);
 PHPAPI int php_check_specific_open_basedir(char *basedir, char *path TSRMLS_DC);
 
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
+PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path TSRMLS_DC);
 
 PHPAPI int php_is_url(char *path);
 PHPAPI char *php_strip_url_passwd(char *path);
@@ -80,7 +82,7 @@ PHPAPI char *php_strip_url_passwd(char *path);
 
 int php_init_fopen_wrappers(TSRMLS_D);
 int php_shutdown_fopen_wrappers(TSRMLS_D);
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path) TSRMLS_DC);
+PHPAPI int php_register_url_wrapper(char *protocol, php_fopen_url_wrapper_t wrapper TSRMLS_DC);
 PHPAPI int php_unregister_url_wrapper(char *protocol TSRMLS_DC);
 
 #endif
index 87bf427aad11dcc6a67b34a7bb731a3ceb1d455e..eff65d5f88cce3eec84861fe2f0e5daf8240026a 100644 (file)
@@ -496,9 +496,10 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path
        int issock=0, socketd=0;
        int old_chunk_size;
        FILE *retval;
+       TSRMLS_FETCH();
        
        old_chunk_size = php_sock_set_def_chunk_size(1);
-       retval=php_fopen_wrapper((char *) filename, "rb", USE_PATH|IGNORE_URL_WIN, &issock, &socketd, opened_path);
+       retval=php_fopen_wrapper((char *) filename, "rb", USE_PATH|IGNORE_URL_WIN, &issock, &socketd, opened_path TSRMLS_CC);
        php_sock_set_def_chunk_size(old_chunk_size);
        
        if (issock) {
index d47dcac2262a729d264841b88a11ac002bae89e3..460b7373ea30791098d0abb9601b00ff65a5eecc 100644 (file)
@@ -251,7 +251,7 @@ int php_init_config(char *php_ini_path_override)
        PG(safe_mode) = 0;
        PG(open_basedir) = NULL;
        
-       fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path);
+       fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
        if (free_ini_search_path) {
                efree(php_ini_search_path);
        }
index 633576ea67530d373b0224c40c8c3316ee09a600..e34c504c20a6184f4f655a78a2f84c97a499a00f 100644 (file)
@@ -707,7 +707,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
                        }
                }
                if (cgi || SG(request_info).path_translated) {
-                       retval = php_fopen_primary_script(&file_handle);
+                       retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
                }
 
                if (cgi && (retval == FAILURE)) {
index a8ecd3a8d9973d6d10ed8c6d95425e302a874211..dda106fe4a251b2d3a0ec218930c111401d0ee0a 100644 (file)
@@ -348,7 +348,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
                 */
                SETSTRING( SG(request_info).path_translated, pathTranslated );
 #ifdef VIRTUAL_DIR
-               retval = php_fopen_primary_script(&file_handle);
+               retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
 #else
                /*
                 * The java runtime doesn't like the working directory to be
@@ -356,7 +356,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send
                 * in the hopes that Java doesn't notice.
                 */
                getcwd(cwd,MAXPATHLEN);
-               retval = php_fopen_primary_script(&file_handle);
+               retval = php_fopen_primary_script(&file_handle TSRMLS_CC);
                chdir(cwd);
 #endif