summaryrefslogtreecommitdiff
path: root/ext
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 /ext
parent382f95e6127d52b079d172ccd017cf306402e015 (diff)
downloadphp-git-c00424e427930a33e6d8645cc3f23fb78ed29b9f.tar.gz
bring back all the TSRMLS_FETCH() stuff
for better comparability with the mainstream
Diffstat (limited to 'ext')
-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
68 files changed, 215 insertions, 8 deletions
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;