summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-15 09:37:55 +0200
committerAnatol Belski <ab@php.net>2014-10-15 09:37:55 +0200
commitc00424e427930a33e6d8645cc3f23fb78ed29b9f (patch)
tree83190e6ac9d0714fc971fe0925a0d935414de91c
parent382f95e6127d52b079d172ccd017cf306402e015 (diff)
downloadphp-git-c00424e427930a33e6d8645cc3f23fb78ed29b9f.tar.gz
bring back all the TSRMLS_FETCH() stuff
for better comparability with the mainstream
-rw-r--r--Zend/zend.c3
-rw-r--r--Zend/zend_API.c4
-rw-r--r--Zend/zend_alloc.c32
-rw-r--r--Zend/zend_ast.c6
-rw-r--r--Zend/zend_compile.c2
-rw-r--r--Zend/zend_execute_API.c7
-rw-r--r--Zend/zend_hash.c28
-rw-r--r--Zend/zend_inheritance.c1
-rw-r--r--Zend/zend_ini.c7
-rw-r--r--Zend/zend_ini_parser.y1
-rw-r--r--Zend/zend_language_parser.y1
-rw-r--r--Zend/zend_list.c3
-rw-r--r--Zend/zend_opcode.c1
-rw-r--r--Zend/zend_operators.c16
-rw-r--r--Zend/zend_signal.c1
-rw-r--r--Zend/zend_variables.c7
-rw-r--r--ext/com_dotnet/com_persist.c1
-rw-r--r--ext/com_dotnet/com_wrapper.c1
-rw-r--r--ext/curl/interface.c6
-rw-r--r--ext/curl/multi.c1
-rw-r--r--ext/date/php_date.c1
-rw-r--r--ext/dba/dba_db3.c2
-rw-r--r--ext/dba/dba_db4.c2
-rw-r--r--ext/dom/xpath.c2
-rw-r--r--ext/fileinfo/libmagic/apprentice.c10
-rw-r--r--ext/fileinfo/libmagic/fsmagic.c1
-rw-r--r--ext/fileinfo/libmagic/funcs.c3
-rw-r--r--ext/fileinfo/libmagic/magic.c1
-rw-r--r--ext/fileinfo/libmagic/print.c1
-rw-r--r--ext/fileinfo/libmagic/softmagic.c2
-rw-r--r--ext/ftp/ftp.c1
-rw-r--r--ext/gd/gd.c3
-rw-r--r--ext/gd/gd_compat.c2
-rw-r--r--ext/gd/gd_ctx.c8
-rw-r--r--ext/gd/libgd/gd.c4
-rw-r--r--ext/gd/libgd/gdft.c1
-rw-r--r--ext/gd/libgd/gdkanji.c1
-rw-r--r--ext/iconv/iconv.c1
-rw-r--r--ext/imap/php_imap.c14
-rw-r--r--ext/intl/collator/collator_convert.c2
-rw-r--r--ext/ldap/ldap.c1
-rw-r--r--ext/libxml/libxml.c14
-rw-r--r--ext/mysqli/mysqli.c3
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.c2
-rw-r--r--ext/odbc/php_odbc.c6
-rw-r--r--ext/opcache/ZendAccelerator.c9
-rw-r--r--ext/opcache/shared_alloc_win32.c1
-rw-r--r--ext/opcache/zend_accelerator_blacklist.c1
-rw-r--r--ext/opcache/zend_accelerator_debug.c1
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c3
-rw-r--r--ext/opcache/zend_shared_alloc.c3
-rwxr-xr-xext/openssl/openssl.c4
-rw-r--r--ext/openssl/xp_ssl.c6
-rw-r--r--ext/pcntl/pcntl.c2
-rw-r--r--ext/pcntl/php_signal.c4
-rw-r--r--ext/pdo/pdo_stmt.c1
-rw-r--r--ext/pdo_dblib/pdo_dblib.c2
-rw-r--r--ext/pdo_oci/oci_statement.c3
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c6
-rw-r--r--ext/pgsql/pgsql.c2
-rw-r--r--ext/phar/phar.c4
-rw-r--r--ext/readline/readline.c2
-rw-r--r--ext/readline/readline_cli.c1
-rw-r--r--ext/session/mod_mm.c2
-rw-r--r--ext/soap/php_encoding.c6
-rw-r--r--ext/soap/php_sdl.c1
-rw-r--r--ext/soap/php_xml.c2
-rw-r--r--ext/soap/soap.c2
-rw-r--r--ext/sockets/conversions.c6
-rw-r--r--ext/sqlite3/sqlite3.c7
-rw-r--r--ext/standard/basic_functions.c3
-rw-r--r--ext/standard/exec.c4
-rw-r--r--ext/standard/incomplete_class.c3
-rw-r--r--ext/standard/info.c3
-rw-r--r--ext/standard/math.c8
-rw-r--r--ext/standard/scanf.c1
-rw-r--r--ext/standard/string.c1
-rw-r--r--ext/tidy/tidy.c2
-rw-r--r--ext/wddx/wddx.c7
-rw-r--r--ext/xml/xml.c3
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c1
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c4
-rw-r--r--ext/xsl/xsltprocessor.c2
-rw-r--r--ext/zlib/zlib.c3
-rw-r--r--main/main.c13
-rw-r--r--main/network.c2
-rw-r--r--main/output.c2
-rw-r--r--main/php_ini.c1
-rw-r--r--main/php_output.h3
-rw-r--r--main/snprintf.c1
-rw-r--r--main/spprintf.c1
-rw-r--r--main/streams/cast.c14
-rw-r--r--sapi/apache2handler/sapi_apache2.c1
-rw-r--r--sapi/cli/php_cli.c2
-rw-r--r--sapi/cli/php_cli_server.c1
-rw-r--r--win32/readdir.c1
-rw-r--r--win32/wsyslog.c4
97 files changed, 377 insertions, 12 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 8c10125fe3..ab50087a39 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -809,6 +809,8 @@ void zenderror(const char *error) /* {{{ */
BEGIN_EXTERN_C()
ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
{
+ TSRMLS_FETCH();
+
if (!EG(bailout)) {
zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
exit(-1);
@@ -974,6 +976,7 @@ static void zend_error_va_list(int type, const char *format, va_list args)
zend_stack delayed_oplines_stack;
zend_stack context_stack;
zend_array *symbol_table;
+ TSRMLS_FETCH();
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 632d4a4ebe..41214865f4 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -48,6 +48,7 @@ ZEND_API int zend_get_parameters(int ht, int param_count, ...) /* {{{ */
int arg_count;
va_list ptr;
zval **param, *param_ptr;
+ TSRMLS_FETCH();
param_ptr = ZEND_CALL_ARG(EG(current_execute_data), 1);
arg_count = EG(current_execute_data)->num_args;
@@ -83,6 +84,7 @@ ZEND_API int zend_get_parameters_ex(int param_count, ...) /* {{{ */
int arg_count;
va_list ptr;
zval **param, *param_ptr;
+ TSRMLS_FETCH();
param_ptr = ZEND_CALL_ARG(EG(current_execute_data), 1);
arg_count = EG(current_execute_data)->num_args;
@@ -2473,6 +2475,8 @@ static void clean_module_classes(int module_number TSRMLS_DC) /* {{{ */
void module_destructor(zend_module_entry *module) /* {{{ */
{
+ TSRMLS_FETCH();
+
if (module->type == MODULE_TEMPORARY) {
zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC);
clean_module_constants(module->module_number TSRMLS_CC);
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index fb4d3b35e1..c647669ea7 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -360,6 +360,8 @@ static ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap,
#endif
size_t size)
{
+ TSRMLS_FETCH();
+
heap->overflow = 1;
zend_try {
zend_error_noreturn(E_ERROR,
@@ -2097,6 +2099,7 @@ ZEND_API int is_zend_mm(TSRMLS_D)
# define _ZEND_BIN_ALLOCATOR(_num, _size, _elements, _pages, x, y) \
ZEND_API void* ZEND_FASTCALL _emalloc_ ## _size(void) { \
+ TSRMLS_FETCH(); \
ZEND_MM_CUSTOM_ALLOCATOR(_size); \
return zend_mm_alloc_small(AG(mm_heap), _size, _num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
}
@@ -2105,18 +2108,23 @@ ZEND_MM_BINS_INFO(_ZEND_BIN_ALLOCATOR, x, y)
ZEND_API void* ZEND_FASTCALL _emalloc_large(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
+ TSRMLS_FETCH();
+
ZEND_MM_CUSTOM_ALLOCATOR(size);
return zend_mm_alloc_large(AG(mm_heap), size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
ZEND_API void* ZEND_FASTCALL _emalloc_huge(size_t size)
{
+ TSRMLS_FETCH();
+
ZEND_MM_CUSTOM_ALLOCATOR(size);
return zend_mm_alloc_huge(AG(mm_heap), size);
}
# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \
ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \
+ TSRMLS_FETCH(); \
ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \
{ \
size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE); \
@@ -2133,6 +2141,8 @@ ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y)
ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
{
+ TSRMLS_FETCH();
+
ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
{
size_t page_offset = ZEND_MM_ALIGNED_OFFSET(ptr, ZEND_MM_CHUNK_SIZE);
@@ -2149,6 +2159,8 @@ ZEND_API void ZEND_FASTCALL _efree_large(void *ptr, size_t size)
ZEND_API void ZEND_FASTCALL _efree_huge(void *ptr, size_t size)
{
+ TSRMLS_FETCH();
+
ZEND_MM_CUSTOM_DEALLOCATOR(ptr);
// TODO: use size???
zend_mm_free_huge(AG(mm_heap), ptr);
@@ -2157,6 +2169,8 @@ ZEND_API void ZEND_FASTCALL _efree_huge(void *ptr, size_t size)
ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
+ TSRMLS_FETCH();
+
#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
return AG(mm_heap)->_malloc(size);
@@ -2167,6 +2181,8 @@ ZEND_API void* ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
+ TSRMLS_FETCH();
+
#if ZEND_MM_CUSTOM
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
AG(mm_heap)->_free(ptr);
@@ -2178,6 +2194,8 @@ ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_OR
ZEND_API void* ZEND_FASTCALL _erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
+ TSRMLS_FETCH();
+
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
return AG(mm_heap)->_realloc(ptr, size);
}
@@ -2229,7 +2247,9 @@ ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size,
ZEND_API void* ZEND_FASTCALL _ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
void *p;
-
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
HANDLE_BLOCK_INTERRUPTIONS();
p = _safe_emalloc(nmemb, size, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
@@ -2246,6 +2266,9 @@ ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_
{
size_t length;
char *p;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
HANDLE_BLOCK_INTERRUPTIONS();
@@ -2263,6 +2286,9 @@ ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_
ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
char *p;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
HANDLE_BLOCK_INTERRUPTIONS();
@@ -2281,6 +2307,9 @@ ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LI
ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
{
char *p;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
HANDLE_BLOCK_INTERRUPTIONS();
@@ -2338,7 +2367,6 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
{
-
#if ZEND_MM_CUSTOM
char *tmp = getenv("USE_ZEND_ALLOC");
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index 97db764fbc..9604079a9e 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -43,6 +43,7 @@ static inline size_t zend_ast_list_size(uint32_t children) {
ZEND_API zend_ast *zend_ast_create_znode(znode *node) {
zend_ast_znode *ast;
+ TSRMLS_FETCH();
ast = zend_ast_alloc(sizeof(zend_ast_znode) TSRMLS_CC);
ast->kind = ZEND_AST_ZNODE;
@@ -54,6 +55,7 @@ ZEND_API zend_ast *zend_ast_create_znode(znode *node) {
ZEND_API zend_ast *zend_ast_create_zval_ex(zval *zv, zend_ast_attr attr) {
zend_ast_zval *ast;
+ TSRMLS_FETCH();
ast = zend_ast_alloc(sizeof(zend_ast_zval) TSRMLS_CC);
ast->kind = ZEND_AST_ZVAL;
@@ -68,6 +70,7 @@ ZEND_API zend_ast *zend_ast_create_decl(
zend_string *name, zend_ast *child0, zend_ast *child1, zend_ast *child2
) {
zend_ast_decl *ast;
+ TSRMLS_FETCH();
ast = zend_ast_alloc(sizeof(zend_ast_decl) TSRMLS_CC);
ast->kind = kind;
@@ -88,6 +91,7 @@ ZEND_API zend_ast *zend_ast_create_decl(
static zend_ast *zend_ast_create_from_va_list(zend_ast_kind kind, zend_ast_attr attr, va_list va) {
uint32_t i, children = kind >> ZEND_AST_NUM_CHILDREN_SHIFT;
zend_ast *ast;
+ TSRMLS_FETCH();
ast = zend_ast_alloc(zend_ast_size(children) TSRMLS_CC);
ast->kind = kind;
@@ -136,6 +140,7 @@ ZEND_API zend_ast *zend_ast_create(zend_ast_kind kind, ...) {
ZEND_API zend_ast *zend_ast_create_list(uint32_t init_children, zend_ast_kind kind, ...) {
zend_ast *ast;
zend_ast_list *list;
+ TSRMLS_FETCH();
ast = zend_ast_alloc(zend_ast_list_size(4) TSRMLS_CC);
list = (zend_ast_list *) ast;
@@ -164,6 +169,7 @@ static inline zend_bool is_power_of_two(uint32_t n) {
ZEND_API zend_ast *zend_ast_list_add(zend_ast *ast, zend_ast *op) {
zend_ast_list *list = zend_ast_get_list(ast);
if (list->children >= 4 && is_power_of_two(list->children)) {
+ TSRMLS_FETCH();
list = zend_ast_realloc(list,
zend_ast_list_size(list->children), zend_ast_list_size(list->children * 2) TSRMLS_CC);
}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 08d2ee1502..e1246b28dc 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -186,6 +186,8 @@ void zend_init_compiler_data_structures(TSRMLS_D) /* {{{ */
ZEND_API void file_handle_dtor(zend_file_handle *fh) /* {{{ */
{
+ TSRMLS_FETCH();
+
zend_file_handle_dtor(fh TSRMLS_CC);
}
/* }}} */
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 2ec9c8dbcc..bd24609d01 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -206,6 +206,8 @@ static int zval_call_destructor(zval *zv TSRMLS_DC) /* {{{ */
static void zend_unclean_zval_ptr_dtor(zval *zv) /* {{{ */
{
+ TSRMLS_FETCH();
+
if (Z_TYPE_P(zv) == IS_INDIRECT) {
zv = Z_INDIRECT_P(zv);
}
@@ -483,6 +485,7 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
ZEND_API void _zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC) /* {{{ */
{
+ TSRMLS_FETCH();
i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
}
/* }}} */
@@ -1141,6 +1144,8 @@ ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name,
ZEND_API void zend_timeout(int dummy) /* {{{ */
{
+ TSRMLS_FETCH();
+
if (zend_on_timeout) {
#ifdef ZEND_SIGNALS
/*
@@ -1278,6 +1283,8 @@ void zend_shutdown_timeout_thread(void) /* {{{ */
void zend_set_timeout(zend_long seconds, int reset_signals) /* {{{ */
{
+ TSRMLS_FETCH();
+
EG(timeout_seconds) = seconds;
#ifdef ZEND_WIN32
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 797205775a..6304737f04 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -252,6 +252,9 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
uint32_t nIndex;
uint32_t idx;
Bucket *p;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -404,6 +407,9 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
uint32_t nIndex;
uint32_t idx;
Bucket *p;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
CHECK_INIT(ht, h < ht->nTableSize);
@@ -541,6 +547,9 @@ ZEND_API zval *_zend_hash_next_index_insert_new(HashTable *ht, zval *pData ZEND_
static void zend_hash_do_resize(HashTable *ht)
{
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -659,6 +668,9 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key)
uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -695,6 +707,9 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key)
uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -744,6 +759,9 @@ ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, size_t len)
uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -792,6 +810,9 @@ ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len)
uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -822,6 +843,9 @@ ZEND_API int zend_hash_index_del(HashTable *ht, zend_ulong h)
uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
IS_CONSISTENT(ht);
@@ -937,6 +961,10 @@ ZEND_API void zend_hash_clean(HashTable *ht)
*/
static void zend_hash_apply_deleter(HashTable *ht, uint32_t idx, Bucket *p)
{
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
+
HANDLE_BLOCK_INTERRUPTIONS();
_zend_hash_del_el(ht, idx, p);
HANDLE_UNBLOCK_INTERRUPTIONS();
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index e7f075d457..f240ed7159 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -551,6 +551,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
{
uint32_t parent_flags = parent->common.fn_flags;
zend_function *child;
+ TSRMLS_FETCH();
if ((child = zend_hash_find_ptr(child_function_table, key)) == NULL) {
if (parent_flags & (ZEND_ACC_ABSTRACT)) {
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index 1c827bbe4c..e60e58d2aa 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -292,6 +292,8 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */
ZEND_API int zend_alter_ini_entry(zend_string *name, zend_string *new_value, int modify_type, int stage) /* {{{ */
{
+ TSRMLS_FETCH();
+
return zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
}
/* }}} */
@@ -300,6 +302,7 @@ ZEND_API int zend_alter_ini_entry_chars(zend_string *name, const char *value, si
{
int ret;
zend_string *new_value;
+ TSRMLS_FETCH();
new_value = zend_string_init(value, value_length, stage != ZEND_INI_STAGE_RUNTIME);
ret = zend_alter_ini_entry_ex(name, new_value, modify_type, stage, 0 TSRMLS_CC);
@@ -375,6 +378,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */
{
zend_ini_entry *ini_entry;
+ TSRMLS_FETCH();
if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL ||
(stage == ZEND_INI_STAGE_RUNTIME && (ini_entry->modifiable & ZEND_INI_USER) == 0)) {
@@ -414,6 +418,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di
ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
+ TSRMLS_FETCH();
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
@@ -431,6 +436,7 @@ ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{
ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
+ TSRMLS_FETCH();
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
@@ -448,6 +454,7 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists) /* {{{ */
{
zend_ini_entry *ini_entry;
+ TSRMLS_FETCH();
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 3ff392632c..8d5a9795af 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -158,6 +158,7 @@ static void ini_error(const char *msg)
char *error_buf;
int error_buf_len;
char *currently_parsed_filename;
+ TSRMLS_FETCH();
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
if (currently_parsed_filename) {
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 83ece22e78..15eb3f8015 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -1166,6 +1166,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
return yystrlen(yystr);
}
{
+ TSRMLS_FETCH();
if (CG(parse_error) == 0) {
char buffer[120];
const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index ab05f8c7ac..d8141f8664 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -165,6 +165,8 @@ void list_entry_destructor(zval *zv)
zend_resource *res = Z_RES_P(zv);
if (res->type >= 0) {
+ TSRMLS_FETCH();
+
zend_resource_dtor(res TSRMLS_CC);
}
efree_size(res, sizeof(zend_resource));
@@ -176,6 +178,7 @@ void plist_entry_destructor(zval *zv)
if (res->type >= 0) {
zend_rsrc_list_dtors_entry *ld;
+ TSRMLS_FETCH();
ld = zend_hash_index_find_ptr(&list_destructors, res->type);
if (ld) {
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 965561311d..5902abd4c5 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -112,6 +112,7 @@ ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC)
ZEND_API void zend_function_dtor(zval *zv)
{
zend_function *function = Z_PTR_P(zv);
+ TSRMLS_FETCH();
if (function->type == ZEND_USER_FUNCTION) {
ZEND_ASSERT(function->common.function_name);
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 963c261d42..b0a0e7519e 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -371,6 +371,7 @@ ZEND_API void convert_to_long_base(zval *op, int base) /* {{{ */
case IS_OBJECT:
{
zval dst;
+ TSRMLS_FETCH();
convert_object_to_type(op, &dst, IS_LONG, convert_to_long);
zval_dtor(op);
@@ -428,6 +429,7 @@ ZEND_API void convert_to_double(zval *op) /* {{{ */
case IS_OBJECT:
{
zval dst;
+ TSRMLS_FETCH();
convert_object_to_type(op, &dst, IS_DOUBLE, convert_to_double);
zval_dtor(op);
@@ -451,6 +453,7 @@ ZEND_API void convert_to_null(zval *op) /* {{{ */
if (Z_TYPE_P(op) == IS_OBJECT) {
if (Z_OBJ_HT_P(op)->cast_object) {
zval org;
+ TSRMLS_FETCH();
ZVAL_COPY_VALUE(&org, op);
if (Z_OBJ_HT_P(op)->cast_object(&org, op, IS_NULL TSRMLS_CC) == SUCCESS) {
@@ -511,6 +514,7 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */
case IS_OBJECT:
{
zval dst;
+ TSRMLS_FETCH();
convert_object_to_type(op, &dst, _IS_BOOL, convert_to_boolean);
zval_dtor(op);
@@ -539,6 +543,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
case IS_UNDEF:
case IS_NULL:
case IS_FALSE: {
+ TSRMLS_FETCH();
ZVAL_EMPTY_STRING(op);
break;
}
@@ -560,6 +565,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
case IS_DOUBLE: {
zend_string *str;
double dval = Z_DVAL_P(op);
+ TSRMLS_FETCH();
str = zend_strpprintf(0, "%.*G", (int) EG(precision), dval);
/* %G already handles removing trailing zeros from the fractional part, yay */
@@ -573,6 +579,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
break;
case IS_OBJECT: {
zval dst;
+ TSRMLS_FETCH();
convert_object_to_type(op, &dst, IS_STRING, convert_to_string);
@@ -605,6 +612,8 @@ static void convert_scalar_to_array(zval *op TSRMLS_DC) /* {{{ */
ZEND_API void convert_to_array(zval *op) /* {{{ */
{
+ TSRMLS_FETCH();
+
switch (Z_TYPE_P(op)) {
case IS_ARRAY:
break;
@@ -651,6 +660,8 @@ ZEND_API void convert_to_array(zval *op) /* {{{ */
ZEND_API void convert_to_object(zval *op) /* {{{ */
{
+ TSRMLS_FETCH();
+
switch (Z_TYPE_P(op)) {
case IS_ARRAY:
{
@@ -2153,6 +2164,7 @@ try_again:
/* proxy object */
zval rv;
zval *val;
+ TSRMLS_FETCH();
val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv TSRMLS_CC);
Z_ADDREF_P(val);
@@ -2162,6 +2174,7 @@ try_again:
} else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
+ TSRMLS_FETCH();
ZVAL_LONG(&op2, 1);
res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_ADD, op1, op1, &op2 TSRMLS_CC);
@@ -2226,6 +2239,7 @@ try_again:
/* proxy object */
zval rv;
zval *val;
+ TSRMLS_FETCH();
val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv TSRMLS_CC);
Z_ADDREF_P(val);
@@ -2235,6 +2249,7 @@ try_again:
} else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
+ TSRMLS_FETCH();
ZVAL_LONG(&op2, 1);
res = Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_SUB, op1, op1, &op2 TSRMLS_CC);
@@ -2543,6 +2558,7 @@ ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC) /
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
zend_string *str;
+ TSRMLS_FETCH();
str = zend_strpprintf(0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op));
ZVAL_NEW_STR(op, str);
diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c
index cf4c3179d1..6105fb1119 100644
--- a/Zend/zend_signal.c
+++ b/Zend/zend_signal.c
@@ -74,6 +74,7 @@ void zend_signal_handler_defer(int signo, siginfo_t *siginfo, void *context)
{
int errno_save = errno;
zend_signal_queue_t *queue, *qtmp;
+ TSRMLS_FETCH();
if (SIGG(active)) {
if (SIGG(depth) == 0) { /* try to handle signal */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index f200f00e65..3e68a38487 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -39,6 +39,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
}
case IS_ARRAY: {
zend_array *arr = (zend_array*)p;
+ TSRMLS_FETCH();
if (arr != &EG(symbol_table)) {
/* break possible cycles */
@@ -58,12 +59,14 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
}
case IS_OBJECT: {
zend_object *obj = (zend_object*)p;
+ TSRMLS_FETCH();
OBJ_RELEASE(obj);
break;
}
case IS_RESOURCE: {
zend_resource *res = (zend_resource*)p;
+ TSRMLS_FETCH();
if (--GC_REFCOUNT(res) == 0) {
/* destroy resource */
@@ -96,6 +99,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
}
case IS_ARRAY: {
zend_array *arr = (zend_array*)p;
+ TSRMLS_FETCH();
if (arr != &EG(symbol_table)) {
/* break possible cycles */
@@ -115,12 +119,14 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
}
case IS_OBJECT: {
zend_object *obj = (zend_object*)p;
+ TSRMLS_FETCH();
zend_objects_store_del(obj TSRMLS_CC);
break;
}
case IS_RESOURCE: {
zend_resource *res = (zend_resource*)p;
+ TSRMLS_FETCH();
/* destroy resource */
zend_list_free(res);
@@ -232,6 +238,7 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
break;
case IS_ARRAY: {
HashTable *ht;
+ TSRMLS_FETCH();
if (Z_ARR_P(zvalue) == &EG(symbol_table)) {
return; /* do nothing */
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index d47fbad5df..eb80e760c8 100644
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.c
@@ -55,6 +55,7 @@ static void istream_dtor(zend_resource *rsrc TSRMLS_DC)
#define FETCH_STM() \
php_istream *stm = (php_istream*)This; \
+ TSRMLS_FETCH(); \
if (GetCurrentThreadId() != stm->engine_thread) \
return RPC_E_WRONG_THREAD;
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index 9e14c99e10..6112dfb4bf 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.c
@@ -88,6 +88,7 @@ static inline void trace(char *fmt, ...)
#define FETCH_DISP(methname) \
php_dispatchex *disp = (php_dispatchex*)This; \
+ TSRMLS_FETCH(); \
if (COMG(rshutdown_started)) { \
trace(" PHP Object:%p (name:unknown) %s\n", Z_OBJ(disp->object), methname); \
} else { \
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 079c8d7070..affcd02d39 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1284,6 +1284,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
php_curl *ch = (php_curl *) ctx;
php_curl_write *t = ch->handlers->write;
size_t length = size * nmemb;
+ TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
#if PHP_CURL_DEBUG
fprintf(stderr, "curl_write() called\n");
@@ -1358,6 +1359,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
zval retval;
int error;
zend_fcall_info fci;
+ TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]);
@@ -1415,6 +1417,7 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
zval retval;
int error;
zend_fcall_info fci;
+ TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]);
@@ -1477,6 +1480,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
zval retval;
int error;
zend_fcall_info fci;
+ TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]);
@@ -1528,6 +1532,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
php_curl *ch = (php_curl *) ctx;
php_curl_write *t = ch->handlers->write_header;
size_t length = size * nmemb;
+ TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
switch (t->method) {
case PHP_CURL_STDOUT:
@@ -1617,6 +1622,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
zval retval;
int error;
int ret = -1;
+ TSRMLS_FETCH_FROM_CTX(ch->thread_ctx);
ZVAL_RES(&argv[0], ch->res);
Z_ADDREF(argv[0]);
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index e00f459902..d9e6df2c98 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -100,6 +100,7 @@ void _php_curl_multi_cleanup_list(void *data) /* {{{ */
{
zval *z_ch = (zval *)data;
php_curl *ch;
+ TSRMLS_FETCH();
if (!z_ch) {
return;
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 580684c579..f2ced7bd59 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -923,6 +923,7 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb)
{
+ TSRMLS_FETCH();
return php_date_parse_tzfile(formal_tzname, tzdb TSRMLS_CC);
}
/* }}} */
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
index cb3520f874..3f31222d9e 100644
--- a/ext/dba/dba_db3.c
+++ b/ext/dba/dba_db3.c
@@ -37,6 +37,8 @@
static void php_dba_db3_errcall_fcn(const char *errpfx, char *msg)
{
+ TSRMLS_FETCH();
+
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
}
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index eeea2db3a5..a9752a7bf6 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.c
@@ -42,6 +42,8 @@ static void php_dba_db4_errcall_fcn(
#endif
const char *errpfx, const char *msg)
{
+ TSRMLS_FETCH();
+
#if (DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8))
/* Bug 51086, Berkeley DB 4.8.26 */
/* This code suppresses a BDB 4.8+ error message, thus keeping PHP test compatibility */
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index fddf7da423..336365e342 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -82,6 +82,8 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
char *str;
zend_string *callable = NULL;
dom_xpath_object *intern;
+
+ TSRMLS_FETCH();
if (! zend_is_executing(TSRMLS_C)) {
xmlGenericError(xmlGenericErrorContext,
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 732ed8babb..c1dc5aa1fa 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -960,6 +960,8 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
php_stream *stream;
+ TSRMLS_FETCH();
+
ms->file = fn;
stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL);
@@ -1149,6 +1151,8 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
php_stream *dir;
php_stream_dirent d;
+ TSRMLS_FETCH();
+
memset(mset, 0, sizeof(mset));
ms->flags |= MAGIC_CHECK; /* Enable checks for parsed files */
@@ -2603,6 +2607,9 @@ apprentice_map(struct magic_set *ms, const char *fn)
php_stream *stream = NULL;
php_stream_statbuf st;
+
+ TSRMLS_FETCH();
+
if ((map = CAST(struct magic_map *, ecalloc(1, sizeof(*map)))) == NULL) {
file_oomem(ms, sizeof(*map));
efree(map);
@@ -2754,6 +2761,8 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
uint32_t i;
php_stream *stream;
+ TSRMLS_FETCH();
+
dbname = mkdbname(ms, fn, 0);
if (dbname == NULL)
@@ -2811,6 +2820,7 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
{
const char *p, *q;
char *buf;
+ TSRMLS_FETCH();
if (strip) {
if ((p = strrchr(fn, '/')) != NULL)
diff --git a/ext/fileinfo/libmagic/fsmagic.c b/ext/fileinfo/libmagic/fsmagic.c
index 0f6f4acbdf..a7b420ff5d 100644
--- a/ext/fileinfo/libmagic/fsmagic.c
+++ b/ext/fileinfo/libmagic/fsmagic.c
@@ -94,6 +94,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb, php_stream *
{
int ret, did = 0;
int mime = ms->flags & MAGIC_MIME;
+ TSRMLS_FETCH();
if (ms->flags & MAGIC_APPLE)
return 0;
diff --git a/ext/fileinfo/libmagic/funcs.c b/ext/fileinfo/libmagic/funcs.c
index 252cc34589..c7d9a7e4f1 100644
--- a/ext/fileinfo/libmagic/funcs.c
+++ b/ext/fileinfo/libmagic/funcs.c
@@ -221,7 +221,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
/* Check if we have a CDF file */
if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
php_socket_t fd;
-
+ TSRMLS_FETCH();
if (stream && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&fd, 0)) {
if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) {
if ((ms->flags & MAGIC_DEBUG) != 0)
@@ -445,6 +445,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
zend_string *res;
zval repl;
int rep_cnt = 0;
+ TSRMLS_FETCH();
(void)setlocale(LC_CTYPE, "C");
diff --git a/ext/fileinfo/libmagic/magic.c b/ext/fileinfo/libmagic/magic.c
index 5aeb0084cb..7f5cff6a7b 100644
--- a/ext/fileinfo/libmagic/magic.c
+++ b/ext/fileinfo/libmagic/magic.c
@@ -353,6 +353,7 @@ file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
zend_stat_t sb;
ssize_t nbytes = 0; /* number of bytes read from a datafile */
int no_in_stream = 0;
+ TSRMLS_FETCH();
if (!inname && !stream) {
return NULL;
diff --git a/ext/fileinfo/libmagic/print.c b/ext/fileinfo/libmagic/print.c
index f21ca9c711..eb4e6e8ce4 100644
--- a/ext/fileinfo/libmagic/print.c
+++ b/ext/fileinfo/libmagic/print.c
@@ -60,6 +60,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
char *expanded_format;
+ TSRMLS_FETCH();
va_start(va, f);
if (vasprintf(&expanded_format, f, va)); /* silence */
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index 40f6a52b83..e626929c9e 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -360,6 +360,7 @@ check_fmt(struct magic_set *ms, struct magic *m)
int re_options, rv = -1;
pcre_extra *re_extra;
zend_string *pattern;
+ TSRMLS_FETCH();
if (strchr(m->desc, '%') == NULL)
return 0;
@@ -2078,6 +2079,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
zval pattern;
int options = 0;
pcre_cache_entry *pce;
+ TSRMLS_FETCH();
options |= PCRE_MULTILINE;
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 69afa559ad..a5341080b8 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -179,6 +179,7 @@ ftp_close(ftpbuf_t *ftp)
data_close(ftp, ftp->data);
}
if (ftp->stream && ftp->closestream) {
+ TSRMLS_FETCH();
php_stream_close(ftp->stream);
}
if (ftp->fd != -1) {
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index c08f9d4271..54d0254c01 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1097,6 +1097,8 @@ static void php_free_gd_font(zend_resource *rsrc TSRMLS_DC)
*/
void php_gd_error_method(int type, const char *format, va_list args)
{
+ TSRMLS_FETCH();
+
php_verror(NULL, "", type, format, args TSRMLS_CC);
}
/* }}} */
@@ -4355,6 +4357,7 @@ static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold
int dest_height = gdImageSY(im_org);
int dest_width = gdImageSX(im_org);
int x, y;
+ TSRMLS_FETCH();
im_dest = gdImageCreate(dest_width, dest_height);
if (im_dest == NULL) {
diff --git a/ext/gd/gd_compat.c b/ext/gd/gd_compat.c
index ff21034ae7..dc6a95ae11 100644
--- a/ext/gd/gd_compat.c
+++ b/ext/gd/gd_compat.c
@@ -48,6 +48,8 @@ const char * gdPngGetVersionString()
int overflow2(int a, int b)
{
+ TSRMLS_FETCH();
+
if(a <= 0 || b <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
return 1;
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index 73f4848eeb..0b79cb6f0d 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -29,11 +29,13 @@ static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */
* big endian architectures:
*/
unsigned char ch = (unsigned char) c;
+ TSRMLS_FETCH();
php_write(&ch, 1 TSRMLS_CC);
} /* }}} */
static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
{
+ TSRMLS_FETCH();
return php_write((void *)buf, l TSRMLS_CC);
} /* }}} */
@@ -47,19 +49,21 @@ static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */
static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ {
char ch = (char) c;
php_stream * stream = (php_stream *)ctx->data;
-
+ TSRMLS_FETCH();
php_stream_write(stream, &ch, 1);
} /* }}} */
static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
{
php_stream * stream = (php_stream *)ctx->data;
-
+ TSRMLS_FETCH();
return php_stream_write(stream, (void *)buf, l);
} /* }}} */
static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
{
+ TSRMLS_FETCH();
+
if(ctx->data) {
php_stream_close((php_stream *) ctx->data);
ctx->data = NULL;
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index 6c8db37008..54890bc177 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -102,6 +102,8 @@ void php_gd_error_ex(int type, const char *format, ...)
{
va_list args;
+ TSRMLS_FETCH();
+
va_start(args, format);
php_verror(NULL, "", type, format, args TSRMLS_CC);
va_end(args);
@@ -111,6 +113,8 @@ void php_gd_error(const char *format, ...)
{
va_list args;
+ TSRMLS_FETCH();
+
va_start(args, format);
php_verror(NULL, "", E_WARNING, format, args TSRMLS_CC);
va_end(args);
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
index 7737fb1801..4148cf47bb 100644
--- a/ext/gd/libgd/gdft.c
+++ b/ext/gd/libgd/gdft.c
@@ -412,6 +412,7 @@ static void *fontFetch (char **error, void *key)
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
if (!strcmp(dir, ".")) {
+ TSRMLS_FETCH();
#if HAVE_GETCWD
dir = VCWD_GETCWD(cur_dir, MAXPATHLEN);
#elif HAVE_GETWD
diff --git a/ext/gd/libgd/gdkanji.c b/ext/gd/libgd/gdkanji.c
index 84096cd3f8..37f3bd10a0 100644
--- a/ext/gd/libgd/gdkanji.c
+++ b/ext/gd/libgd/gdkanji.c
@@ -74,6 +74,7 @@ error (const char *format,...)
{
va_list args;
char *tmp;
+ TSRMLS_FETCH();
va_start(args, format);
vspprintf(&tmp, 0, format, args);
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 17f9ba5aaa..d425f6cf1e 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -395,6 +395,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
{
char *s, *content_type, *mimetype = NULL;
int output_status, mimetype_len = 0;
+ PHP_OUTPUT_TSRMLS(output_context);
if (output_context->op & PHP_OUTPUT_HANDLER_START) {
output_status = php_output_get_status(TSRMLS_C);
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 460303d0ea..8dc56c5223 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -760,6 +760,7 @@ void mail_free_messagelist(MESSAGELIST **msglist, MESSAGELIST **tail)
void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
{
zval t_map, *return_value;
+ TSRMLS_FETCH();
return_value = *IMAPG(quota_return);
@@ -787,6 +788,8 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
*/
void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist)
{
+ TSRMLS_FETCH();
+
/* walk through the ACLLIST */
for(; alist; alist = alist->next) {
add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights));
@@ -4761,6 +4764,8 @@ PHP_FUNCTION(imap_timeout)
#define GETS_FETCH_SIZE 8196LU
static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md) /* {{{ */
{
+ TSRMLS_FETCH();
+
/* write to the gets stream if it is set,
otherwise forward to c-clients gets */
if (IMAPG(gets_stream)) {
@@ -4806,6 +4811,7 @@ static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DA
PHP_IMAP_EXPORT void mm_searched(MAILSTREAM *stream, unsigned long number)
{
MESSAGELIST *cur = NIL;
+ TSRMLS_FETCH();
if (IMAPG(imap_messages) == NIL) {
IMAPG(imap_messages) = mail_newmessagelist();
@@ -4838,6 +4844,7 @@ PHP_IMAP_EXPORT void mm_flags(MAILSTREAM *stream, unsigned long number)
PHP_IMAP_EXPORT void mm_notify(MAILSTREAM *stream, char *str, long errflg)
{
STRINGLIST *cur = NIL;
+ TSRMLS_FETCH();
if (strncmp(str, "[ALERT] ", 8) == 0) {
if (IMAPG(imap_alertstack) == NIL) {
@@ -4861,6 +4868,7 @@ PHP_IMAP_EXPORT void mm_list(MAILSTREAM *stream, DTYPE delimiter, char *mailbox,
{
STRINGLIST *cur=NIL;
FOBJECTLIST *ocur=NIL;
+ TSRMLS_FETCH();
if (IMAPG(folderlist_style) == FLIST_OBJECT) {
/* build up a the new array of objects */
@@ -4907,6 +4915,7 @@ PHP_IMAP_EXPORT void mm_lsub(MAILSTREAM *stream, DTYPE delimiter, char *mailbox,
{
STRINGLIST *cur=NIL;
FOBJECTLIST *ocur=NIL;
+ TSRMLS_FETCH();
if (IMAPG(folderlist_style) == FLIST_OBJECT) {
/* build the array of objects */
@@ -4948,6 +4957,8 @@ PHP_IMAP_EXPORT void mm_lsub(MAILSTREAM *stream, DTYPE delimiter, char *mailbox,
PHP_IMAP_EXPORT void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS *status)
{
+ TSRMLS_FETCH();
+
IMAPG(status_flags)=status->flags;
if (IMAPG(status_flags) & SA_MESSAGES) {
IMAPG(status_messages)=status->messages;
@@ -4969,6 +4980,7 @@ PHP_IMAP_EXPORT void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS *st
PHP_IMAP_EXPORT void mm_log(char *str, long errflg)
{
ERRORLIST *cur = NIL;
+ TSRMLS_FETCH();
/* Author: CJH */
if (errflg != NIL) { /* CJH: maybe put these into a more comprehensive log for debugging purposes? */
@@ -5000,6 +5012,8 @@ PHP_IMAP_EXPORT void mm_dlog(char *str)
PHP_IMAP_EXPORT void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
{
+ TSRMLS_FETCH();
+
if (*mb->user) {
strlcpy (user, mb->user, MAILTMPLEN);
} else {
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index 76dc9a4cc3..bc279b25f7 100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
@@ -400,6 +400,8 @@ zval* collator_make_printable_zval( zval* arg, zval *rv)
if( Z_TYPE_P(arg) != IS_STRING )
{
+ TSRMLS_FETCH();
+
use_copy = zend_make_printable_zval(arg, &arg_copy TSRMLS_CC);
if( use_copy )
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index efa59c4c68..f74de699ee 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -2433,6 +2433,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi
zval cb_args[2];
zval cb_retval;
zval *cb_link = (zval *) params;
+ TSRMLS_FETCH();
ld = (ldap_linkdata *) zend_fetch_resource(cb_link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link);
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 25f5ac08b9..d9e92541e9 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -302,6 +302,8 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
int isescaped=0;
xmlURI *uri;
+ TSRMLS_FETCH();
+
uri = xmlParseURI(filename);
if (uri && (uri->scheme == NULL ||
(xmlStrncmp(BAD_CAST uri->scheme, BAD_CAST "file", 4) == 0))) {
@@ -356,16 +358,19 @@ static void *php_libxml_streams_IO_open_write_wrapper(const char *filename)
static int php_libxml_streams_IO_read(void *context, char *buffer, int len)
{
+ TSRMLS_FETCH();
return php_stream_read((php_stream*)context, buffer, len);
}
static int php_libxml_streams_IO_write(void *context, const char *buffer, int len)
{
+ TSRMLS_FETCH();
return php_stream_write((php_stream*)context, buffer, len);
}
static int php_libxml_streams_IO_close(void *context)
{
+ TSRMLS_FETCH();
return php_stream_close((php_stream*)context);
}
@@ -374,6 +379,7 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
{
xmlParserInputBufferPtr ret;
void *context = NULL;
+ TSRMLS_FETCH();
if (LIBXML(entity_loader_disabled)) {
return NULL;
@@ -457,6 +463,8 @@ static void _php_list_set_error_structure(xmlErrorPtr error, const char *msg)
xmlError error_copy;
int ret;
+ TSRMLS_FETCH();
+
memset(&error_copy, 0, sizeof(xmlError));
if (error) {
@@ -512,6 +520,8 @@ static void php_libxml_internal_error_handler(int error_type, void *ctx, const c
char *buf;
int len, len_iter, output = 0;
+ TSRMLS_FETCH();
+
len = vspprintf(&buf, 0, *msg, ap);
len_iter = len;
@@ -553,6 +563,7 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
zval params[3];
int status;
zend_fcall_info *fci;
+ TSRMLS_FETCH();
fci = &LIBXML(entity_loader).fci;
@@ -669,6 +680,8 @@ is_string:
static xmlParserInputPtr _php_libxml_pre_ext_ent_loader(const char *URL,
const char *ID, xmlParserCtxtPtr context)
{
+ TSRMLS_FETCH();
+
/* Check whether we're running in a PHP context, since the entity loader
* we've defined is an application level (true global) setting.
* If we are, we also want to check whether we've finished activating
@@ -876,6 +889,7 @@ static PHP_MSHUTDOWN_FUNCTION(libxml)
static int php_libxml_post_deactivate(void)
{
+ TSRMLS_FETCH();
/* reset libxml generic error handling */
if (_php_libxml_per_request_initialization) {
xmlSetGenericErrorFunc(NULL, NULL);
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 9a67d80103..878c8fb946 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -89,7 +89,7 @@ static void free_prop_handler(zval *el) {
void php_mysqli_dtor_p_elements(void *data)
{
MYSQL *mysql = (MYSQL *)data;
-
+ TSRMLS_FETCH();
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);
}
@@ -930,6 +930,7 @@ PHP_RINIT_FUNCTION(mysqli)
#if defined(A0) && defined(MYSQLI_USE_MYSQLND)
static void php_mysqli_persistent_helper_for_every(void *p)
{
+ TSRMLS_FETCH();
mysqlnd_end_psession((MYSQLND *) p);
} /* }}} */
diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c
index 2d909246d0..3bb3c05147 100644
--- a/ext/mysqlnd/mysqlnd_plugin.c
+++ b/ext/mysqlnd/mysqlnd_plugin.c
@@ -130,10 +130,12 @@ mysqlnd_plugin_subsystem_end(TSRMLS_D)
/* {{{ mysqlnd_plugin_register */
PHPAPI unsigned int mysqlnd_plugin_register()
{
+ TSRMLS_FETCH();
return mysqlnd_plugin_register_ex(NULL TSRMLS_CC);
}
/* }}} */
+
/* {{{ mysqlnd_plugin_register_ex */
PHPAPI unsigned int mysqlnd_plugin_register_ex(struct st_mysqlnd_plugin_header * plugin TSRMLS_DC)
{
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index fe8c88e7ad..6729163996 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -521,6 +521,7 @@ static void _close_odbc_pconn(zend_resource *rsrc TSRMLS_DC)
static PHP_INI_DISP(display_link_nums)
{
char *value;
+ TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value->val;
@@ -545,6 +546,7 @@ static PHP_INI_DISP(display_link_nums)
static PHP_INI_DISP(display_defPW)
{
char *value;
+ TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value->val;
@@ -575,6 +577,7 @@ static PHP_INI_DISP(display_defPW)
static PHP_INI_DISP(display_binmode)
{
char *value;
+ TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value->val;
@@ -605,6 +608,7 @@ static PHP_INI_DISP(display_binmode)
static PHP_INI_DISP(display_lrl)
{
char *value;
+ TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value->val;
@@ -630,6 +634,7 @@ static PHP_INI_DISP(display_lrl)
static PHP_INI_DISP(display_cursortype)
{
char *value;
+ TSRMLS_FETCH();
if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
value = ini_entry->orig_value->val;
@@ -863,6 +868,7 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS)
RETCODE rc;
ODBC_SQL_ENV_T henv;
ODBC_SQL_CONN_T conn;
+ TSRMLS_FETCH();
if (conn_resource) {
henv = conn_resource->henv;
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index beab9be59c..d36827bde6 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1821,6 +1821,8 @@ static void zend_reset_cache_vars(TSRMLS_D)
static void accel_activate(void)
{
+ TSRMLS_FETCH();
+
if (!ZCG(enabled) || !accel_startup_ok) {
return;
}
@@ -1932,6 +1934,7 @@ static void accel_fast_zval_dtor(zval *zvalue)
if (Z_REFCOUNTED_P(zvalue) && Z_DELREF_P(zvalue) == 0) {
switch (Z_TYPE_P(zvalue)) {
case IS_ARRAY: {
+ TSRMLS_FETCH();
GC_REMOVE_FROM_BUFFER(Z_ARR_P(zvalue));
if (Z_ARR_P(zvalue) != &EG(symbol_table)) {
/* break possible cycles */
@@ -1942,11 +1945,15 @@ static void accel_fast_zval_dtor(zval *zvalue)
break;
case IS_OBJECT:
{
+ TSRMLS_FETCH();
+
OBJ_RELEASE(Z_OBJ_P(zvalue));
}
break;
case IS_RESOURCE:
{
+ TSRMLS_FETCH();
+
/* destroy resource */
zend_list_delete(Z_RES_P(zvalue));
}
@@ -2082,6 +2089,7 @@ static void accel_deactivate(void)
* In general, they're restored by persistent_compile_file(), but in case
* the script is aborted abnormally, they may become messed up.
*/
+ TSRMLS_FETCH();
if (!ZCG(enabled) || !accel_startup_ok) {
return;
@@ -2255,6 +2263,7 @@ static int accel_startup(zend_extension *extension)
{
zend_function *func;
zend_ini_entry *ini_entry;
+ TSRMLS_FETCH();
#ifdef ZTS
accel_globals_id = ts_allocate_id(&accel_globals_id, sizeof(zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor);
diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c
index cab33b5b38..37431fb18a 100644
--- a/ext/opcache/shared_alloc_win32.c
+++ b/ext/opcache/shared_alloc_win32.c
@@ -188,6 +188,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
void *vista_mapping_base_set[] = { (void *) 0x20000000, (void *) 0x21000000, (void *) 0x30000000, (void *) 0x31000000, (void *) 0x50000000, 0 };
#endif
void **wanted_mapping_base = default_mapping_base_set;
+ TSRMLS_FETCH();
zend_shared_alloc_lock_win32();
/* Mapping retries: When Apache2 restarts, the parent process startup routine
diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c
index 33aed3ce70..7263ed3c93 100644
--- a/ext/opcache/zend_accelerator_blacklist.c
+++ b/ext/opcache/zend_accelerator_blacklist.c
@@ -237,6 +237,7 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
char buf[MAXPATHLEN + 1], real_path[MAXPATHLEN + 1], *blacklist_path = NULL;
FILE *fp;
int path_length, blacklist_path_length;
+ TSRMLS_FETCH();
if ((fp = fopen(filename, "r")) == NULL) {
zend_accel_error(ACCEL_LOG_WARNING, "Cannot load blacklist file: %s\n", filename);
diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c
index feed711bf5..2a386b812b 100644
--- a/ext/opcache/zend_accelerator_debug.c
+++ b/ext/opcache/zend_accelerator_debug.c
@@ -34,6 +34,7 @@ void zend_accel_error(int type, const char *format, ...)
time_t timestamp;
char *time_string;
FILE * fLog = NULL;
+ TSRMLS_FETCH();
if (type > ZCG(accel_directives).log_verbosity_level) {
return;
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 1d949e4db4..ee7be50619 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -53,6 +53,7 @@ static zend_ast *zend_ast_clone(zend_ast *ast TSRMLS_DC);
static void zend_accel_destroy_zend_function(zval *zv)
{
zend_function *function = Z_PTR_P(zv);
+ TSRMLS_FETCH();
if (function->type == ZEND_USER_FUNCTION) {
if (function->op_array.static_variables) {
@@ -352,6 +353,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind)
uint idx;
Bucket *p, *q, *r;
zend_ulong nIndex;
+ TSRMLS_FETCH();
ht->nTableSize = source->nTableSize;
ht->nTableMask = source->nTableMask;
@@ -604,6 +606,7 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
zend_class_entry *old_ce = ce;
zend_class_entry *new_ce;
zend_function *new_func;
+ TSRMLS_FETCH();
*pce = ce = ARENA_REALLOC(old_ce);
ce->refcount = 1;
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index f3f7bd7d30..43a0263ee5 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -157,6 +157,8 @@ int zend_shared_alloc_startup(size_t requested_size)
const zend_shared_memory_handler_entry *he;
int res = ALLOC_FAILURE;
+ TSRMLS_FETCH();
+
/* shared_free must be valid before we call zend_shared_alloc()
* - make it temporarily point to a local variable
*/
@@ -296,6 +298,7 @@ void *zend_shared_alloc(size_t size)
{
int i;
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
+ TSRMLS_FETCH();
#if 1
if (!ZCG(locked)) {
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c565a7fac5..c4b155b478 100755
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -994,6 +994,8 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see
{
char buffer[MAXPATHLEN];
+ TSRMLS_FETCH();
+
if (egdsocket || !seeded) {
/* if we did not manage to read the seed file, we should not write
* a low-entropy seed file back */
@@ -2056,6 +2058,7 @@ static STACK_OF(X509) * load_all_certs_from_file(char *certfile)
STACK_OF(X509) *stack=NULL, *ret=NULL;
BIO *in=NULL;
X509_INFO *xi;
+ TSRMLS_FETCH();
if(!(stack = sk_X509_new_null())) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "memory allocation failure");
@@ -2108,6 +2111,7 @@ static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain,
{
int ret=0;
X509_STORE_CTX *csc;
+ TSRMLS_FETCH();
csc = X509_STORE_CTX_new();
if (csc == NULL) {
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 62c69c4a5a..54562c22e5 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -232,6 +232,8 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */
zval *val;
zend_ulong allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH;
+ TSRMLS_FETCH();
+
ret = preverify_ok;
/* determine the status for the current cert */
@@ -532,6 +534,8 @@ static int win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx, void *arg) /
zval *val;
zend_bool is_self_signed = 0;
+ TSRMLS_FETCH();
+
stream = (php_stream*)arg;
sslsock = (php_openssl_netstream_data_t*)stream->abstract;
@@ -983,6 +987,8 @@ static void limit_handshake_reneg(const SSL *ssl) /* {{{ */
if (sslsock->reneg->tokens > sslsock->reneg->limit) {
zval *val;
+ TSRMLS_FETCH();
+
sslsock->reneg->should_close = 1;
if (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream),
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 0086b383b9..11ad1018ec 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1191,6 +1191,7 @@ PHP_FUNCTION(pcntl_strerror)
static void pcntl_signal_handler(int signo)
{
struct php_pcntl_pending_signal *psig;
+ TSRMLS_FETCH();
psig = PCNTL_G(spares);
if (!psig) {
@@ -1218,6 +1219,7 @@ void pcntl_signal_dispatch()
struct php_pcntl_pending_signal *queue, *next;
sigset_t mask;
sigset_t old_mask;
+ TSRMLS_FETCH();
/* Mask all signals */
sigfillset(&mask);
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index f19c8a9a25..aa2139342c 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -28,7 +28,9 @@
Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
{
struct sigaction act,oact;
-
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
act.sa_handler = func;
if (mask_all) {
sigfillset(&act.sa_mask);
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 4a958d92cf..705d08bacf 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -274,6 +274,7 @@ static void param_dtor(zval *el) /* {{{ */
/* tell the driver that it is going away */
if (param->stmt->methods->param_hook) {
+ TSRMLS_FETCH();
param->stmt->methods->param_hook(param->stmt, param, PDO_PARAM_EVT_FREE TSRMLS_CC);
}
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 67a1d7abaf..3afd885df5 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -91,6 +91,7 @@ int error_handler(DBPROCESS *dbproc, int severity, int dberr,
{
pdo_dblib_err *einfo;
char *state = "HY000";
+ TSRMLS_FETCH();
if(dbproc) {
einfo = (pdo_dblib_err*)dbgetuserdata(dbproc);
@@ -140,6 +141,7 @@ int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line)
{
pdo_dblib_err *einfo;
+ TSRMLS_FETCH();
if (severity) {
einfo = (pdo_dblib_err*)dbgetuserdata(dbproc);
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index 3551030ec4..7c86a23dcc 100644
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -188,6 +188,7 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv
{
struct pdo_bound_param_data *param = (struct pdo_bound_param_data*)ctx;
pdo_oci_bound_param *P = (pdo_oci_bound_param*)param->driver_data;
+ TSRMLS_FETCH();
if (!param || !param->parameter) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "param is NULL in oci_bind_input_cb; this should not happen");
@@ -219,6 +220,7 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d
{
struct pdo_bound_param_data *param = (struct pdo_bound_param_data*)ctx;
pdo_oci_bound_param *P = (pdo_oci_bound_param*)param->driver_data;
+ TSRMLS_FETCH();
if (!param || !param->parameter) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "param is NULL in oci_bind_output_cb; this should not happen");
@@ -479,6 +481,7 @@ static sb4 oci_define_callback(dvoid *octxp, OCIDefine *define, ub4 iter, dvoid
ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp)
{
pdo_oci_column *col = (pdo_oci_column*)octxp;
+ TSRMLS_FETCH();
switch (col->dtype) {
case SQLT_BLOB:
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index c5357081ed..413b50b9d4 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -448,6 +448,7 @@ static void php_sqlite3_func_callback(sqlite3_context *context, int argc,
sqlite3_value **argv)
{
struct pdo_sqlite_func *func = (struct pdo_sqlite_func*)sqlite3_user_data(context);
+ TSRMLS_FETCH();
do_callback(&func->afunc, &func->func, argc, argv, context, 0 TSRMLS_CC);
}
@@ -456,6 +457,7 @@ static void php_sqlite3_func_step_callback(sqlite3_context *context, int argc,
sqlite3_value **argv)
{
struct pdo_sqlite_func *func = (struct pdo_sqlite_func*)sqlite3_user_data(context);
+ TSRMLS_FETCH();
do_callback(&func->astep, &func->step, argc, argv, context, 1 TSRMLS_CC);
}
@@ -463,6 +465,7 @@ static void php_sqlite3_func_step_callback(sqlite3_context *context, int argc,
static void php_sqlite3_func_final_callback(sqlite3_context *context)
{
struct pdo_sqlite_func *func = (struct pdo_sqlite_func*)sqlite3_user_data(context);
+ TSRMLS_FETCH();
do_callback(&func->afini, &func->fini, 0, NULL, context, 1 TSRMLS_CC);
}
@@ -475,6 +478,7 @@ static int php_sqlite3_collation_callback(void *context,
zval zargs[2];
zval retval;
struct pdo_sqlite_collation *collation = (struct pdo_sqlite_collation*) context;
+ TSRMLS_FETCH();
collation->fc.fci.size = sizeof(collation->fc.fci);
collation->fc.fci.function_table = EG(function_table);
@@ -759,6 +763,7 @@ static int authorizer(void *autharg, int access_type, const char *arg3, const ch
char *filename;
switch (access_type) {
case SQLITE_COPY: {
+ TSRMLS_FETCH();
filename = make_filename_safe(arg4 TSRMLS_CC);
if (!filename) {
return SQLITE_DENY;
@@ -768,6 +773,7 @@ static int authorizer(void *autharg, int access_type, const char *arg3, const ch
}
case SQLITE_ATTACH: {
+ TSRMLS_FETCH();
filename = make_filename_safe(arg3 TSRMLS_CC);
if (!filename) {
return SQLITE_DENY;
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 931ec336e8..207764b165 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -834,6 +834,7 @@ static char *php_pgsql_PQescapeInternal(PGconn *conn, const char *str, size_t le
!strncmp(encoding, "GBK", sizeof("GBK")-1) ||
!strncmp(encoding, "JOHAB", sizeof("JOHAB")-1) ||
!strncmp(encoding, "UHC", sizeof("UHC")-1) ) {
+ TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsafe encoding is used. Do not use '%s' encoding or use PostgreSQL 9.0 or later libpq.", encoding);
}
@@ -960,6 +961,7 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message)
{
php_pgsql_notice *notice;
+ TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
notice->message = _php_pgsql_trim_message(message, &notice->len);
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index e3b663a011..cdc61fee88 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -312,6 +312,7 @@ int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
static void destroy_phar_data_only(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *) Z_PTR_P(zv);
+ TSRMLS_FETCH();
if (EG(exception) || --phar_data->refcount < 0) {
phar_destroy_phar_data(phar_data TSRMLS_CC);
@@ -354,6 +355,7 @@ static int phar_tmpclose_apply(zval *zv TSRMLS_DC) /* {{{ */
static void destroy_phar_data(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *)Z_PTR_P(zv);
+ TSRMLS_FETCH();
if (PHAR_GLOBALS->request_ends) {
/* first, iterate over the manifest and close all PHAR_TMP entry fp handles,
@@ -376,6 +378,8 @@ static void destroy_phar_data(zval *zv) /* {{{ */
*/
void destroy_phar_manifest_entry_int(phar_entry_info *entry) /* {{{ */
{
+ TSRMLS_FETCH();
+
if (entry->cfp) {
php_stream_close(entry->cfp);
entry->cfp = 0;
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 1b4fa5120a..0e7b146174 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -481,6 +481,7 @@ static char **_readline_completion_cb(const char *text, int start, int end)
zval params[3];
int i;
char **matches = NULL;
+ TSRMLS_FETCH();
_readline_string_zval(&params[0], text);
_readline_long_zval(&params[1], start);
@@ -543,6 +544,7 @@ static void php_rl_callback_handler(char *the_line)
{
zval params[1];
zval dummy;
+ TSRMLS_FETCH();
ZVAL_NULL(&dummy);
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index df23b55c3a..48ab488763 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -505,6 +505,7 @@ TODO:
*/
char *retval = NULL;
int textlen = strlen(text);
+ TSRMLS_FETCH();
if (!index) {
cli_completion_state = 0;
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index ff5cb320e0..bf48436a7e 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -122,6 +122,8 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key)
sd = mm_malloc(data->mm, sizeof(ps_sd) + keylen);
if (!sd) {
+ TSRMLS_FETCH();
+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "mm_malloc failed, avail %ld, err %s", mm_available(data->mm), mm_error());
return NULL;
}
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index bbba4e36ca..d34587b85e 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -3413,6 +3413,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns)
}
if (xmlns == NULL) {
xmlChar* prefix;
+ TSRMLS_FETCH();
if ((prefix = zend_hash_str_find_ptr(&SOAP_GLOBAL(defEncNs), (char*)ns, strlen(ns))) != NULL) {
xmlns = xmlNewNs(node->doc->children, BAD_CAST(ns), prefix);
@@ -3456,6 +3457,7 @@ static void set_xsi_type(xmlNodePtr node, char *type)
void encode_reset_ns()
{
+ TSRMLS_FETCH();
SOAP_GLOBAL(cur_uniq_ns) = 0;
SOAP_GLOBAL(cur_uniq_ref) = 0;
if (SOAP_GLOBAL(ref_map)) {
@@ -3468,6 +3470,7 @@ void encode_reset_ns()
void encode_finish()
{
+ TSRMLS_FETCH();
SOAP_GLOBAL(cur_uniq_ns) = 0;
SOAP_GLOBAL(cur_uniq_ref) = 0;
if (SOAP_GLOBAL(ref_map)) {
@@ -3480,6 +3483,7 @@ void encode_finish()
encodePtr get_conversion(int encode)
{
encodePtr enc;
+ TSRMLS_FETCH();
if ((enc = zend_hash_index_find_ptr(&SOAP_GLOBAL(defEncIndex), encode)) == NULL) {
soap_error0(E_ERROR, "Encoding: Cannot find encoding");
@@ -3606,6 +3610,8 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type TS
static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret)
{
+ TSRMLS_FETCH();
+
if (ns) {
xmlNsPtr xmlns;
if (SOAP_GLOBAL(soap_version) == SOAP_1_2 &&
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 45582da6d9..798c06fdd2 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -168,6 +168,7 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat, int len)
{
encodePtr enc;
+ TSRMLS_FETCH();
if ((enc = zend_hash_str_find_ptr(&SOAP_GLOBAL(defEnc), (char*)nscat, len)) != NULL) {
return enc;
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
index d59a65f182..5ad5548c40 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@ -133,6 +133,8 @@ xmlDocPtr soap_xmlParseMemory(const void *buf, size_t buf_size)
xmlParserCtxtPtr ctxt = NULL;
xmlDocPtr ret;
+ TSRMLS_FETCH();
+
/*
xmlInitParser();
*/
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 7c03b9ced4..2b37622a7a 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2133,6 +2133,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
zend_execute_data *_old_current_execute_data;
int _old_http_response_code;
char *_old_http_status_line;
+ TSRMLS_FETCH();
_old_in_compilation = CG(in_compilation);
_old_current_execute_data = EG(current_execute_data);
@@ -3383,6 +3384,7 @@ static void deserialize_parameters(xmlNodePtr params, sdlFunctionPtr function, i
sdlParamPtr param = NULL;
if (function != NULL &&
(param = zend_hash_index_find_ptr(function->requestParameters, cur_param)) == NULL) {
+ TSRMLS_FETCH();
soap_server_fault("Client", "Error cannot find parameter", NULL, NULL, NULL TSRMLS_CC);
}
if (param == NULL) {
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index baa5681287..d808271728 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -541,6 +541,7 @@ static void from_zval_write_sin_addr(const zval *zaddr_str, char *inaddr, ser_co
int res;
struct sockaddr_in saddr = {0};
zend_string *addr_str;
+ TSRMLS_FETCH();
addr_str = zval_get_string((zval *) zaddr_str);
res = php_set_inet_addr(&saddr, addr_str->val, ctx->sock TSRMLS_CC);
@@ -591,6 +592,7 @@ static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_co
int res;
struct sockaddr_in6 saddr6 = {0};
zend_string *addr_str;
+ TSRMLS_FETCH();
addr_str = zval_get_string((zval *) zaddr_str);
res = php_set_inet6_addr(&saddr6, addr_str->val, ctx->sock TSRMLS_CC);
@@ -643,6 +645,7 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_
{
zend_string *path_str;
struct sockaddr_un *saddr = (struct sockaddr_un*)sockaddr_un_c;
+ TSRMLS_FETCH();
path_str = zval_get_string((zval *) path);
@@ -1243,6 +1246,7 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context
}
} else {
zend_string *str;
+ TSRMLS_FETCH();
str = zval_get_string((zval *) zv);
@@ -1346,6 +1350,7 @@ size_t calculate_scm_rights_space(const zval *arr, ser_context *ctx)
static void from_zval_write_fd_array_aux(zval *elem, unsigned i, void **args, ser_context *ctx)
{
int *iarr = args[0];
+ TSRMLS_FETCH();
if (Z_TYPE_P(elem) == IS_RESOURCE) {
php_stream *stream;
@@ -1390,6 +1395,7 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx)
i;
struct cmsghdr *dummy_cmsg = 0;
size_t data_offset;
+ TSRMLS_FETCH();
data_offset = (unsigned char *)CMSG_DATA(dummy_cmsg)
- (unsigned char *)dummy_cmsg;
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 214909a0c2..af3dec0681 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -48,6 +48,7 @@ static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...)
{
va_list arg;
char *message;
+ TSRMLS_FETCH();
va_start(arg, format);
vspprintf(&message, 0, format, arg);
@@ -811,6 +812,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s
static void php_sqlite3_callback_func(sqlite3_context *context, int argc, sqlite3_value **argv) /* {{{ */
{
php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
+ TSRMLS_FETCH();
sqlite3_do_callback(&func->afunc, &func->func, argc, argv, context, 0 TSRMLS_CC);
}
@@ -821,6 +823,7 @@ static void php_sqlite3_callback_step(sqlite3_context *context, int argc, sqlite
php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
php_sqlite3_agg_context *agg_context = (php_sqlite3_agg_context *)sqlite3_aggregate_context(context, sizeof(php_sqlite3_agg_context));
+ TSRMLS_FETCH();
agg_context->row_count++;
sqlite3_do_callback(&func->astep, &func->step, argc, argv, context, 1 TSRMLS_CC);
@@ -832,6 +835,7 @@ static void php_sqlite3_callback_final(sqlite3_context *context) /* {{{ */
php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
php_sqlite3_agg_context *agg_context = (php_sqlite3_agg_context *)sqlite3_aggregate_context(context, sizeof(php_sqlite3_agg_context));
+ TSRMLS_FETCH();
agg_context->row_count = 0;
sqlite3_do_callback(&func->afini, &func->fini, 0, NULL, context, 1 TSRMLS_CC);
@@ -845,6 +849,8 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in
zval retval;
int ret;
+ TSRMLS_FETCH();
+
collation->fci.fci.size = (sizeof(collation->fci.fci));
collation->fci.fci.function_table = EG(function_table);
ZVAL_COPY_VALUE(&collation->fci.fci.function_name, &collation->cmp_func);
@@ -1960,6 +1966,7 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
case SQLITE_ATTACH:
{
if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
+ TSRMLS_FETCH();
#if PHP_API_VERSION < 20100412
if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 147ea0a767..5bcd3d3386 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4927,6 +4927,8 @@ static void user_tick_function_call(user_tick_function_entry *tick_fe TSRMLS_DC)
static void run_user_tick_functions(int tick_count) /* {{{ */
{
+ TSRMLS_FETCH();
+
zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t) user_tick_function_call TSRMLS_CC);
}
/* }}} */
@@ -4936,6 +4938,7 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_
zval *func1 = &tick_fe1->arguments[0];
zval *func2 = &tick_fe2->arguments[0];
int ret;
+ TSRMLS_FETCH();
if (Z_TYPE_P(func1) == IS_STRING && Z_TYPE_P(func2) == IS_STRING) {
ret = (zend_binary_zval_strcmp(func1, func2) == 0);
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 37bdefbb6b..28f01b338f 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -245,6 +245,8 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
size_t estimate = (2 * l) + 1;
zend_string *cmd;
+ TSRMLS_FETCH();
+
cmd = zend_string_alloc(2 * l, 0);
for (x = 0, y = 0; x < l; x++) {
@@ -335,6 +337,8 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
zend_string *cmd;
size_t estimate = (4 * l) + 3;
+ TSRMLS_FETCH();
+
cmd = zend_string_alloc(4 * l + 2, 0); /* worst case */
#ifdef PHP_WIN32
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index 02da0c11b7..011407da29 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -136,6 +136,7 @@ PHPAPI zend_string *php_lookup_class_name(zval *object)
{
zval *val;
HashTable *object_properties;
+ TSRMLS_FETCH();
object_properties = Z_OBJPROP_P(object);
@@ -152,6 +153,8 @@ PHPAPI zend_string *php_lookup_class_name(zval *object)
PHPAPI void php_store_class_name(zval *object, const char *name, uint32_t len)
{
zval val;
+ TSRMLS_FETCH();
+
ZVAL_STRINGL(&val, name, len);
zend_hash_str_update(Z_OBJPROP_P(object), MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1, &val);
diff --git a/ext/standard/info.c b/ext/standard/info.c
index beec7749ca..bc0ddddcc0 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -65,6 +65,7 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */
{
int written;
zend_string *new_str;
+ TSRMLS_FETCH();
new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);
written = php_output_write(new_str->val, new_str->len TSRMLS_CC);
@@ -78,6 +79,7 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */
char *buf;
int len, written;
va_list argv;
+ TSRMLS_FETCH();
va_start(argv, fmt);
len = vspprintf(&buf, 0, fmt, argv);
@@ -91,6 +93,7 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */
static int php_info_print(const char *str) /* {{{ */
{
+ TSRMLS_FETCH();
return php_output_write(str, strlen(str) TSRMLS_CC);
}
/* }}} */
diff --git a/ext/standard/math.c b/ext/standard/math.c
index ee06936369..7014e6c938 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -972,8 +972,12 @@ PHPAPI zend_long _php_math_basetolong(zval *arg, int base)
if (num > onum)
continue;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s);
- return ZEND_LONG_MAX;
+ {
+ TSRMLS_FETCH();
+
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s);
+ return ZEND_LONG_MAX;
+ }
}
return num;
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index 3a6ec012a1..62437831bb 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -316,6 +316,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
int staticAssign[STATIC_LIST_SIZE];
int *nassign = staticAssign;
int objIndex, xpgSize, nspace = STATIC_LIST_SIZE;
+ TSRMLS_FETCH();
/*
* Initialize an array that records the number of times a variable
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 1975f19b3f..706a3eb075 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3228,6 +3228,7 @@ char *php_strerror(int errnum)
{
extern int sys_nerr;
extern char *sys_errlist[];
+ TSRMLS_FETCH();
if ((unsigned int) errnum < sys_nerr) {
return(sys_errlist[errnum]);
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index b1388f82ea..63ccf52370 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -487,6 +487,7 @@ static void TIDY_CALL php_tidy_free(void *buf)
static void TIDY_CALL php_tidy_panic(ctmbstr msg)
{
+ TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg);
}
@@ -1143,6 +1144,7 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
int status = FAILURE;
TidyDoc doc;
TidyBuffer inbuf, outbuf, errbuf;
+ PHP_OUTPUT_TSRMLS(output_context);
if (TG(clean_output) && (output_context->op & PHP_OUTPUT_HANDLER_START) && (output_context->op & PHP_OUTPUT_HANDLER_FINAL)) {
doc = tidyCreate();
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index eb29ce6cb1..705babd885 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -445,6 +445,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
zend_ulong idx;
char tmp_buf[WDDX_BUF_LEN];
HashTable *objhash, *sleephash;
+ TSRMLS_FETCH();
ZVAL_STRING(&fname, "__sleep");
/*
@@ -536,6 +537,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
HashTable *target_hash;
char tmp_buf[WDDX_BUF_LEN];
zend_ulong ind = 0;
+ TSRMLS_FETCH();
target_hash = HASH_OF(arr);
ZEND_HASH_FOREACH_KEY(target_hash, idx, key) {
@@ -664,6 +666,7 @@ static void php_wddx_add_var(wddx_packet *packet, zval *name_var)
{
zval *val;
HashTable *target_hash;
+ TSRMLS_FETCH();
if (Z_TYPE_P(name_var) == IS_STRING) {
zend_array *symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
@@ -711,7 +714,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X
{
st_entry ent;
wddx_stack *stack = (wddx_stack *)user_data;
-
+ TSRMLS_FETCH();
if (!strcmp((char *)name, EL_PACKET)) {
int i;
@@ -867,6 +870,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
HashTable *target_hash;
zend_class_entry *pce;
zval obj;
+ TSRMLS_FETCH();
/* OBJECTS_FIXME */
if (stack->top == 0) {
@@ -982,6 +986,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
{
st_entry *ent;
wddx_stack *stack = (wddx_stack *)user_data;
+ TSRMLS_FETCH();
if (!wddx_stack_is_empty(stack) && !stack->done) {
wddx_stack_top(stack, (void**)&ent);
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index ecbfae53d2..f1a3442b6d 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -470,6 +470,7 @@ static void xml_set_handler(zval *handler, zval *data)
static void xml_call_handler(xml_parser *parser, zval *handler, zend_function *function_ptr, int argc, zval *argv, zval *retval)
{
int i;
+ TSRMLS_FETCH();
ZVAL_UNDEF(retval);
if (parser && handler && !EG(exception)) {
@@ -785,6 +786,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
parser->ctag = zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag);
} else if (parser->level == (XML_MAXLEVEL + 1)) {
+ TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum depth exceeded - Results truncated");
}
}
@@ -926,6 +928,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag);
} else if (parser->level == (XML_MAXLEVEL + 1)) {
+ TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum depth exceeded - Results truncated");
}
}
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
index ce37e5f86e..13976077be 100644
--- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
+++ b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
@@ -228,6 +228,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA
break;
case xmlrpc_double:
{
+ TSRMLS_FETCH();
elem_val->name = strdup(ELEM_DOUBLE);
ap_php_snprintf(buf, BUF_SIZE, "%.*G", (int) EG(precision), XMLRPC_GetValueDouble(node));
simplestring_add(&elem_val->text, buf);
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 41b1b958b9..d43a31be11 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -865,6 +865,7 @@ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRe
zval* php_function;
zval xmlrpc_params;
zval callback_params[3];
+ TSRMLS_FETCH();
zval_ptr_dtor(&pData->xmlrpc_method);
zval_ptr_dtor(&pData->return_data);
@@ -905,6 +906,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
zval callback_params[1];
zend_string *php_function_name;
xmlrpc_callback_data* pData = (xmlrpc_callback_data*)data;
+ TSRMLS_FETCH();
/* setup data hoojum */
ZVAL_COPY_VALUE(&callback_params[0], &pData->caller_params);
@@ -1255,6 +1257,7 @@ XMLRPC_VECTOR_TYPE xmlrpc_str_as_vector_type(const char* str) /* {{{ */
int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */
{
int bSuccess = FAILURE;
+ TSRMLS_FETCH();
/* we only really care about strings because they can represent
* base64 and datetime. all other types have corresponding php types
@@ -1301,6 +1304,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */
XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */
{
XMLRPC_VALUE_TYPE type = xmlrpc_none;
+ TSRMLS_FETCH();
if (value) {
switch (Z_TYPE_P(value)) {
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index bb4060233e..20af855aa4 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -189,6 +189,8 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
xsl_object *intern;
zend_string *callable = NULL;
+ TSRMLS_FETCH();
+
if (! zend_is_executing(TSRMLS_C)) {
xsltGenericError(xsltGenericErrorContext,
"xsltExtFunctionTest: Function called from outside of PHP\n");
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 4389f688dc..000b96ad8e 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -91,6 +91,7 @@ static int php_zlib_output_encoding(TSRMLS_D)
static int php_zlib_output_handler_ex(php_zlib_context *ctx, php_output_context *output_context)
{
int flags = Z_SYNC_FLUSH;
+ PHP_OUTPUT_TSRMLS(output_context);
if (output_context->op & PHP_OUTPUT_HANDLER_START) {
/* start up */
@@ -176,6 +177,7 @@ static int php_zlib_output_handler_ex(php_zlib_context *ctx, php_output_context
static int php_zlib_output_handler(void **handler_context, php_output_context *output_context)
{
php_zlib_context *ctx = *(php_zlib_context **) handler_context;
+ PHP_OUTPUT_TSRMLS(output_context);
if (!php_zlib_output_encoding(TSRMLS_C)) {
/* "Vary: Accept-Encoding" header sent along uncompressed content breaks caching in MSIE,
@@ -482,6 +484,7 @@ 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;
diff --git a/main/main.c b/main/main.c
index 3681f28545..d7d7c44f80 100644
--- a/main/main.c
+++ b/main/main.c
@@ -376,6 +376,7 @@ static PHP_INI_DISP(display_errors_mode)
{
int mode, tmp_value_length, cgi_or_cli;
char *tmp_value;
+ TSRMLS_FETCH();
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
tmp_value = (ini_entry->orig_value ? ini_entry->orig_value->val : NULL );
@@ -722,6 +723,7 @@ PHPAPI size_t php_printf(const char *format, ...)
size_t ret;
char *buffer;
size_t size;
+ TSRMLS_FETCH();
va_start(args, format);
size = vspprintf(&buffer, 0, format, args);
@@ -997,6 +999,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
{
char *buffer;
int buffer_len, display;
+ TSRMLS_FETCH();
buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args);
@@ -1713,6 +1716,8 @@ int php_request_startup_for_hook(TSRMLS_D)
*/
void php_request_shutdown_for_exec(void *dummy)
{
+ TSRMLS_FETCH();
+
/* used to close fd's in the 3..255 range here, but it's problematic
*/
shutdown_memory_manager(1, 1 TSRMLS_CC);
@@ -1724,6 +1729,8 @@ void php_request_shutdown_for_exec(void *dummy)
*/
void php_request_shutdown_for_hook(void *dummy)
{
+ TSRMLS_FETCH();
+
if (PG(modules_activated)) zend_try {
php_call_shutdown_functions(TSRMLS_C);
} zend_end_try();
@@ -1775,6 +1782,7 @@ void php_request_shutdown_for_hook(void *dummy)
void php_request_shutdown(void *dummy)
{
zend_bool report_memleaks;
+ TSRMLS_FETCH();
report_memleaks = PG(report_memleaks);
@@ -1910,6 +1918,7 @@ PHPAPI void php_com_initialize(TSRMLS_D)
*/
static size_t php_output_wrapper(const char *str, size_t str_length)
{
+ TSRMLS_FETCH();
return php_output_write(str, str_length TSRMLS_CC);
}
/* }}} */
@@ -2008,6 +2017,7 @@ void dummy_invalid_parameter_handler(
int len;
if (!called) {
+ TSRMLS_FETCH();
if(PG(windows_show_crt_warning)) {
called = 1;
if (function) {
@@ -2393,6 +2403,7 @@ void php_module_shutdown_for_exec(void)
*/
int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals)
{
+ TSRMLS_FETCH();
php_module_shutdown(TSRMLS_C);
return SUCCESS;
}
@@ -2606,6 +2617,8 @@ PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval *ret T
*/
PHPAPI void php_handle_aborted_connection(void)
{
+ TSRMLS_FETCH();
+
PG(connection_status) = PHP_CONNECTION_ABORTED;
php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC);
diff --git a/main/network.c b/main/network.c
index 073f1b740a..9fd1285493 100644
--- a/main/network.c
+++ b/main/network.c
@@ -1156,6 +1156,8 @@ PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block TSRMLS_DC)
PHPAPI void _php_emit_fd_setsize_warning(int max_fd)
{
+ TSRMLS_FETCH();
+
#ifdef PHP_WIN32
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"PHP needs to be recompiled with a larger value of FD_SETSIZE.\n"
diff --git a/main/output.c b/main/output.c
index 18708789ac..d3652404c7 100644
--- a/main/output.c
+++ b/main/output.c
@@ -928,6 +928,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
{
php_output_handler_status_t status;
int original_op = context->op;
+ PHP_OUTPUT_TSRMLS(context);
#if PHP_OUTPUT_DEBUG
fprintf(stderr, ">>> op(%d, "
@@ -1266,6 +1267,7 @@ static inline int php_output_stack_pop(int flags TSRMLS_DC)
static int php_output_handler_compat_func(void **handler_context, php_output_context *output_context)
{
php_output_handler_func_t func = *(php_output_handler_func_t *) handler_context;
+ PHP_OUTPUT_TSRMLS(output_context);
if (func) {
char *out_str = NULL;
diff --git a/main/php_ini.c b/main/php_ini.c
index d90ee9dedb..c90dc9f29f 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -170,6 +170,7 @@ static int php_ini_available(zval *el, void *arg TSRMLS_DC)
PHPAPI void display_ini_entries(zend_module_entry *module)
{
int module_number, module_number_available;
+ TSRMLS_FETCH();
if (module) {
module_number = module->module_number;
diff --git a/main/php_output.h b/main/php_output.h
index 69a45878cd..17cec92e53 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -104,6 +104,9 @@ typedef struct _php_output_context {
php_output_buffer out;
} php_output_context;
+/* XXX remove this after TLS branch merge */
+#define PHP_OUTPUT_TSRMLS(ctx)
+
/* old-style, stateless callback */
typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC);
/* new-style, opaque context callback */
diff --git a/main/snprintf.c b/main/snprintf.c
index d323391808..062ccc4eee 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -787,6 +787,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
*/
switch (*fmt) {
case 'Z': {
+ TSRMLS_FETCH();
zvp = (zval*) va_arg(ap, zval*);
free_zcopy = zend_make_printable_zval(zvp, &zcopy TSRMLS_CC);
if (free_zcopy) {
diff --git a/main/spprintf.c b/main/spprintf.c
index 903c901abe..cf730dd964 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -401,6 +401,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
*/
switch (*fmt) {
case 'Z': {
+ TSRMLS_FETCH();
zvp = (zval*) va_arg(ap, zval*);
free_zcopy = zend_make_printable_zval(zvp, &zcopy TSRMLS_CC);
if (free_zcopy) {
diff --git a/main/streams/cast.c b/main/streams/cast.c
index dcb036aa4b..3291a9ca8f 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -63,6 +63,7 @@ FILE *fopencookie(void *cookie, const char *mode, COOKIE_IO_FUNCTIONS_T *funcs)
static int stream_cookie_reader(void *cookie, char *buffer, int size)
{
int ret;
+ TSRMLS_FETCH();
ret = php_stream_read((php_stream*)cookie, buffer, size);
return ret;
@@ -70,17 +71,22 @@ static int stream_cookie_reader(void *cookie, char *buffer, int size)
static int stream_cookie_writer(void *cookie, const char *buffer, int size)
{
+ TSRMLS_FETCH();
+
return php_stream_write((php_stream *)cookie, (char *)buffer, size);
}
static PHP_FPOS_T stream_cookie_seeker(void *cookie, zend_off_t position, int whence)
{
+ TSRMLS_FETCH();
+
return (PHP_FPOS_T)php_stream_seek((php_stream *)cookie, position, whence);
}
static int stream_cookie_closer(void *cookie)
{
php_stream *stream = (php_stream*)cookie;
+ TSRMLS_FETCH();
/* prevent recursion */
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
@@ -90,6 +96,7 @@ static int stream_cookie_closer(void *cookie)
static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
{
ssize_t ret;
+ TSRMLS_FETCH();
ret = php_stream_read(((php_stream *)cookie), buffer, size);
return ret;
@@ -97,12 +104,16 @@ static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t size)
{
+ TSRMLS_FETCH();
+
return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
}
# ifdef COOKIE_SEEKER_USES_OFF64_T
static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
{
+ TSRMLS_FETCH();
+
*position = php_stream_seek((php_stream *)cookie, (zend_off_t)*position, whence);
if (*position == -1) {
@@ -113,6 +124,8 @@ static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence)
# else
static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence)
{
+ TSRMLS_FETCH();
+
return php_stream_seek((php_stream *)cookie, position, whence);
}
# endif
@@ -120,6 +133,7 @@ static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence)
static int stream_cookie_closer(void *cookie)
{
php_stream *stream = (php_stream*)cookie;
+ TSRMLS_FETCH();
/* prevent recursion */
stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
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);
}
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 7513b72504..ef45ef6ef9 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1235,7 +1235,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
- tsrm_ls = ts_resource_ex(0, NULL);
+ tsrm_ls = ts_resource(0);
#endif
#ifdef PHP_WIN32
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 3936e25335..2ace965372 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -2388,7 +2388,6 @@ typedef struct php_cli_server_do_event_for_each_fd_callback_params {
static int php_cli_server_do_event_for_each_fd_callback(void *_params, php_socket_t fd, int event) /* {{{ */
{
php_cli_server_do_event_for_each_fd_callback_params *params = _params;
-
php_cli_server *server = params->server;
if (server->server_sock == fd) {
php_cli_server_client *client = NULL;
diff --git a/win32/readdir.c b/win32/readdir.c
index 2aba14ddf5..0edd5764d4 100644
--- a/win32/readdir.c
+++ b/win32/readdir.c
@@ -26,6 +26,7 @@ DIR *opendir(const char *dir)
HANDLE handle;
int index;
char resolved_path_buff[MAXPATHLEN];
+ TSRMLS_FETCH();
if (!VCWD_REALPATH(dir, resolved_path_buff)) {
return NULL;
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
index 89f98e5224..75c5ef58e5 100644
--- a/win32/wsyslog.c
+++ b/win32/wsyslog.c
@@ -61,6 +61,7 @@
void closelog(void)
{
+ TSRMLS_FETCH();
if (PW32G(log_source)) {
DeregisterEventSource(PW32G(log_source));
PW32G(log_source) = NULL;
@@ -84,6 +85,7 @@ void syslog(int priority, const char *message, ...)
unsigned short etype;
char *tmp = NULL;
DWORD evid;
+ TSRMLS_FETCH();
/* default event source */
if (!PW32G(log_source))
@@ -121,6 +123,8 @@ void syslog(int priority, const char *message, ...)
void openlog(const char *ident, int logopt, int facility)
{
+ TSRMLS_FETCH();
+
if (PW32G(log_source)) {
closelog();
}