summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-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
8 files changed, 37 insertions, 0 deletions
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;