From b3aebda9eaf55706af2e21178f229a171725a168 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sat, 20 Sep 2014 20:22:14 +0100 Subject: native tls initial patch --- sapi/apache2handler/php_apache.h | 2 +- sapi/apache2handler/php_functions.c | 4 ++-- sapi/apache2handler/sapi_apache2.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index f6f4f7a7c9..674eb9fbc6 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -78,7 +78,7 @@ typedef struct { extern zend_module_entry apache2_module_entry; #ifdef ZTS -extern int php_apache2_info_id; +TSRMG_DH(php_apache2_info_struct, php_apache2_info_id); #define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) #else extern php_apache2_info_struct php_apache2_info; diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 27643b8917..c79af0e3db 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -49,7 +49,7 @@ #include "php_apache.h" #ifdef ZTS -int php_apache2_info_id; +TSRMG_D(php_apache2_info_struct, php_apache2_info_id); #else php_apache2_info_struct php_apache2_info; #endif @@ -536,7 +536,7 @@ PHP_INI_END() static PHP_MINIT_FUNCTION(apache) { #ifdef ZTS - ts_allocate_id(&php_apache2_info_id, sizeof(php_apache2_info_struct), (ts_allocate_ctor) NULL, NULL); + TSRMG_ALLOCATE(php_apache2_info_id, sizeof(php_apache2_info_struct), NULL, NULL); #endif REGISTER_INI_ENTRIES(); return SUCCESS; diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 08e6caff3c..f993b478bc 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -451,6 +451,7 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp } #ifdef ZTS tsrm_startup(1, 1, 0, NULL); + TSRMLS_INIT(); #endif sapi_startup(&apache2_sapi_module); apache2_sapi_module.startup(&apache2_sapi_module); @@ -540,7 +541,7 @@ static int php_handler(request_rec *r) apr_bucket *bucket; apr_status_t rv; request_rec * volatile parent_req = NULL; - TSRMLS_FETCH(); + TSRMLS_INIT(); #define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC); -- cgit v1.2.1 From 4db75dc8533a69e8849651ab5d0fa84efa3d8bba Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 22 Sep 2014 20:58:45 +0200 Subject: basic windows fix --- sapi/apache2handler/php_apache.h | 2 +- sapi/apache2handler/php_functions.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 674eb9fbc6..26ddf222c4 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -78,7 +78,7 @@ typedef struct { extern zend_module_entry apache2_module_entry; #ifdef ZTS -TSRMG_DH(php_apache2_info_struct, php_apache2_info_id); +TSRMG_DHE(php_apache2_info_struct, php_apache2_info_id); #define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) #else extern php_apache2_info_struct php_apache2_info; diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 9529b708a6..3fc88edfbc 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -49,7 +49,7 @@ #include "php_apache.h" #ifdef ZTS -TSRMG_D(php_apache2_info_struct, php_apache2_info_id); +TSRMG_DE(php_apache2_info_struct, php_apache2_info_id); #else php_apache2_info_struct php_apache2_info; #endif -- cgit v1.2.1 From d11734b4b00f57de80d931ad1c522e00082443af Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 25 Sep 2014 18:48:27 +0200 Subject: reworked the patch, less new stuff but worky TLS is already used in TSRM, the way exporting the tsrm cache through a thread local variable is not portable. Additionally, the current patch suffers from bugs which are hard to find, but prevent it to be worky with apache. What is done here is mainly uses the idea from the RFC patch, but - __thread variable is removed - offset math and declarations are removed - extra macros and definitions are removed What is done merely is - use an inline function to access the tsrm cache. The function uses the portable tsrm_tls_get macro which is cheap - all the TSRM_* macros are set to placebo. Thus this opens the way remove them later Except that, the logic is old. TSRMLS_FETCH will have to be done once per thread, then tsrm_get_ls_cache() can be used. Things seeming to be worky are cli, cli server and apache. I also tried to enable bz2 shared and it has worked out of the box. The change is yet minimal diffing to the current master bus is a worky start, IMHO. Though will have to recheck the other previously done SAPIs - embed and cgi. The offsets can be added to the tsrm_resource_type struct, then it'll not be needed to declare them in the userspace. Even the "done" member type can be changed to int16 or smaller, then adding the offset as int16 will not change the struct size. As well on the todo might be removing the hashed storage, thread_id != thread_id and linked list logic in favour of the explicit TLS operations. --- sapi/apache2handler/php_apache.h | 2 +- sapi/apache2handler/php_functions.c | 4 ++-- sapi/apache2handler/sapi_apache2.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 26ddf222c4..f6f4f7a7c9 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -78,7 +78,7 @@ typedef struct { extern zend_module_entry apache2_module_entry; #ifdef ZTS -TSRMG_DHE(php_apache2_info_struct, php_apache2_info_id); +extern int php_apache2_info_id; #define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) #else extern php_apache2_info_struct php_apache2_info; diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 3fc88edfbc..d9ae4d97ea 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -49,7 +49,7 @@ #include "php_apache.h" #ifdef ZTS -TSRMG_DE(php_apache2_info_struct, php_apache2_info_id); +int php_apache2_info_id; #else php_apache2_info_struct php_apache2_info; #endif @@ -536,7 +536,7 @@ PHP_INI_END() static PHP_MINIT_FUNCTION(apache) { #ifdef ZTS - TSRMG_ALLOCATE(php_apache2_info_id, sizeof(php_apache2_info_struct), NULL, NULL); + ts_allocate_id(&php_apache2_info_id, sizeof(php_apache2_info_struct), (ts_allocate_ctor) NULL, NULL); #endif REGISTER_INI_ENTRIES(); return SUCCESS; diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 86372e126d..fe200304fd 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -451,7 +451,6 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp } #ifdef ZTS tsrm_startup(1, 1, 0, NULL); - TSRMLS_INIT(); #endif sapi_startup(&apache2_sapi_module); apache2_sapi_module.startup(&apache2_sapi_module); @@ -541,7 +540,7 @@ static int php_handler(request_rec *r) apr_bucket *bucket; apr_status_t rv; request_rec * volatile parent_req = NULL; - TSRMLS_INIT(); + TSRMLS_FETCH(); #define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC); -- cgit v1.2.1 From 21b6d15599a23a03afa5a7df779b03c6823dc4ba Mon Sep 17 00:00:00 2001 From: krakjoe Date: Fri, 26 Sep 2014 09:23:50 +0100 Subject: remove unused fetch --- sapi/apache2handler/sapi_apache2.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index fe200304fd..5ccc774e83 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -403,7 +403,6 @@ static apr_status_t php_apache_child_shutdown(void *tmp) static void php_apache_add_version(apr_pool_t *p) { - TSRMLS_FETCH(); if (PG(expose_php)) { ap_add_version_component(p, "PHP/" PHP_VERSION); } -- cgit v1.2.1 From c00424e427930a33e6d8645cc3f23fb78ed29b9f Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 09:37:55 +0200 Subject: bring back all the TSRMLS_FETCH() stuff for better comparability with the mainstream --- sapi/apache2handler/sapi_apache2.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 5ccc774e83..fe200304fd 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -403,6 +403,7 @@ static apr_status_t php_apache_child_shutdown(void *tmp) static void php_apache_add_version(apr_pool_t *p) { + TSRMLS_FETCH(); if (PG(expose_php)) { ap_add_version_component(p, "PHP/" PHP_VERSION); } -- cgit v1.2.1 From 1fc8220b6516ac6f40d81eb7cee1eefe69c7e4a0 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 09:46:35 +0200 Subject: TSRMLS_FETCH() is a spent force --- sapi/apache2handler/sapi_apache2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index fe200304fd..6b0ab4876d 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -540,7 +540,10 @@ static int php_handler(request_rec *r) apr_bucket *bucket; apr_status_t rv; request_rec * volatile parent_req = NULL; - TSRMLS_FETCH(); +#ifdef ZTS + /* initial resource fetch */ + void ***tsrm_ls = ts_resource(0); +#endif #define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC); -- cgit v1.2.1 From 8aeffdd74c826b5012c9b052848cfa8e593776ed Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 16:33:40 +0200 Subject: moved most of the core to use static tsrm ls cache pointer plus apache2handler, cli and cgi --- sapi/apache2handler/config.m4 | 2 +- sapi/apache2handler/config.w32 | 6 +++--- sapi/apache2handler/php_apache.h | 3 ++- sapi/apache2handler/sapi_apache2.c | 6 ++++++ 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index 59e17393dd..2e64b215e5 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -56,7 +56,7 @@ if test "$PHP_APXS2" != "no"; then esac done - APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS" + APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" # Test that we're trying to configure with apache 2.x PHP_AP_EXTRACT_VERSION($APXS_HTTPD) diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32 index d15dcfaf03..8ea1305d4f 100644 --- a/sapi/apache2handler/config.w32 +++ b/sapi/apache2handler/config.w32 @@ -13,7 +13,7 @@ if (PHP_APACHE2HANDLER != "no") { ) { SAPI('apache2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c', 'php' + PHP_VERSION + 'apache2.dll', - '/D PHP_APACHE2_EXPORTS /I win32'); + '/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1'); } else { WARNING("Could not find apache2 libraries/headers"); } @@ -31,7 +31,7 @@ if (PHP_APACHE2_2HANDLER != "no") { ) { SAPI('apache2_2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c', 'php' + PHP_VERSION + 'apache2_2.dll', - '/D PHP_APACHE2_EXPORTS /I win32', + '/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1', 'sapi\\apache2_2handler'); } else { WARNING("Could not find apache2.2 libraries/headers"); @@ -49,7 +49,7 @@ if (PHP_APACHE2_4HANDLER != "no") { ) { SAPI('apache2_4handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c', 'php' + PHP_VERSION + 'apache2_4.dll', - '/D PHP_APACHE2_EXPORTS /I win32', + '/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1', 'sapi\\apache2handler'); } else { WARNING("Could not find apache 2.4 libraries/headers"); diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index f6f4f7a7c9..da20072b14 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -79,7 +79,8 @@ extern zend_module_entry apache2_module_entry; #ifdef ZTS extern int php_apache2_info_id; -#define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) +#define AP2(v) ZEND_TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) +ZEND_TSRMLS_CACHE_EXTERN; #else extern php_apache2_info_struct php_apache2_info; #define AP2(v) (php_apache2_info.v) diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 6b0ab4876d..1234f91051 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -71,6 +71,9 @@ /* A way to specify the location of the php.ini dir in an apache directive */ char *apache2_php_ini_path_override = NULL; +#ifdef ZTS +ZEND_TSRMLS_CACHE_DEFINE; +#endif static size_t php_apache_sapi_ub_write(const char *str, size_t str_length TSRMLS_DC) @@ -451,6 +454,8 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp } #ifdef ZTS tsrm_startup(1, 1, 0, NULL); + (void)ts_resource(0); + ZEND_TSRMLS_CACHE_UPDATE; #endif sapi_startup(&apache2_sapi_module); apache2_sapi_module.startup(&apache2_sapi_module); @@ -543,6 +548,7 @@ static int php_handler(request_rec *r) #ifdef ZTS /* initial resource fetch */ void ***tsrm_ls = ts_resource(0); + ZEND_TSRMLS_CACHE_UPDATE; #endif #define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC); -- cgit v1.2.1 From aff66a94a631b5711549395bb282f61b6f6f9e49 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 16:55:47 +0200 Subject: don't define tsrm ls in SAPIs under linux as it's compiled statically with the core --- sapi/apache2handler/sapi_apache2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 1234f91051..3b93c74f7a 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -71,7 +71,7 @@ /* A way to specify the location of the php.ini dir in an apache directive */ char *apache2_php_ini_path_override = NULL; -#ifdef ZTS +#if defined(PHP_WIN32) && defined(ZTS) ZEND_TSRMLS_CACHE_DEFINE; #endif -- cgit v1.2.1 From bdeb220f48825642f84cdbf3ff23a30613c92e86 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 13 Dec 2014 23:06:14 +0100 Subject: first shot remove TSRMLS_* things --- sapi/apache2handler/php_functions.c | 30 ++++++++-------- sapi/apache2handler/sapi_apache2.c | 71 ++++++++++++++++++------------------- 2 files changed, 50 insertions(+), 51 deletions(-) (limited to 'sapi/apache2handler') diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index d038f9e9b9..5225090c13 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -56,7 +56,7 @@ php_apache2_info_struct php_apache2_info; #define SECTION(name) PUTS("

" name "

\n") -static request_rec *php_apache_lookup_uri(char *filename TSRMLS_DC) +static request_rec *php_apache_lookup_uri(char *filename) { php_struct *ctx = SG(server_context); @@ -75,31 +75,31 @@ PHP_FUNCTION(virtual) size_t filename_len; request_rec *rr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { return; } - if (!(rr = php_apache_lookup_uri(filename TSRMLS_CC))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); + if (!(rr = php_apache_lookup_uri(filename))) { + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); RETURN_FALSE; } if (rr->status != HTTP_OK) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", filename); + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - error finding URI", filename); ap_destroy_sub_req(rr); RETURN_FALSE; } /* Flush everything. */ - php_output_end_all(TSRMLS_C); - php_header(TSRMLS_C); + php_output_end_all(); + php_header(); /* Ensure that the ap_r* layer for the main request is flushed, to * work around http://issues.apache.org/bugzilla/show_bug.cgi?id=17629 */ ap_rflush(rr->main); if (ap_run_sub_req(rr)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - request execution failed", filename); + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - request execution failed", filename); ap_destroy_sub_req(rr); RETURN_FALSE; } @@ -121,12 +121,12 @@ PHP_FUNCTION(apache_lookup_uri) char *filename; size_t filename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { return; } - if (!(rr = php_apache_lookup_uri(filename TSRMLS_CC))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); + if (!(rr = php_apache_lookup_uri(filename))) { + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - URI lookup failed", filename); RETURN_FALSE; } @@ -163,7 +163,7 @@ PHP_FUNCTION(apache_lookup_uri) return; } - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include '%s' - error finding URI", filename); + php_error_docref(NULL, E_WARNING, "Unable to include '%s' - error finding URI", filename); ap_destroy_sub_req(rr); RETURN_FALSE; } @@ -225,7 +225,7 @@ PHP_FUNCTION(apache_note) size_t note_name_len, note_val_len; char *old_note_val=NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¬e_name, ¬e_name_len, ¬e_val, ¬e_val_len) == FAILURE) { return; } @@ -259,7 +259,7 @@ PHP_FUNCTION(apache_setenv) int arg_count = ZEND_NUM_ARGS(); request_rec *r; - if (zend_parse_parameters(arg_count TSRMLS_CC, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) { + if (zend_parse_parameters(arg_count, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) { return; } @@ -295,7 +295,7 @@ PHP_FUNCTION(apache_getenv) char *env_val=NULL; request_rec *r; - if (zend_parse_parameters(arg_count TSRMLS_CC, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) { + if (zend_parse_parameters(arg_count, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) { return; } diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 3b93c74f7a..1284b3e879 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -76,7 +76,7 @@ ZEND_TSRMLS_CACHE_DEFINE; #endif static size_t -php_apache_sapi_ub_write(const char *str, size_t str_length TSRMLS_DC) +php_apache_sapi_ub_write(const char *str, size_t str_length) { request_rec *r; php_struct *ctx; @@ -92,7 +92,7 @@ php_apache_sapi_ub_write(const char *str, size_t str_length TSRMLS_DC) } static int -php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) +php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers) { php_struct *ctx; char *val, *ptr; @@ -154,7 +154,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e } static int -php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) +php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers) { php_struct *ctx = SG(server_context); const char *sline = SG(sapi_headers).http_status_line; @@ -174,7 +174,7 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) /* call ap_set_content_type only once, else each time we call it, configured output filters for that content type will be added */ if (!ctx->content_type) { - ctx->content_type = sapi_get_default_content_type(TSRMLS_C); + ctx->content_type = sapi_get_default_content_type(); } ap_set_content_type(ctx->r, apr_pstrdup(ctx->r->pool, ctx->content_type)); efree(ctx->content_type); @@ -184,7 +184,7 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) } static apr_size_t -php_apache_sapi_read_post(char *buf, size_t count_bytes TSRMLS_DC) +php_apache_sapi_read_post(char *buf, size_t count_bytes) { apr_size_t len, tlen=0; php_struct *ctx = SG(server_context); @@ -216,7 +216,7 @@ php_apache_sapi_read_post(char *buf, size_t count_bytes TSRMLS_DC) } static zend_stat_t* -php_apache_sapi_get_stat(TSRMLS_D) +php_apache_sapi_get_stat(void) { php_struct *ctx = SG(server_context); @@ -241,7 +241,7 @@ php_apache_sapi_get_stat(TSRMLS_D) } static char * -php_apache_sapi_read_cookies(TSRMLS_D) +php_apache_sapi_read_cookies(void) { php_struct *ctx = SG(server_context); const char *http_cookie; @@ -253,7 +253,7 @@ php_apache_sapi_read_cookies(TSRMLS_D) } static char * -php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC) +php_apache_sapi_getenv(char *name, size_t name_len) { php_struct *ctx = SG(server_context); const char *env_var; @@ -268,7 +268,7 @@ php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC) } static void -php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) +php_apache_sapi_register_variables(zval *track_vars_array) { php_struct *ctx = SG(server_context); const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env); @@ -279,18 +279,18 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) if (!val) { val = ""; } - if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (size_t *)&new_val_len TSRMLS_CC)) { - php_register_variable_safe(key, val, new_val_len, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (size_t *)&new_val_len)) { + php_register_variable_safe(key, val, new_val_len, track_vars_array); } APR_ARRAY_FOREACH_CLOSE() - if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (size_t *)&new_val_len TSRMLS_CC)) { - php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (size_t *)&new_val_len)) { + php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array); } } static void -php_apache_sapi_flush(void *server_context TSRMLS_DC) +php_apache_sapi_flush(void *server_context) { php_struct *ctx; request_rec *r; @@ -305,7 +305,7 @@ php_apache_sapi_flush(void *server_context TSRMLS_DC) r = ctx->r; - sapi_send_headers(TSRMLS_C); + sapi_send_headers(); r->status = SG(sapi_headers).http_response_code; SG(headers_sent) = 1; @@ -315,7 +315,7 @@ php_apache_sapi_flush(void *server_context TSRMLS_DC) } } -static void php_apache_sapi_log_message(char *msg TSRMLS_DC) +static void php_apache_sapi_log_message(char *msg) { php_struct *ctx; @@ -328,16 +328,16 @@ static void php_apache_sapi_log_message(char *msg TSRMLS_DC) } } -static void php_apache_sapi_log_message_ex(char *msg, request_rec *r TSRMLS_DC) +static void php_apache_sapi_log_message_ex(char *msg, request_rec *r) { if (r) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, msg, r->filename); } else { - php_apache_sapi_log_message(msg TSRMLS_CC); + php_apache_sapi_log_message(msg); } } -static double php_apache_sapi_get_request_time(TSRMLS_D) +static double php_apache_sapi_get_request_time(void) { php_struct *ctx = SG(server_context); return ((double) apr_time_as_msec(ctx->r->request_time)) / 1000.0; @@ -406,7 +406,6 @@ static apr_status_t php_apache_child_shutdown(void *tmp) static void php_apache_add_version(apr_pool_t *p) { - TSRMLS_FETCH(); if (PG(expose_php)) { ap_add_version_component(p, "PHP/" PHP_VERSION); } @@ -472,7 +471,7 @@ static apr_status_t php_server_context_cleanup(void *data_) return APR_SUCCESS; } -static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) +static int php_apache_request_ctor(request_rec *r, php_struct *ctx) { char *content_length; const char *auth; @@ -499,7 +498,7 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) apr_table_unset(r->headers_out, "ETag"); auth = apr_table_get(r->headers_in, "Authorization"); - php_handle_auth_data(auth TSRMLS_CC); + php_handle_auth_data(auth); if (SG(request_info).auth_user == NULL && r->user) { SG(request_info).auth_user = estrdup(r->user); @@ -507,18 +506,18 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user); - return php_request_startup(TSRMLS_C); + return php_request_startup(); } -static void php_apache_request_dtor(request_rec *r TSRMLS_DC) +static void php_apache_request_dtor(request_rec *r) { php_request_shutdown(NULL); } -static void php_apache_ini_dtor(request_rec *r, request_rec *p TSRMLS_DC) +static void php_apache_ini_dtor(request_rec *r, request_rec *p) { if (strcmp(r->protocol, "INCLUDED")) { - zend_try { zend_ini_deactivate(TSRMLS_C); } zend_end_try(); + zend_try { zend_ini_deactivate(); } zend_end_try(); } else { typedef struct { HashTable config; @@ -551,7 +550,7 @@ static int php_handler(request_rec *r) ZEND_TSRMLS_CACHE_UPDATE; #endif -#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC); +#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req); conf = ap_get_module_config(r->per_dir_config, &php7_module); @@ -596,12 +595,12 @@ normal: } if (r->finfo.filetype == 0) { - php_apache_sapi_log_message_ex("script '%s' not found or unable to stat", r TSRMLS_CC); + php_apache_sapi_log_message_ex("script '%s' not found or unable to stat", r); PHPAP_INI_OFF; return HTTP_NOT_FOUND; } if (r->finfo.filetype == APR_DIR) { - php_apache_sapi_log_message_ex("attempt to invoke directory '%s' as script", r TSRMLS_CC); + php_apache_sapi_log_message_ex("attempt to invoke directory '%s' as script", r); PHPAP_INI_OFF; return HTTP_FORBIDDEN; } @@ -623,7 +622,7 @@ zend_first_try { ctx = SG(server_context); ctx->brigade = brigade; - if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { + if (php_apache_request_ctor(r, ctx)!=SUCCESS) { zend_bailout(); } } else { @@ -634,7 +633,7 @@ zend_first_try { strcmp(parent_req->handler, PHP_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SCRIPT)) { - if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { + if (php_apache_request_ctor(r, ctx)!=SUCCESS) { zend_bailout(); } } @@ -662,7 +661,7 @@ zend_first_try { if (strncmp(r->handler, PHP_SOURCE_MAGIC_TYPE, sizeof(PHP_SOURCE_MAGIC_TYPE) - 1) == 0) { zend_syntax_highlighter_ini syntax_highlighter_ini; php_get_highlight_struct(&syntax_highlighter_ini); - highlight_file((char *)r->filename, &syntax_highlighter_ini TSRMLS_CC); + highlight_file((char *)r->filename, &syntax_highlighter_ini); } else { zend_file_handle zfd; @@ -672,19 +671,19 @@ zend_first_try { zfd.opened_path = NULL; if (!parent_req) { - php_execute_script(&zfd TSRMLS_CC); + php_execute_script(&zfd); } else { - zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, NULL, 1, &zfd); + zend_execute_scripts(ZEND_INCLUDE, NULL, 1, &zfd); } apr_table_set(r->notes, "mod_php_memory_usage", - apr_psprintf(ctx->r->pool, "%" APR_SIZE_T_FMT, zend_memory_peak_usage(1 TSRMLS_CC))); + apr_psprintf(ctx->r->pool, "%" APR_SIZE_T_FMT, zend_memory_peak_usage(1))); } } zend_end_try(); if (!parent_req) { - php_apache_request_dtor(r TSRMLS_CC); + php_apache_request_dtor(r); ctx->request_processed = 1; bucket = apr_bucket_eos_create(r->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(brigade, bucket); -- cgit v1.2.1