Skip to content

Commit fea10f6

Browse files
committed
ext/iconv, ext/json and ext/session use static tsrmls pointer
1 parent 83b8e28 commit fea10f6

12 files changed

Lines changed: 37 additions & 9 deletions

File tree

‎ext/iconv/config.m4‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int main() {
171171
AC_MSG_RESULT([no])
172172
])
173173

174-
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-I\"$PHP_ICONV_PREFIX/include\"])
174+
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-I\"$PHP_ICONV_PREFIX/include\" -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
175175
PHP_SUBST(ICONV_SHARED_LIBADD)
176176
PHP_INSTALL_HEADERS([ext/iconv/])
177177
else

‎ext/iconv/config.w32‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (PHP_ICONV != "no") {
88
CHECK_LIB("iconv_a.lib", "iconv", PHP_ICONV) || CHECK_LIB("iconv.lib", "iconv", PHP_ICONV)) &&
99
CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_ICONV", PHP_ICONV)) {
1010

11-
EXTENSION("iconv", "iconv.c");
11+
EXTENSION("iconv", "iconv.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
1212

1313
AC_DEFINE("HAVE_ICONV", 1, "Define if iconv extension is enabled");
1414
AC_DEFINE("HAVE_LIBICONV", 1, "Define if libiconv is available");

‎ext/iconv/iconv.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,18 @@ zend_module_entry iconv_module_entry = {
164164
/* }}} */
165165

166166
#ifdef COMPILE_DL_ICONV
167+
#ifdef ZTS
168+
ZEND_TSRMLS_CACHE_DEFINE;
169+
#endif
167170
ZEND_GET_MODULE(iconv)
168171
#endif
169172

170173
/* {{{ PHP_GINIT_FUNCTION */
171174
static PHP_GINIT_FUNCTION(iconv)
172175
{
176+
#if defined(COMPILE_DL_ICONV) && defined(ZTS)
177+
ZEND_TSRMLS_CACHE_UPDATE;
178+
#endif
173179
iconv_globals->input_encoding = NULL;
174180
iconv_globals->output_encoding = NULL;
175181
iconv_globals->internal_encoding = NULL;

‎ext/iconv/php_iconv.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ ZEND_BEGIN_MODULE_GLOBALS(iconv)
7373
ZEND_END_MODULE_GLOBALS(iconv)
7474

7575
#ifdef ZTS
76-
# define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v)
76+
# define ICONVG(v) ZEND_TSRMG(iconv_globals_id, zend_iconv_globals *, v)
77+
# ifdef COMPILE_DL_ICONV
78+
ZEND_TSRMLS_CACHE_EXTERN;
79+
# endif
7780
#else
7881
# define ICONVG(v) (iconv_globals.v)
7982
#endif

‎ext/json/config.m4‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if test "$PHP_JSON" != "no"; then
99
AC_DEFINE([HAVE_JSON],1 ,[whether to enable JavaScript Object Serialization support])
1010
AC_HEADER_STDC
1111

12-
PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared)
12+
PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1313
PHP_INSTALL_HEADERS([ext/json], [php_json.h])
1414
PHP_SUBST(JSON_SHARED_LIBADD)
1515
fi

‎ext/json/config.w32‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ARG_ENABLE("json", "JavaScript Object Serialization support", "yes");
55

66
if (PHP_JSON != "no") {
7-
EXTENSION('json', 'json.c', PHP_JSON_SHARED, "");
7+
EXTENSION('json', 'json.c', PHP_JSON_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
88
ADD_SOURCES(configure_module_dirname, "JSON_parser.c utf8_decode.c", "json");
99
PHP_INSTALL_HEADERS("ext/json/", "php_json.h");
1010
}

‎ext/json/json.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ static PHP_MINIT_FUNCTION(json)
125125
*/
126126
static PHP_GINIT_FUNCTION(json)
127127
{
128+
#if defined(COMPILE_DL_JSON) && defined(ZTS)
129+
ZEND_TSRMLS_CACHE_UPDATE;
130+
#endif
128131
json_globals->encoder_depth = 0;
129132
json_globals->error_code = 0;
130133
json_globals->encode_max_depth = 0;
@@ -153,6 +156,9 @@ zend_module_entry json_module_entry = {
153156
/* }}} */
154157

155158
#ifdef COMPILE_DL_JSON
159+
#ifdef ZTS
160+
ZEND_TSRMLS_CACHE_DEFINE;
161+
#endif
156162
ZEND_GET_MODULE(json)
157163
#endif
158164

‎ext/json/php_json.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ ZEND_BEGIN_MODULE_GLOBALS(json)
4444
ZEND_END_MODULE_GLOBALS(json)
4545

4646
#ifdef ZTS
47-
# define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v)
47+
# define JSON_G(v) ZEND_TSRMG(json_globals_id, zend_json_globals *, v)
48+
# ifdef COMPILE_DL_JSON
49+
ZEND_TSRMLS_CACHE_EXTERN;
50+
# endif
4851
#else
4952
# define JSON_G(v) (json_globals.v)
5053
#endif

‎ext/session/config.m4‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PHP_ARG_WITH(mm,for mm support,
1111
if test "$PHP_SESSION" != "no"; then
1212
PHP_PWRITE_TEST
1313
PHP_PREAD_TEST
14-
PHP_NEW_EXTENSION(session, mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c, $ext_shared)
14+
PHP_NEW_EXTENSION(session, mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1515
PHP_ADD_EXTENSION_DEP(session, hash, true)
1616
PHP_ADD_EXTENSION_DEP(session, spl)
1717
PHP_SUBST(SESSION_SHARED_LIBADD)

‎ext/session/config.w32‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ARG_ENABLE("session", "session support", "yes");
55

66
if (PHP_SESSION == "yes") {
7-
EXTENSION("session", "mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c", false /* never shared */);
7+
EXTENSION("session", "mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c", false /* never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
88
AC_DEFINE("HAVE_PHP_SESSION", 1, "Session support");
99
PHP_INSTALL_HEADERS("ext/session/", "mod_mm.h php_session.h mod_files.h mod_user.h");
1010
}

0 commit comments

Comments
 (0)