Skip to content

Commit cddb65b

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fixed bug #81634 (ZEND_ENABLE_STATIC_TSRMLS_CACHE produces extensionswith the STATIC_TLS flag)
2 parents 4b4b9ed + 72f8dbb commit cddb65b

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

TSRM/TSRM.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ TSRM_API const char *tsrm_api_name(void);
167167
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
168168
#define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element)
169169
#define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset)))
170-
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
171-
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
170+
#define TSRMLS_MAIN_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
171+
#define TSRMLS_MAIN_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
172+
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
173+
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
172174
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
173175
#define TSRMLS_CACHE _tsrm_ls_cache
174176

@@ -182,6 +184,8 @@ TSRM_API const char *tsrm_api_name(void);
182184
#define tsrm_env_unlock()
183185

184186
#define TSRMG_STATIC(id, type, element)
187+
#define TSRMLS_MAIN_CACHE_EXTERN()
188+
#define TSRMLS_MAIN_CACHE_DEFINE()
185189
#define TSRMLS_CACHE_EXTERN()
186190
#define TSRMLS_CACHE_DEFINE()
187191
#define TSRMLS_CACHE_UPDATE()

Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static HashTable *global_class_table = NULL;
5050
static HashTable *global_constants_table = NULL;
5151
static HashTable *global_auto_globals_table = NULL;
5252
static HashTable *global_persistent_list = NULL;
53-
ZEND_TSRMLS_CACHE_DEFINE()
53+
TSRMLS_MAIN_CACHE_DEFINE()
5454
# define GLOBAL_FUNCTION_TABLE global_function_table
5555
# define GLOBAL_CLASS_TABLE global_class_table
5656
# define GLOBAL_CONSTANTS_TABLE global_constants_table

Zend/zend.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@
6969
#define ZEND_TSRMLS_CACHE
7070
#endif
7171

72+
#ifndef ZEND_COMPILE_DL_EXT
73+
TSRMLS_MAIN_CACHE_EXTERN()
74+
#else
7275
ZEND_TSRMLS_CACHE_EXTERN()
76+
#endif
7377

7478
struct _zend_serialize_data;
7579
struct _zend_unserialize_data;

build/php.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ dnl ---------------------------------------------- Static module
935935
if test "$3" = "shared" || test "$3" = "yes"; then
936936
dnl ---------------------------------------------- Shared module
937937
[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=yes
938-
PHP_ADD_SOURCES_X($ext_dir,$2,$ac_extra,shared_objects_$1,yes)
938+
PHP_ADD_SOURCES_X($ext_dir,$2,$ac_extra -DZEND_COMPILE_DL_EXT=1,shared_objects_$1,yes)
939939
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6, $7)
940940
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
941941
fi

win32/build/confutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
14321432

14331433
if (shared) {
14341434
STDOUT.WriteLine("Enabling extension " + extname_for_printing + " [shared]");
1435-
cflags = "/D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags;
1435+
cflags = "/D ZEND_COMPILE_DL_EXT=1 /D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags;
14361436
ADD_FLAG("CFLAGS_PHP", "/D COMPILE_DL_" + EXT);
14371437
} else {
14381438
STDOUT.WriteLine("Enabling extension " + extname_for_printing);

0 commit comments

Comments
 (0)