summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rwxr-xr-xext/date/config.w322
-rw-r--r--ext/date/config0.m42
-rw-r--r--ext/date/php_date.h2
-rw-r--r--ext/ereg/config.w322
-rw-r--r--ext/ereg/config0.m41
-rw-r--r--ext/ereg/php_ereg.h2
-rw-r--r--ext/filter/config.m42
-rw-r--r--ext/filter/config.w322
-rw-r--r--ext/filter/filter.c6
-rw-r--r--ext/filter/php_filter.h3
-rw-r--r--ext/intl/converter/converter.c12
-rw-r--r--ext/mbstring/config.m42
-rw-r--r--ext/mbstring/config.w322
-rw-r--r--ext/mbstring/mbstring.c7
-rw-r--r--ext/mbstring/mbstring.h3
-rw-r--r--ext/mysql/config.m42
-rw-r--r--ext/mysql/config.w324
-rw-r--r--ext/mysql/php_mysql.c6
-rw-r--r--ext/mysql/php_mysql_structs.h5
-rw-r--r--ext/mysqli/config.m42
-rw-r--r--ext/mysqli/config.w324
-rw-r--r--ext/mysqli/mysqli.c6
-rw-r--r--ext/mysqli/php_mysqli_structs.h5
-rw-r--r--ext/mysqlnd/config.w322
-rw-r--r--ext/mysqlnd/config9.m42
-rw-r--r--ext/mysqlnd/mysqlnd.h5
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c9
-rw-r--r--ext/mysqlnd/mysqlnd_debug.h3
-rw-r--r--ext/mysqlnd/mysqlnd_driver.c4
-rw-r--r--ext/mysqlnd/php_mysqlnd.c6
-rw-r--r--ext/pcre/config.w322
-rw-r--r--ext/pcre/config0.m44
-rw-r--r--ext/pcre/php_pcre.h2
-rwxr-xr-xext/pdo_mysql/config.m42
-rw-r--r--ext/pdo_mysql/config.w322
-rw-r--r--ext/pdo_mysql/pdo_mysql.c6
-rw-r--r--ext/pdo_mysql/php_pdo_mysql_int.h5
-rw-r--r--ext/pgsql/config.m42
-rw-r--r--ext/pgsql/config.w322
-rw-r--r--ext/pgsql/pgsql.c6
-rw-r--r--ext/pgsql/php_pgsql.h5
-rw-r--r--ext/phar/config.m42
-rw-r--r--ext/phar/config.w322
-rw-r--r--ext/phar/phar.c6
-rw-r--r--ext/phar/phar_internal.h7
-rwxr-xr-xext/reflection/config.m42
-rwxr-xr-xext/reflection/config.w324
-rw-r--r--ext/reflection/php_reflection.c2
-rw-r--r--ext/sockets/config.m42
-rw-r--r--ext/sockets/config.w322
-rw-r--r--ext/sockets/php_sockets.h2
-rw-r--r--ext/sockets/sockets.c9
-rwxr-xr-xext/spl/config.m42
-rw-r--r--ext/spl/config.w322
-rw-r--r--ext/spl/php_spl.h2
-rw-r--r--ext/sqlite3/config.w322
-rw-r--r--ext/sqlite3/config0.m42
-rw-r--r--ext/sqlite3/php_sqlite3.h3
-rw-r--r--ext/sqlite3/sqlite3.c6
-rw-r--r--ext/standard/assert.c2
-rw-r--r--ext/standard/basic_functions.h2
-rw-r--r--ext/standard/browscap.c2
-rw-r--r--ext/standard/config.m43
-rw-r--r--ext/standard/config.w323
-rw-r--r--ext/standard/dir.c2
-rw-r--r--ext/standard/file.h2
-rw-r--r--ext/standard/php_array.h2
-rw-r--r--ext/standard/php_lcg.h2
-rw-r--r--ext/tidy/config.m42
-rw-r--r--ext/tidy/config.w321
-rw-r--r--ext/tidy/php_tidy.h5
-rw-r--r--ext/tidy/tidy.c7
-rw-r--r--ext/zlib/config.w322
-rw-r--r--ext/zlib/config0.m42
-rw-r--r--ext/zlib/php_zlib.h2
-rw-r--r--ext/zlib/zlib.c7
76 files changed, 171 insertions, 89 deletions
diff --git a/ext/date/config.w32 b/ext/date/config.w32
index c97df7246c..64a4ae92a1 100755
--- a/ext/date/config.w32
+++ b/ext/date/config.w32
@@ -1,7 +1,7 @@
// $Id$
// vim:ft=javascript
-EXTENSION("date", "php_date.c", false, "-Iext/date/lib");
+EXTENSION("date", "php_date.c", false, "/Iext/date/lib /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES("ext/date/lib", "astro.c timelib.c dow.c parse_date.c parse_tz.c tm2unixtime.c unixtime2tm.c parse_iso_intervals.c interval.c", "date");
AC_DEFINE('HAVE_DATE', 1, 'Have date/time support');
diff --git a/ext/date/config0.m4 b/ext/date/config0.m4
index 0b46c6803a..867e891f52 100644
--- a/ext/date/config0.m4
+++ b/ext/date/config0.m4
@@ -4,7 +4,7 @@ dnl config.m4 for date extension
sinclude(ext/date/lib/timelib.m4)
sinclude(lib/timelib.m4)
-PHP_DATE_CFLAGS="-I@ext_builddir@/lib"
+PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index aa46aa1b6c..d8f825163a 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -197,7 +197,7 @@ ZEND_BEGIN_MODULE_GLOBALS(date)
ZEND_END_MODULE_GLOBALS(date)
#ifdef ZTS
-#define DATEG(v) TSRMG(date_globals_id, zend_date_globals *, v)
+#define DATEG(v) ZEND_TSRMG(date_globals_id, zend_date_globals *, v)
#else
#define DATEG(v) (date_globals.v)
#endif
diff --git a/ext/ereg/config.w32 b/ext/ereg/config.w32
index 18a002b44d..887fb0e5b0 100644
--- a/ext/ereg/config.w32
+++ b/ext/ereg/config.w32
@@ -4,7 +4,7 @@
ARG_WITH("ereg", "POSIX extended regular expressions", "yes");
if (PHP_EREG != "no") {
- EXTENSION("ereg", "ereg.c", PHP_EREG_SHARED, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex");
+ EXTENSION("ereg", "ereg.c", PHP_EREG_SHARED, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES("ext/ereg/regex", "regcomp.c regexec.c regerror.c regfree.c", "ereg");
AC_DEFINE('REGEX', 1, 'Bundled regex');
AC_DEFINE('HSREGEX', 1, 'Bundled regex');
diff --git a/ext/ereg/config0.m4 b/ext/ereg/config0.m4
index caec39d285..2089f24a46 100644
--- a/ext/ereg/config0.m4
+++ b/ext/ereg/config0.m4
@@ -33,6 +33,7 @@ if test "$REGEX_TYPE" = "php"; then
ereg_regex_headers="regex/"
PHP_EREG_CFLAGS="-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp"
fi
+PHP_EREG_CFLAGS="$PHP_EREG_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
PHP_NEW_EXTENSION(ereg, ereg.c $ereg_regex_sources, no,,$PHP_EREG_CFLAGS)
PHP_INSTALL_HEADERS([ext/ereg], [php_ereg.h php_regex.h $ereg_regex_headers])
diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h
index f1c2676772..a1081e2669 100644
--- a/ext/ereg/php_ereg.h
+++ b/ext/ereg/php_ereg.h
@@ -54,7 +54,7 @@ ZEND_END_MODULE_GLOBALS(ereg)
PHP_MINFO_FUNCTION(ereg);
#ifdef ZTS
-#define EREG(v) TSRMG(ereg_globals_id, zend_ereg_globals *, v)
+#define EREG(v) ZEND_TSRMG(ereg_globals_id, zend_ereg_globals *, v)
#else
#define EREG(v) (ereg_globals.v)
#endif
diff --git a/ext/filter/config.m4 b/ext/filter/config.m4
index 676f5d99ef..93ca2cba25 100644
--- a/ext/filter/config.m4
+++ b/ext/filter/config.m4
@@ -39,7 +39,7 @@ yes
CPPFLAGS=$old_CPPFLAGS
fi
- PHP_NEW_EXTENSION(filter, filter.c sanitizing_filters.c logical_filters.c callback_filter.c, $ext_shared)
+ PHP_NEW_EXTENSION(filter, filter.c sanitizing_filters.c logical_filters.c callback_filter.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(FILTER_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/filter/php_filter.h])
diff --git a/ext/filter/config.w32 b/ext/filter/config.w32
index b74f3a2fd0..0a9e147569 100644
--- a/ext/filter/config.w32
+++ b/ext/filter/config.w32
@@ -4,6 +4,6 @@
ARG_ENABLE("filter", "Filter Support", "yes");
if (PHP_FILTER == "yes") {
- EXTENSION("filter", "filter.c sanitizing_filters.c logical_filters.c callback_filter.c");
+ EXTENSION("filter", "filter.c sanitizing_filters.c logical_filters.c callback_filter.c", PHP_FILTER_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
PHP_INSTALL_HEADERS("ext/filter", "php_filter.h");
}
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index 530dce6f53..fcea5a803a 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -152,6 +152,9 @@ zend_module_entry filter_module_entry = {
/* }}} */
#ifdef COMPILE_DL_FILTER
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(filter)
#endif
@@ -191,6 +194,9 @@ PHP_INI_END()
static void php_filter_init_globals(zend_filter_globals *filter_globals) /* {{{ */
{
+#if defined(COMPILE_DL_FILTER) && defined(ZTS)
+ZEND_TSRMLS_CACHE_UPDATE;
+#endif
ZVAL_UNDEF(&filter_globals->post_array);
ZVAL_UNDEF(&filter_globals->get_array);
ZVAL_UNDEF(&filter_globals->cookie_array);
diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h
index 126a0c6c8b..a1e7e6602c 100644
--- a/ext/filter/php_filter.h
+++ b/ext/filter/php_filter.h
@@ -64,7 +64,8 @@ ZEND_BEGIN_MODULE_GLOBALS(filter)
ZEND_END_MODULE_GLOBALS(filter)
#ifdef ZTS
-#define IF_G(v) TSRMG(filter_globals_id, zend_filter_globals *, v)
+#define IF_G(v) ZEND_TSRMG(filter_globals_id, zend_filter_globals *, v)
+ZEND_TSRMLS_CACHE_EXTERN;
#else
#define IF_G(v) (filter_globals.v)
#endif
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index b27652aa9a..eb37ce00f1 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -24,9 +24,6 @@
#include "../intl_error.h"
typedef struct _php_converter_object {
-#ifdef ZTS
- void ***tsrm_ls;
-#endif
UConverter *src, *dest;
zend_fcall_info to_cb, from_cb;
zend_fcall_info_cache to_cache, from_cache;
@@ -229,9 +226,6 @@ static void php_converter_to_u_callback(const void *context,
php_converter_object *objval = (php_converter_object*)context;
zval retval;
zval zargs[4];
-#ifdef ZTS
- TSRMLS_D = objval->tsrm_ls;
-#endif
ZVAL_LONG(&zargs[0], reason);
ZVAL_STRINGL(&zargs[1], args->source, args->sourceLimit - args->source);
@@ -308,9 +302,6 @@ static void php_converter_from_u_callback(const void *context,
zval retval;
zval zargs[4];
int i;
-#ifdef ZTS
- TSRMLS_D = objval->tsrm_ls;
-#endif
ZVAL_LONG(&zargs[0], reason);
array_init(&zargs[1]);
@@ -1045,9 +1036,6 @@ static zend_object *php_converter_object_ctor(zend_class_entry *ce, php_converte
objval = ecalloc(1, sizeof(php_converter_object) + sizeof(zval) * (ce->default_properties_count - 1));
zend_object_std_init(&objval->obj, ce TSRMLS_CC );
-#ifdef ZTS
- objval->tsrm_ls = TSRMLS_C;
-#endif
intl_error_init(&(objval->error) TSRMLS_CC);
objval->obj.handlers = &php_converter_object_handlers;
diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4
index 25bf238761..c7ae3f99ae 100644
--- a/ext/mbstring/config.m4
+++ b/ext/mbstring/config.m4
@@ -47,7 +47,7 @@ AC_DEFUN([PHP_MBSTRING_EXTENSION], [
PHP_ADD_SOURCES(PHP_EXT_DIR(mbstring), $PHP_MBSTRING_BASE_SOURCES)
out="php_config.h"
else
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mbstring),$PHP_MBSTRING_BASE_SOURCES,,shared_objects_mbstring,yes)
+ PHP_ADD_SOURCES_X(PHP_EXT_DIR(mbstring),$PHP_MBSTRING_BASE_SOURCES, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,shared_objects_mbstring,yes)
if test -f "$ext_builddir/config.h.in"; then
out="$abs_builddir/config.h"
else
diff --git a/ext/mbstring/config.w32 b/ext/mbstring/config.w32
index 6b7e05a329..27a8143686 100644
--- a/ext/mbstring/config.w32
+++ b/ext/mbstring/config.w32
@@ -16,7 +16,7 @@ if (PHP_MBSTRING != "no") {
"-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
-Iext/mbstring/oniguruma /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 \
/D HAVE_STDARG_PROTOTYPES=1 /D HAVE_CONFIG_H /D HAVE_STDLIB_H \
- /D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D EXPORT");
+ /D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D EXPORT /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES("ext/mbstring/libmbfl/filters", "html_entities.c \
mbfilter_7bit.c mbfilter_ascii.c mbfilter_base64.c mbfilter_big5.c \
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 691391ab92..4cc73423d8 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -597,6 +597,9 @@ static sapi_post_entry php_post_entries[] = {
/* }}} */
#ifdef COMPILE_DL_MBSTRING
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(mbstring)
#endif
@@ -1491,6 +1494,10 @@ PHP_INI_END()
/* {{{ module global initialize handler */
static PHP_GINIT_FUNCTION(mbstring)
{
+#if defined(COMPILE_DL_MBSTRING) && defined(ZTS)
+ZEND_TSRMLS_CACHE_UPDATE;
+#endif
+
mbstring_globals->language = mbfl_no_language_uni;
mbstring_globals->internal_encoding = NULL;
mbstring_globals->current_internal_encoding = mbstring_globals->internal_encoding;
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
index 0136f8ef7d..bc6434f81f 100644
--- a/ext/mbstring/mbstring.h
+++ b/ext/mbstring/mbstring.h
@@ -200,7 +200,8 @@ struct mb_overload_def {
};
#ifdef ZTS
-#define MBSTRG(v) TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
+#define MBSTRG(v) ZEND_TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
+ZEND_TSRMLS_CACHE_EXTERN;
#else
#define MBSTRG(v) (mbstring_globals.v)
#endif
diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4
index fd7f52ef3a..70bfd7110b 100644
--- a/ext/mysql/config.m4
+++ b/ext/mysql/config.m4
@@ -158,7 +158,7 @@ if test "$PHP_MYSQL" != "no"; then
fi
AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
- PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared)
+ PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(MYSQL_SHARED_LIBADD)
if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then
diff --git a/ext/mysql/config.w32 b/ext/mysql/config.w32
index 2a929b4165..0af94d9623 100644
--- a/ext/mysql/config.w32
+++ b/ext/mysql/config.w32
@@ -10,7 +10,7 @@ if (PHP_MYSQL != "no") {
PHP_MYSQL = "no";
WARNING("mysql not enabled; mysqlnd is not enabled");
} else {
- EXTENSION("mysql", "php_mysql.c");
+ EXTENSION("mysql", "php_mysql.c", PHP_MYSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library');
MESSAGE("\tusing mysqlnd build");
}
@@ -18,7 +18,7 @@ if (PHP_MYSQL != "no") {
if (CHECK_LIB("libmysql.lib", "mysql", PHP_MYSQL) &&
CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQL",
PHP_MYSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\mysql;" + PHP_MYSQL)) {
- EXTENSION("mysql", "php_mysql.c");
+ EXTENSION("mysql", "php_mysql.c", PHP_MYSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library');
MESSAGE("\tusing libmysql");
} else {
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index fc1dac5da7..9454577a98 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -358,6 +358,9 @@ zend_module_entry mysql_module_entry = {
/* }}} */
#ifdef COMPILE_DL_MYSQL
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(mysql)
#endif
@@ -518,6 +521,9 @@ PHP_INI_END()
*/
static PHP_GINIT_FUNCTION(mysql)
{
+#if defined(COMPILE_DL_MYSQL) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
mysql_globals->num_persistent = 0;
mysql_globals->default_socket = NULL;
mysql_globals->default_host = NULL;
diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h
index 8eb9aa1d29..214a5c689b 100644
--- a/ext/mysql/php_mysql_structs.h
+++ b/ext/mysql/php_mysql_structs.h
@@ -127,7 +127,10 @@ ZEND_BEGIN_MODULE_GLOBALS(mysql)
ZEND_END_MODULE_GLOBALS(mysql)
#ifdef ZTS
-# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
+# define MySG(v) ZEND_TSRMG(mysql_globals_id, zend_mysql_globals *, v)
+# ifdef COMPILE_DL_MYSQL
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
#else
# define MySG(v) (mysql_globals.v)
#endif
diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4
index f6c86e762b..dedd1bc4a7 100644
--- a/ext/mysqli/config.m4
+++ b/ext/mysqli/config.m4
@@ -75,7 +75,7 @@ if test "$PHP_MYSQLI" != "no"; then
mysqli_sources="mysqli.c mysqli_api.c mysqli_prop.c mysqli_nonapi.c \
mysqli_fe.c mysqli_report.c mysqli_driver.c mysqli_warning.c \
mysqli_exception.c mysqli_result_iterator.c $mysqli_extra_sources"
- PHP_NEW_EXTENSION(mysqli, $mysqli_sources, $ext_shared)
+ PHP_NEW_EXTENSION(mysqli, $mysqli_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(MYSQLI_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/mysqli/php_mysqli_structs.h])
diff --git a/ext/mysqli/config.w32 b/ext/mysqli/config.w32
index ab8bcd0087..9213931393 100644
--- a/ext/mysqli/config.w32
+++ b/ext/mysqli/config.w32
@@ -23,7 +23,7 @@ if (PHP_MYSQLI != "no") {
"mysqli_warning.c";
if (PHP_MYSQLI == "yes" || PHP_MYSQLI == "mysqlnd") {
- EXTENSION("mysqli", mysqli_source);
+ EXTENSION("mysqli", mysqli_source, PHP_MYSQLI_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('MYSQLI_USE_MYSQLND', 1, 'Using MySQL native driver');
AC_DEFINE('HAVE_MYSQLILIB', 1, 'Have MySQLi library');
ADD_EXTENSION_DEP('mysqli', 'mysqlnd', true);
@@ -34,7 +34,7 @@ if (PHP_MYSQLI != "no") {
CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQLI", PHP_MYSQLI +
"\\include;" + PHP_PHP_BUILD +
"\\include\\mysql;" + PHP_MYSQLI)) {
- EXTENSION("mysqli", mysqli_source);
+ EXTENSION("mysqli", mysqli_source, PHP_MYSQLI_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_MYSQLILIB', 1, 'Have MySQLi library');
MESSAGE("\tlibmysql build");
PHP_INSTALL_HEADERS("ext/mysqli", "php_mysqli_structs.h");
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 878c8fb946..490da81ad0 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -537,6 +537,9 @@ PHP_INI_END()
*/
static PHP_GINIT_FUNCTION(mysqli)
{
+#if defined(COMPILE_DL_MYSQLI) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
mysqli_globals->num_links = 0;
mysqli_globals->num_active_persistent = 0;
mysqli_globals->num_inactive_persistent = 0;
@@ -1030,6 +1033,9 @@ zend_module_entry mysqli_module_entry = {
/* }}} */
#ifdef COMPILE_DL_MYSQLI
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(mysqli)
#endif
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index d815df3eee..cf12c5bba5 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -344,7 +344,10 @@ ZEND_END_MODULE_GLOBALS(mysqli)
#ifdef ZTS
-#define MyG(v) TSRMG(mysqli_globals_id, zend_mysqli_globals *, v)
+#define MyG(v) ZEND_TSRMG(mysqli_globals_id, zend_mysqli_globals *, v)
+#ifdef COMPILE_DL_MYSQLI
+ZEND_TSRMLS_CACHE_EXTERN;
+#endif
#else
#define MyG(v) (mysqli_globals.v)
#endif
diff --git a/ext/mysqlnd/config.w32 b/ext/mysqlnd/config.w32
index b13a81530a..ff102310dd 100644
--- a/ext/mysqlnd/config.w32
+++ b/ext/mysqlnd/config.w32
@@ -25,7 +25,7 @@ if (PHP_MYSQLND != "no") {
"mysqlnd_statistics.c " +
"mysqlnd_wireprotocol.c " +
"php_mysqlnd.c ";
- EXTENSION("mysqlnd", mysqlnd_source, false);
+ EXTENSION("mysqlnd", mysqlnd_source, false, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
if ((((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "mysqlnd", PHP_MYSQLND))) ||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "mysqlnd", PHP_MYSQLND)) ||
(PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4
index 1a0136d8db..756a325014 100644
--- a/ext/mysqlnd/config9.m4
+++ b/ext/mysqlnd/config9.m4
@@ -41,7 +41,7 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes"; then
fi
mysqlnd_sources="$mysqlnd_base_sources $mysqlnd_ps_sources"
- PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, $ext_shared)
+ PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
PHP_INSTALL_HEADERS([ext/mysqlnd/])
fi
diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h
index 1a23781eb0..aca440c273 100644
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -288,7 +288,10 @@ ZEND_END_MODULE_GLOBALS(mysqlnd)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd)
#ifdef ZTS
-#define MYSQLND_G(v) TSRMG(mysqlnd_globals_id, zend_mysqlnd_globals *, v)
+#define MYSQLND_G(v) ZEND_TSRMG(mysqlnd_globals_id, zend_mysqlnd_globals *, v)
+#ifdef COMPILE_DL_MYSQLND
+ZEND_TSRMLS_CACHE_EXTERN;
+#endif
#else
#define MYSQLND_G(v) (mysqlnd_globals.v)
#endif
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index f1fde4efbb..c8f682b8e2 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.c
@@ -39,8 +39,6 @@ static const char * const mysqlnd_debug_empty_string = "";
static enum_func_status
MYSQLND_METHOD(mysqlnd_debug, open)(MYSQLND_DEBUG * self, zend_bool reopen)
{
- MYSQLND_ZTS(self);
-
if (!self->file_name) {
return FAIL;
}
@@ -67,7 +65,6 @@ MYSQLND_METHOD(mysqlnd_debug, log)(MYSQLND_DEBUG * self,
unsigned int flags = self->flags;
char pid_buffer[10], time_buffer[30], file_buffer[200],
line_buffer[6], level_buffer[7];
- MYSQLND_ZTS(self);
if (!self->stream && FAIL == self->m->open(self, FALSE)) {
return FAIL;
@@ -165,7 +162,6 @@ MYSQLND_METHOD(mysqlnd_debug, log_va)(MYSQLND_DEBUG *self,
unsigned int flags = self->flags;
char pid_buffer[10], time_buffer[30], file_buffer[200],
line_buffer[6], level_buffer[7];
- MYSQLND_ZTS(self);
if (!self->stream && FAIL == self->m->open(self, FALSE)) {
return FAIL;
@@ -436,7 +432,6 @@ MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int lin
static enum_func_status
MYSQLND_METHOD(mysqlnd_debug, close)(MYSQLND_DEBUG * self)
{
- MYSQLND_ZTS(self);
if (self->stream) {
#ifndef MYSQLND_PROFILING_DISABLED
if (!(self->flags & MYSQLND_DEBUG_FLUSH) && (self->flags & MYSQLND_DEBUG_PROFILE_CALLS)) {
@@ -718,9 +713,7 @@ PHPAPI MYSQLND_DEBUG *
mysqlnd_debug_init(const char * skip_functions[] TSRMLS_DC)
{
MYSQLND_DEBUG *ret = calloc(1, sizeof(MYSQLND_DEBUG));
-#ifdef ZTS
- ret->TSRMLS_C = TSRMLS_C;
-#endif
+
ret->nest_level_limit = 0;
ret->pid = getpid();
zend_stack_init(&ret->call_stack, sizeof(char *));
diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h
index bb4ff3e895..e8dfeb6c4a 100644
--- a/ext/mysqlnd/mysqlnd_debug.h
+++ b/ext/mysqlnd/mysqlnd_debug.h
@@ -45,9 +45,6 @@ struct st_mysqlnd_debug_methods
struct st_mysqlnd_debug
{
php_stream *stream;
-#ifdef ZTS
- TSRMLS_D;
-#endif
unsigned int flags;
unsigned int nest_level_limit;
int pid;
diff --git a/ext/mysqlnd/mysqlnd_driver.c b/ext/mysqlnd/mysqlnd_driver.c
index e67d023edb..a35474b9e6 100644
--- a/ext/mysqlnd/mysqlnd_driver.c
+++ b/ext/mysqlnd/mysqlnd_driver.c
@@ -99,9 +99,7 @@ static void
mysqlnd_error_list_pdtor(void * pDest)
{
MYSQLND_ERROR_LIST_ELEMENT * element = (MYSQLND_ERROR_LIST_ELEMENT *) pDest;
-#ifdef ZTS
- TSRMLS_FETCH();
-#endif
+
DBG_ENTER("mysqlnd_error_list_pdtor");
if (element->error) {
mnd_pefree(element->error, TRUE);
diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index a16018f6ba..71512e8d46 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.c
@@ -179,6 +179,9 @@ PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd)
*/
static PHP_GINIT_FUNCTION(mysqlnd)
{
+#if defined(COMPILE_DL_MYSQLND) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
mysqlnd_globals->collect_statistics = TRUE;
mysqlnd_globals->collect_memory_statistics = FALSE;
mysqlnd_globals->debug = NULL; /* The actual string */
@@ -357,6 +360,9 @@ zend_module_entry mysqlnd_module_entry = {
/* {{{ COMPILE_DL_MYSQLND */
#ifdef COMPILE_DL_MYSQLND
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(mysqlnd)
#endif
/* }}} */
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
index 594b1cb474..1fe4b687f6 100644
--- a/ext/pcre/config.w32
+++ b/ext/pcre/config.w32
@@ -2,7 +2,7 @@
// vim:ft=javascript
EXTENSION("pcre", "php_pcre.c", false /* never shared */,
- "-Iext/pcre/pcrelib");
+ "-Iext/pcre/pcrelib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES("ext/pcre/pcrelib", "pcre_chartables.c pcre_ucd.c pcre_compile.c pcre_config.c pcre_exec.c pcre_fullinfo.c pcre_get.c pcre_globals.c pcre_maketables.c pcre_newline.c pcre_ord2utf8.c pcre_refcount.c pcre_study.c pcre_tables.c pcre_valid_utf8.c pcre_version.c pcre_xclass.c pcre_jit_compile.c", "pcre");
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index bfe2009aa0..3c0875f1af 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -47,7 +47,7 @@ PHP_ARG_WITH(pcre-regex,,
AC_DEFINE(HAVE_PCRE, 1, [ ])
PHP_ADD_INCLUDE($PCRE_INCDIR)
- PHP_NEW_EXTENSION(pcre, php_pcre.c, no)
+ PHP_NEW_EXTENSION(pcre, php_pcre.c, no, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h])
else
AC_MSG_CHECKING([for PCRE library to use])
@@ -60,7 +60,7 @@ PHP_ARG_WITH(pcre-regex,,
pcrelib/pcre_tables.c pcrelib/pcre_valid_utf8.c \
pcrelib/pcre_version.c pcrelib/pcre_xclass.c \
pcrelib/pcre_jit_compile.c"
- PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib"
+ PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/])
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index cd6621372f..a7d69adbc6 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -79,7 +79,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pcre)
ZEND_END_MODULE_GLOBALS(pcre)
#ifdef ZTS
-# define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v)
+# define PCRE_G(v) ZEND_TSRMG(pcre_globals_id, zend_pcre_globals *, v)
#else
# define PCRE_G(v) (pcre_globals.v)
#endif
diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4
index f237f413be..95ae6ca7ed 100755
--- a/ext/pdo_mysql/config.m4
+++ b/ext/pdo_mysql/config.m4
@@ -144,7 +144,7 @@ if test "$PHP_PDO_MYSQL" != "no"; then
fi
dnl fix after renaming to pdo_mysql
- PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_cv_inc_path -I)
+ PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_cv_inc_path -I -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
ifdef([PHP_ADD_EXTENSION_DEP],
[
PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo)
diff --git a/ext/pdo_mysql/config.w32 b/ext/pdo_mysql/config.w32
index da085dc569..f150916b2a 100644
--- a/ext/pdo_mysql/config.w32
+++ b/ext/pdo_mysql/config.w32
@@ -12,7 +12,7 @@ if (PHP_PDO_MYSQL != "no") {
} else {
if (CHECK_LIB("libmysql.lib", "pdo_mysql", PHP_PDO_MYSQL) &&
CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_PDO_MYSQL", PHP_PHP_BUILD + "\\include\\mysql;" + PHP_PDO_MYSQL)) {
- EXTENSION("pdo_mysql", "pdo_mysql.c mysql_driver.c mysql_statement.c");
+ EXTENSION("pdo_mysql", "pdo_mysql.c mysql_driver.c mysql_statement.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
} else {
WARNING("pdo_mysql not enabled; libraries and headers not found");
}
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index d9c04470a4..82dbdbc83a 100644
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -32,6 +32,9 @@
#include "php_pdo_mysql_int.h"
#ifdef COMPILE_DL_PDO_MYSQL
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(pdo_mysql)
#endif
@@ -206,6 +209,9 @@ static PHP_RSHUTDOWN_FUNCTION(pdo_mysql)
*/
static PHP_GINIT_FUNCTION(pdo_mysql)
{
+#if defined(COMPILE_DL_PDO_MYSQL) && defined(ZTS)
+ZEND_TSRMLS_CACHE_UPDATE;
+#endif
#ifndef PHP_WIN32
pdo_mysql_globals->default_socket = NULL;
#endif
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index f6cdb0a8f2..accac8a25e 100644
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.h
@@ -83,7 +83,10 @@ ZEND_END_MODULE_GLOBALS(pdo_mysql)
ZEND_EXTERN_MODULE_GLOBALS(pdo_mysql)
#ifdef ZTS
-#define PDO_MYSQL_G(v) TSRMG(pdo_mysql_globals_id, zend_pdo_mysql_globals *, v)
+#define PDO_MYSQL_G(v) ZEND_TSRMG(pdo_mysql_globals_id, zend_pdo_mysql_globals *, v)
+# ifdef COMPILE_DL_PDO_MYSQL
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
#else
#define PDO_MYSQL_G(v) (pdo_mysql_globals.v)
#endif
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
index 186469861f..bd3470eac5 100644
--- a/ext/pgsql/config.m4
+++ b/ext/pgsql/config.m4
@@ -105,7 +105,7 @@ if test "$PHP_PGSQL" != "no"; then
PHP_ADD_INCLUDE($PGSQL_INCLUDE)
- PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared)
+ PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
diff --git a/ext/pgsql/config.w32 b/ext/pgsql/config.w32
index d38048d90b..5775dfa023 100644
--- a/ext/pgsql/config.w32
+++ b/ext/pgsql/config.w32
@@ -6,7 +6,7 @@ ARG_WITH("pgsql", "PostgreSQL support", "no");
if (PHP_PGSQL != "no") {
if (CHECK_LIB("libpq.lib", "pgsql", PHP_PGSQL) &&
CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PGSQL", PHP_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;" + PHP_PGSQL)) {
- EXTENSION("pgsql", "pgsql.c");
+ EXTENSION("pgsql", "pgsql.c", PHP_PGSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
ADD_FLAG("CFLAGS_PGSQL", "/D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE /D HAVE_PQESCAPE_CONN /D HAVE_PQESCAPE_BYTEA_CONN /D HAVE_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT /D HAVE_PQPROTOCOLVERSION /D HAVE_PG_LO_CREATE /D HAVE_PG_LO_IMPORT_WITH_OID /D HAVE_PG_LO_TRUNCATE /D HAVE_PG_LO64 /D HAVE_PQESCAPELITERAL /D HAVE_PQOIDVALUE");
} else {
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 207764b165..3645e0a897 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -771,6 +771,9 @@ zend_module_entry pgsql_module_entry = {
/* }}} */
#ifdef COMPILE_DL_PGSQL
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(pgsql)
#endif
@@ -1090,6 +1093,9 @@ PHP_INI_END()
*/
static PHP_GINIT_FUNCTION(pgsql)
{
+#if defined(COMPILE_DL_PGSQL) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
memset(pgsql_globals, 0, sizeof(zend_pgsql_globals));
/* Initilize notice message hash at MINIT only */
zend_hash_init_ex(&pgsql_globals->notices, 0, NULL, PHP_PGSQL_NOTICE_PTR_DTOR, 1, 0);
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index 661c02f77f..18f1bbe77f 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -322,7 +322,10 @@ ZEND_END_MODULE_GLOBALS(pgsql)
ZEND_EXTERN_MODULE_GLOBALS(pgsql)
#ifdef ZTS
-# define PGG(v) TSRMG(pgsql_globals_id, zend_pgsql_globals *, v)
+# define PGG(v) ZEND_TSRMG(pgsql_globals_id, zend_pgsql_globals *, v)
+# ifdef COMPILE_DL_PGSQL
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
#else
# define PGG(v) (pgsql_globals.v)
#endif
diff --git a/ext/phar/config.m4 b/ext/phar/config.m4
index 614d672eab..1ba7ecdef1 100644
--- a/ext/phar/config.m4
+++ b/ext/phar/config.m4
@@ -5,7 +5,7 @@ PHP_ARG_ENABLE(phar, for phar archive support,
[ --disable-phar Disable phar support], yes)
if test "$PHP_PHAR" != "no"; then
- PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared)
+ PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
AC_MSG_CHECKING([for phar openssl support])
if test "$PHP_HASH_SHARED" != "yes"; then
if test "$PHP_HASH" != "no"; then
diff --git a/ext/phar/config.w32 b/ext/phar/config.w32
index 93504f61fb..6dba20affb 100644
--- a/ext/phar/config.w32
+++ b/ext/phar/config.w32
@@ -9,7 +9,7 @@ if (PHP_PHAR_NATIVE_SSL != "no") {
}
if (PHP_PHAR != "no") {
- EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c util.c zip.c");
+ EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c util.c zip.c", PHP_PHAR_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
if (PHP_PHAR_SHARED || (PHP_PHAR_NATIVE_SSL_SHARED && PHP_SNAPSHOT_BUILD == "no")) {
ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR ");
}
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index cdc61fee88..5e0ccb57b3 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -3228,6 +3228,9 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
/* }}} */
#ifdef COMPILE_DL_PHAR
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(phar)
#endif
@@ -3335,6 +3338,9 @@ static void mime_type_dtor(zval *zv)
PHP_GINIT_FUNCTION(phar) /* {{{ */
{
+#if defined(COMPILE_DL_PHAR) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
phar_mime_type mime;
memset(phar_globals, 0, sizeof(zend_phar_globals));
diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
index f49143bc8c..7fe647b97d 100644
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@ -196,8 +196,11 @@ ZEND_EXTERN_MODULE_GLOBALS(phar)
#ifdef ZTS
# include "TSRM.h"
-# define PHAR_G(v) TSRMG(phar_globals_id, zend_phar_globals *, v)
-# define PHAR_GLOBALS ((zend_phar_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(phar_globals_id)])
+# ifdef COMPILE_DL_PHAR
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
+# define PHAR_G(v) ZEND_TSRMG(phar_globals_id, zend_phar_globals *, v)
+# define PHAR_GLOBALS ((zend_phar_globals *) (*((void ***) ZEND_TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(phar_globals_id)])
#else
# define PHAR_G(v) (phar_globals.v)
# define PHAR_GLOBALS (&phar_globals)
diff --git a/ext/reflection/config.m4 b/ext/reflection/config.m4
index 702663677b..334d7dc471 100755
--- a/ext/reflection/config.m4
+++ b/ext/reflection/config.m4
@@ -2,4 +2,4 @@ dnl $Id$
dnl config.m4 for extension reflection
AC_DEFINE(HAVE_REFLECTION, 1, [Whether Reflection is enabled])
-PHP_NEW_EXTENSION(reflection, php_reflection.c, no)
+PHP_NEW_EXTENSION(reflection, php_reflection.c, no, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
diff --git a/ext/reflection/config.w32 b/ext/reflection/config.w32
index 724bf7bde4..2eb33c66ee 100755
--- a/ext/reflection/config.w32
+++ b/ext/reflection/config.w32
@@ -1,6 +1,6 @@
// $Id$
// vim:ft=javascript
-EXTENSION("reflection", "php_reflection.c", false /* never shared */);
+EXTENSION("reflection", "php_reflection.c", false /* never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_REFLECTION', 1, 'Reflection support enabled');
-PHP_REFLECTION="yes"; \ No newline at end of file
+PHP_REFLECTION="yes";
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 57e11945c1..73da5c0a5e 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -70,7 +70,7 @@ ZEND_END_MODULE_GLOBALS(reflection)
#ifdef ZTS
# define REFLECTION_G(v) \
- TSRMG(reflection_globals_id, zend_reflection_globals*, v)
+ ZEND_TSRMG(reflection_globals_id, zend_reflection_globals*, v)
extern int reflection_globals_id;
#else
# define REFLECTION_G(v) (reflection_globals.v)
diff --git a/ext/sockets/config.m4 b/ext/sockets/config.m4
index a5a63dfb61..cea27000cf 100644
--- a/ext/sockets/config.m4
+++ b/ext/sockets/config.m4
@@ -56,6 +56,6 @@ if test "$PHP_SOCKETS" != "no"; then
AC_DEFINE(HAVE_AI_V4MAPPED,1,[Whether you have AI_V4MAPPED])
fi
- PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c], [$ext_shared])
+ PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c], [$ext_shared],, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h])
fi
diff --git a/ext/sockets/config.w32 b/ext/sockets/config.w32
index aeaa8ed425..d3455b05dd 100644
--- a/ext/sockets/config.w32
+++ b/ext/sockets/config.w32
@@ -7,7 +7,7 @@ if (PHP_SOCKETS != "no") {
if (CHECK_LIB("ws2_32.lib", "sockets", PHP_SOCKETS)
&& CHECK_LIB("Iphlpapi.lib", "sockets", PHP_SOCKETS)
&& CHECK_HEADER_ADD_INCLUDE("winsock.h", "CFLAGS_SOCKETS")) {
- EXTENSION('sockets', 'sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c');
+ EXTENSION('sockets', 'sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c', PHP_SOCKETS_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_SOCKETS', 1);
PHP_INSTALL_HEADERS("ext/sockets", "php_sockets.h");
} else {
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index b1ee5798c9..8a25f960a3 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -89,7 +89,7 @@ ZEND_BEGIN_MODULE_GLOBALS(sockets)
ZEND_END_MODULE_GLOBALS(sockets)
#ifdef ZTS
-#define SOCKETS_G(v) TSRMG(sockets_globals_id, zend_sockets_globals *, v)
+#define SOCKETS_G(v) ZEND_TSRMG(sockets_globals_id, zend_sockets_globals *, v)
#else
#define SOCKETS_G(v) (sockets_globals.v)
#endif
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 0dab51bed6..263b8c45f7 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -370,6 +370,9 @@ zend_module_entry sockets_module_entry = {
#ifdef COMPILE_DL_SOCKETS
+#ifdef ZTS
+ ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(sockets)
#endif
@@ -600,6 +603,9 @@ char *sockets_strerror(int error TSRMLS_DC) /* {{{ */
/* {{{ PHP_GINIT_FUNCTION */
static PHP_GINIT_FUNCTION(sockets)
{
+#if defined(COMPILE_DL_SOCKETS) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
sockets_globals->last_error = 0;
sockets_globals->strerror_buf = NULL;
}
@@ -609,6 +615,9 @@ static PHP_GINIT_FUNCTION(sockets)
*/
static PHP_MINIT_FUNCTION(sockets)
{
+#if defined(COMPILE_DL_SOCKETS) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number);
REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/spl/config.m4 b/ext/spl/config.m4
index a0f0d1a06d..869e542ef4 100755
--- a/ext/spl/config.m4
+++ b/ext/spl/config.m4
@@ -22,6 +22,6 @@ int main(int argc, char **argv) {
CPPFLAGS=$old_CPPFLAGS
AC_DEFINE_UNQUOTED(HAVE_PACKED_OBJECT_VALUE, $ac_result, [Whether struct _zend_object_value is packed])
AC_DEFINE(HAVE_SPL, 1, [Whether you want SPL (Standard PHP Library) support])
- PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c, no)
+ PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h])
PHP_ADD_EXTENSION_DEP(spl, pcre, true)
diff --git a/ext/spl/config.w32 b/ext/spl/config.w32
index 77cbd20346..56c466c220 100644
--- a/ext/spl/config.w32
+++ b/ext/spl/config.w32
@@ -1,7 +1,7 @@
// $Id$
// vim:ft=javascript
-EXTENSION("spl", "php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c", false /*never shared */);
+EXTENSION("spl", "php_spl.c spl_functions.c spl_engine.c spl_iterators.c spl_array.c spl_directory.c spl_exceptions.c spl_observer.c spl_dllist.c spl_heap.c spl_fixedarray.c", false /*never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_SPL', 1);
PHP_SPL="yes";
PHP_INSTALL_HEADERS("ext/spl", "php_spl.h spl_array.h spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h spl_iterators.h spl_observer.h spl_dllist.h spl_heap.h spl_fixedarray.h");
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index 534a03885e..8db6f09e6d 100644
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.h
@@ -67,7 +67,7 @@ ZEND_BEGIN_MODULE_GLOBALS(spl)
ZEND_END_MODULE_GLOBALS(spl)
#ifdef ZTS
-# define SPL_G(v) TSRMG(spl_globals_id, zend_spl_globals *, v)
+# define SPL_G(v) ZEND_TSRMG(spl_globals_id, zend_spl_globals *, v)
extern int spl_globals_id;
#else
# define SPL_G(v) (spl_globals.v)
diff --git a/ext/sqlite3/config.w32 b/ext/sqlite3/config.w32
index 8ddb6b9ac8..60dd2fae52 100644
--- a/ext/sqlite3/config.w32
+++ b/ext/sqlite3/config.w32
@@ -5,7 +5,7 @@ ARG_WITH("sqlite3", "SQLite 3 support", "no");
if (PHP_SQLITE3 != "no") {
ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS == "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_ENABLE_COLUMN_METADATA=1 /D SQLITE_CORE=1 /D SQLITE_API=__declspec(dllexport) ");
- EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname);
+ EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname + " /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES(configure_module_dirname + "/libsqlite", "sqlite3.c", "sqlite3");
diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4
index 6959a6f916..bbb1133fe4 100644
--- a/ext/sqlite3/config0.m4
+++ b/ext/sqlite3/config0.m4
@@ -8,7 +8,7 @@ PHP_ARG_WITH(sqlite3, whether to enable the SQLite3 extension,
if test $PHP_SQLITE3 != "no"; then
sqlite3_extra_sources=""
- PHP_SQLITE3_CFLAGS=""
+ PHP_SQLITE3_CFLAGS=" -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 "
dnl when running phpize enable_maintainer_zts is not available
if test -z "$enable_maintainer_zts"; then
diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h
index 5c7dfcfa5a..8f1c500211 100644
--- a/ext/sqlite3/php_sqlite3.h
+++ b/ext/sqlite3/php_sqlite3.h
@@ -32,6 +32,9 @@ ZEND_END_MODULE_GLOBALS(sqlite3)
#ifdef ZTS
# define SQLITE3G(v) TSRMG(sqlite3_globals_id, zend_sqlite3_globals *, v)
+# ifdef COMPILE_DL_SQLITE3
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
#else
# define SQLITE3G(v) (sqlite3_globals.v)
#endif
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index af3dec0681..a98b303547 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -2271,6 +2271,9 @@ PHP_MINFO_FUNCTION(sqlite3)
*/
static PHP_GINIT_FUNCTION(sqlite3)
{
+#if defined(COMPILE_DL_SQLITE3) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
memset(sqlite3_globals, 0, sizeof(*sqlite3_globals));
}
/* }}} */
@@ -2296,6 +2299,9 @@ zend_module_entry sqlite3_module_entry = {
/* }}} */
#ifdef COMPILE_DL_SQLITE3
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(sqlite3)
#endif
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 65472170e2..efb708d4a9 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -36,7 +36,7 @@ ZEND_END_MODULE_GLOBALS(assert)
ZEND_DECLARE_MODULE_GLOBALS(assert)
#ifdef ZTS
-#define ASSERTG(v) TSRMG(assert_globals_id, zend_assert_globals *, v)
+#define ASSERTG(v) ZEND_TSRMG(assert_globals_id, zend_assert_globals *, v)
#else
#define ASSERTG(v) (assert_globals.v)
#endif
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index eaac7a1609..1c142af842 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -231,7 +231,7 @@ typedef struct _php_basic_globals {
} php_basic_globals;
#ifdef ZTS
-#define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
+#define BG(v) ZEND_TSRMG(basic_globals_id, php_basic_globals *, v)
PHPAPI extern int basic_globals_id;
#else
#define BG(v) (basic_globals.v)
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index a76fb136a3..2ea837ff60 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -46,7 +46,7 @@ ZEND_END_MODULE_GLOBALS(browscap)
ZEND_DECLARE_MODULE_GLOBALS(browscap)
#ifdef ZTS
-#define BROWSCAP_G(v) TSRMG(browscap_globals_id, zend_browscap_globals *, v)
+#define BROWSCAP_G(v) ZEND_TSRMG(browscap_globals_id, zend_browscap_globals *, v)
#else
#define BROWSCAP_G(v) (browscap_globals.v)
#endif
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 7a5f0effa0..e2ce61f561 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -605,7 +605,8 @@ PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.
incomplete_class.c url_scanner_ex.c ftp_fopen_wrapper.c \
http_fopen_wrapper.c php_fopen_wrapper.c credits.c css.c \
var_unserializer.c ftok.c sha1.c user_filters.c uuencode.c \
- filters.c proc_open.c streamsfuncs.c http.c password.c)
+ filters.c proc_open.c streamsfuncs.c http.c password.c,,,
+ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_MAKEFILE_FRAGMENT
PHP_INSTALL_HEADERS([ext/standard/])
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
index 5f24641b4d..e8b50efc7e 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -20,7 +20,8 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
user_filters.c uuencode.c filters.c proc_open.c password.c \
- streamsfuncs.c http.c flock_compat.c", false /* never shared */);
+ streamsfuncs.c http.c flock_compat.c", false /* never shared */,
+ '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
PHP_INSTALL_HEADERS("", "ext/standard");
if (PHP_MBREGEX != "no") {
CHECK_HEADER_ADD_INCLUDE("oniguruma.h", "CFLAGS_STANDARD", PHP_MBREGEX + ";ext\\mbstring\\oniguruma")
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 7b4ab1cd3e..6f4c70ebba 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -56,7 +56,7 @@ typedef struct {
} php_dir_globals;
#ifdef ZTS
-#define DIRG(v) TSRMG(dir_globals_id, php_dir_globals *, v)
+#define DIRG(v) ZEND_TSRMG(dir_globals_id, php_dir_globals *, v)
int dir_globals_id;
#else
#define DIRG(v) (dir_globals.v)
diff --git a/ext/standard/file.h b/ext/standard/file.h
index ec60b86e99..78cab4f62f 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -132,7 +132,7 @@ typedef struct {
} php_file_globals;
#ifdef ZTS
-#define FG(v) TSRMG(file_globals_id, php_file_globals *, v)
+#define FG(v) ZEND_TSRMG(file_globals_id, php_file_globals *, v)
extern PHPAPI int file_globals_id;
#else
#define FG(v) (file_globals.v)
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index d86121b277..2c9b16463c 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -130,7 +130,7 @@ ZEND_BEGIN_MODULE_GLOBALS(array)
ZEND_END_MODULE_GLOBALS(array)
#ifdef ZTS
-#define ARRAYG(v) TSRMG(array_globals_id, zend_array_globals *, v)
+#define ARRAYG(v) ZEND_TSRMG(array_globals_id, zend_array_globals *, v)
#else
#define ARRAYG(v) (array_globals.v)
#endif
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index dcc82e9511..81d251c513 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.h
@@ -35,7 +35,7 @@ PHP_FUNCTION(lcg_value);
PHP_MINIT_FUNCTION(lcg);
#ifdef ZTS
-#define LCG(v) TSRMG(lcg_globals_id, php_lcg_globals *, v)
+#define LCG(v) ZEND_TSRMG(lcg_globals_id, php_lcg_globals *, v)
#else
#define LCG(v) (lcg_globals.v)
#endif
diff --git a/ext/tidy/config.m4 b/ext/tidy/config.m4
index 102f6a827e..b09622af3e 100644
--- a/ext/tidy/config.m4
+++ b/ext/tidy/config.m4
@@ -38,7 +38,7 @@ if test "$PHP_TIDY" != "no"; then
],[],[])
- PHP_NEW_EXTENSION(tidy, tidy.c, $ext_shared)
+ PHP_NEW_EXTENSION(tidy, tidy.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(TIDY_SHARED_LIBADD)
AC_DEFINE(HAVE_TIDY,1,[ ])
fi
diff --git a/ext/tidy/config.w32 b/ext/tidy/config.w32
index 41f217588d..a87a833f92 100644
--- a/ext/tidy/config.w32
+++ b/ext/tidy/config.w32
@@ -12,6 +12,7 @@ if (PHP_TIDY != "no") {
)) {
EXTENSION("tidy", "tidy.c");
AC_DEFINE('HAVE_TIDY', 1, 'Have TIDY library');
+ ADD_FLAG('CFLAGS_TIDY', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
if (!PHP_TIDY_SHARED) {
ADD_DEF_FILE("ext\\tidy\\php_tidy.def");
}
diff --git a/ext/tidy/php_tidy.h b/ext/tidy/php_tidy.h
index cd78f37a17..77de84de9c 100644
--- a/ext/tidy/php_tidy.h
+++ b/ext/tidy/php_tidy.h
@@ -40,7 +40,10 @@ ZEND_BEGIN_MODULE_GLOBALS(tidy)
ZEND_END_MODULE_GLOBALS(tidy)
#ifdef ZTS
-#define TG(v) TSRMG(tidy_globals_id, zend_tidy_globals *, v)
+#define TG(v) ZEND_TSRMG(tidy_globals_id, zend_tidy_globals *, v)
+#ifdef COMPILE_DL_TIDY
+ZEND_TSRMLS_CACHE_EXTERN;
+#endif
#else
#define TG(v) (tidy_globals.v)
#endif
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 63ccf52370..c8f1ec665e 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -467,6 +467,9 @@ zend_module_entry tidy_module_entry = {
};
#ifdef COMPILE_DL_TIDY
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(tidy)
#endif
@@ -1053,6 +1056,10 @@ static PHP_MINIT_FUNCTION(tidy)
static PHP_RINIT_FUNCTION(tidy)
{
+#if defined(COMPILE_DL_TIDY) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
+
php_tidy_clean_output_start(ZEND_STRL("ob_tidyhandler") TSRMLS_CC);
return SUCCESS;
diff --git a/ext/zlib/config.w32 b/ext/zlib/config.w32
index 000b1ccabb..1a57aa6110 100644
--- a/ext/zlib/config.w32
+++ b/ext/zlib/config.w32
@@ -7,7 +7,7 @@ if (PHP_ZLIB == "yes") {
if (CHECK_LIB("zlib_a.lib;zlib.lib", "zlib", PHP_ZLIB) &&
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects)) {
- EXTENSION("zlib", "zlib.c zlib_fopen_wrapper.c zlib_filter.c", null, "/D ZLIB_EXPORTS");
+ EXTENSION("zlib", "zlib.c zlib_fopen_wrapper.c zlib_filter.c", null, "/D ZLIB_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE("HAVE_ZLIB", 1, "ZLIB support");
if (!PHP_ZLIB_SHARED) {
diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4
index ebf67cc001..ab94c15fe0 100644
--- a/ext/zlib/config0.m4
+++ b/ext/zlib/config0.m4
@@ -9,7 +9,7 @@ PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
[ --with-zlib-dir=<DIR> Define the location of zlib install directory], no, no)
if test "$PHP_ZLIB" != "no" || test "$PHP_ZLIB_DIR" != "no"; then
- PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared)
+ PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(ZLIB_SHARED_LIBADD)
if test "$PHP_ZLIB" != "yes" -a "$PHP_ZLIB" != "no"; then
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index ba829b5888..e5c2f37016 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -68,7 +68,7 @@ extern zend_module_entry php_zlib_module_entry;
#ifdef ZTS
# include "TSRM.h"
-# define ZLIBG(v) TSRMG(zlib_globals_id, zend_zlib_globals *, v)
+# define ZLIBG(v) ZEND_TSRMG(zlib_globals_id, zend_zlib_globals *, v)
#else
# define ZLIBG(v) (zlib_globals.v)
#endif
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 000b96ad8e..34a425a844 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -484,7 +484,6 @@ static PHP_FUNCTION(ob_gzhandler)
ZLIBG(ob_gzhandler) = php_zlib_output_handler_context_init(TSRMLS_C);
}
- TSRMLS_SET_CTX(ctx.tsrm_ls);
ctx.op = flags;
ctx.in.data = in_str;
ctx.in.used = in_len;
@@ -724,6 +723,9 @@ PHP_ZLIB_DECODE_FUNC(gzuncompress, PHP_ZLIB_ENCODING_DEFLATE);
/* }}} */
#ifdef COMPILE_DL_ZLIB
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(php_zlib)
#endif
@@ -1008,6 +1010,9 @@ static PHP_MINFO_FUNCTION(zlib)
/* {{{ ZEND_MODULE_GLOBALS_CTOR */
static PHP_GINIT_FUNCTION(zlib)
{
+#if defined(COMPILE_DL_ZLIB) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
zlib_globals->ob_gzhandler = NULL;
zlib_globals->handler_registered = 0;
}