* Start output buffering, NULL signifies that no "user-space" output function
* will be used. The 0 disables chunking
*/
- php_start_ob_buffer(NULL, 0);
+ php_start_ob_buffer(NULL, 0 TSRMLS_CC);
}
/* }}} */
* current output buffer (so we don't send data twice)
*/
if (tRes)
- php_end_ob_buffer(0, 0);
+ php_end_ob_buffer(0, 0 TSRMLS_CC);
PUTS(tRes);
if (tRes)
SablotFree(tRes);
else
- php_end_ob_buffer(1, 0);
+ php_end_ob_buffer(1, 0 TSRMLS_CC);
}
/* }}} */
#ifdef TRANS_SID
void session_adapt_uris(const char *, size_t, char **, size_t * TSRMLS_DC);
void session_adapt_url(const char *, size_t, char **, size_t * TSRMLS_DC);
-void session_adapt_flush(int (*)(const char *, uint));
+void session_adapt_flush(int (*)(const char *, uint) TSRMLS_DC);
#else
#define session_adapt_uris(a,b,c,d) do { } while(0)
#define session_adapt_url(a,b,c,d) do { } while(0)
php_session_cache_limiter_t *lim;
if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
+ char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
+ int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
if (output_start_filename) {
php_error(E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)",
char *date_fmt = NULL;
if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
+ char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
+ int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
if (output_start_filename) {
php_error(E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)",
*new = url_adapt_single_url(url, urllen, PS(session_name), PS(id), newlen);
}
-void session_adapt_flush(int (*write)(const char *, uint))
+void session_adapt_flush(int (*write)(const char *, uint TSRMLS_DC) TSRMLS_DC)
{
char *str;
size_t len;
str = url_adapt_flush(&len);
- if (str) write(str, len);
+ if (str) write(str, len TSRMLS_CC);
}
#endif
PHP_FUNCTION(ob_gzhandler);
FILE *zlib_fopen_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path TSRMLS_DC);
-int php_enable_output_compression(int buffer_size);
+int php_enable_output_compression(int buffer_size TSRMLS_DC);
#ifdef ZTS
case 0:
break;
case 1:
- php_enable_output_compression(4096);
+ php_enable_output_compression(4096 TSRMLS_CC);
break;
default:
- php_enable_output_compression(ZLIBG(output_compression));
+ php_enable_output_compression(ZLIBG(output_compression) TSRMLS_CC);
}
return SUCCESS;
}
/* {{{ php_deflate_string
*/
-int php_deflate_string(const char *str, uint str_length, char **newstr, uint *new_length, int coding, zend_bool do_start, zend_bool do_end)
+int php_deflate_string(const char *str, uint str_length, char **newstr, uint *new_length, int coding, zend_bool do_start, zend_bool do_end TSRMLS_DC)
{
int err;
- TSRMLS_FETCH();
ZLIBG(compression_coding) = coding;
ZEND_WRONG_PARAM_COUNT();
break;
}
- if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, 1, 1)==SUCCESS) {
+ if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, 1, 1 TSRMLS_CC)==SUCCESS) {
Z_TYPE_P(return_value) = IS_STRING;
} else {
RETURN_FALSE;
do_end = ((Z_LVAL_PP(zv_mode) & PHP_OUTPUT_HANDLER_END) ? 1 : 0);
Z_STRVAL_P(return_value) = NULL;
Z_STRLEN_P(return_value) = 0;
- if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, do_start, do_end)==SUCCESS) {
+ if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, do_start, do_end TSRMLS_CC)==SUCCESS) {
Z_TYPE_P(return_value) = IS_STRING;
if (do_start) {
switch (coding) {
/* {{{ php_gzip_output_handler
*/
-static void php_gzip_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode)
+static void php_gzip_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
{
zend_bool do_start, do_end;
- TSRMLS_FETCH();
do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);
do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
- if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end)!=SUCCESS) {
+ if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end TSRMLS_CC)!=SUCCESS) {
zend_error(E_ERROR, "Compression failed");
}
}
/* {{{ php_enable_output_compression
*/
-int php_enable_output_compression(int buffer_size)
+int php_enable_output_compression(int buffer_size TSRMLS_DC)
{
zval **a_encoding, **data;
- TSRMLS_FETCH();
if (zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data)==FAILURE
|| Z_TYPE_PP(data)!=IS_ARRAY
return FAILURE;
}
- php_start_ob_buffer(NULL, buffer_size);
- php_ob_set_internal_handler(php_gzip_output_handler, buffer_size*1.5);
+ php_start_ob_buffer(NULL, buffer_size TSRMLS_CC);
+ php_ob_set_internal_handler(php_gzip_output_handler, buffer_size*1.5 TSRMLS_CC);
return SUCCESS;
}
/* }}} */
char *colon_offset;
if (SG(headers_sent) && !SG(request_info).no_headers) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
+ char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
+ int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
if (output_start_filename) {
sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent by (output started at %s:%d)",
int (*activate)(TSRMLS_D);
int (*deactivate)(TSRMLS_D);
- int (*ub_write)(const char *str, unsigned int str_length);
+ int (*ub_write)(const char *str, unsigned int str_length TSRMLS_DC);
void (*flush)(void *server_context);
struct stat *(*get_stat)(TSRMLS_D);
char *(*getenv)(char *name, size_t name_len TSRMLS_DC);
zend_try {
PG(during_request_startup) = 1;
- php_output_activate();
+ php_output_activate(TSRMLS_C);
/* initialize global variables */
PG(modules_activated) = 0;
Z_STRLEN_P(output_handler) = strlen(PG(output_handler)); /* this can be optimized */
Z_STRVAL_P(output_handler) = estrndup(PG(output_handler), Z_STRLEN_P(output_handler));
Z_TYPE_P(output_handler) = IS_STRING;
- php_start_ob_buffer(output_handler, 0);
+ php_start_ob_buffer(output_handler, 0 TSRMLS_CC);
} else if (PG(output_buffering)) {
- php_start_ob_buffer(NULL, 0);
+ php_start_ob_buffer(NULL, 0 TSRMLS_CC);
} else if (PG(implicit_flush)) {
- php_start_implicit_flush();
+ php_start_implicit_flush(TSRMLS_C);
}
/* We turn this off in php_execute_script() */
TSRMLS_FETCH();
zend_try {
- php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1));
+ php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);
} zend_end_try();
zend_try {
sapi_module = *sf;
php_output_startup();
- php_output_activate();
+ php_output_activate(TSRMLS_C);
zuf.error_function = php_error_cb;
zuf.printf_function = php_printf;
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SYSCONFDIR", PHP_SYSCONFDIR, sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_LOCALSTATEDIR", PHP_LOCALSTATEDIR, sizeof(PHP_LOCALSTATEDIR)-1, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS);
- php_output_register_constants();
+ php_output_register_constants(TSRMLS_C);
if (php_startup_ticks(TSRMLS_C) == FAILURE) {
php_printf("Unable to start PHP ticks\n");
TSRMLS_FETCH();
PG(connection_status) = PHP_CONNECTION_ABORTED;
- php_output_set_status(0);
+ php_output_set_status(0 TSRMLS_CC);
if (!PG(ignore_user_abort)) {
zend_bailout();
#include "SAPI.h"
/* output functions */
-static int php_ub_body_write(const char *str, uint str_length);
-static int php_ub_body_write_no_header(const char *str, uint str_length);
-static int php_b_body_write(const char *str, uint str_length);
+static int php_ub_body_write(const char *str, uint str_length TSRMLS_DC);
+static int php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC);
+static int php_b_body_write(const char *str, uint str_length TSRMLS_DC);
-static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size);
-static void php_ob_append(const char *text, uint text_length);
+static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size TSRMLS_DC);
+static void php_ob_append(const char *text, uint text_length TSRMLS_DC);
#if 0
static void php_ob_prepend(const char *text, uint text_length);
#endif
php_output_globals output_globals;
#endif
-static int php_default_output_func(const char *str, uint str_len)
+static int php_default_output_func(const char *str, uint str_len TSRMLS_DC)
{
fwrite(str, 1, str_len, stderr);
return str_len;
}
-PHPAPI void php_output_activate(void)
+PHPAPI void php_output_activate(TSRMLS_D)
{
- TSRMLS_FETCH();
-
OG(php_body_write) = php_ub_body_write;
OG(php_header_write) = sapi_module.ub_write;
OG(ob_nesting_level) = 0;
}
-PHPAPI void php_output_set_status(zend_bool status)
+PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC)
{
- TSRMLS_FETCH();
-
OG(disable_output) = !status;
}
-void php_output_register_constants()
+void php_output_register_constants(TSRMLS_D)
{
- TSRMLS_FETCH();
-
REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_CONT, CONST_CS | CONST_PERSISTENT);
REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_END, CONST_CS | CONST_PERSISTENT);
PHPAPI int php_body_write(const char *str, uint str_length)
{
TSRMLS_FETCH();
- return OG(php_body_write)(str, str_length);
+ return OG(php_body_write)(str, str_length TSRMLS_CC);
}
PHPAPI int php_header_write(const char *str, uint str_length)
if (OG(disable_output)) {
return 0;
} else {
- return OG(php_header_write)(str, str_length);
+ return OG(php_header_write)(str, str_length TSRMLS_CC);
}
}
/* {{{ php_start_ob_buffer
* Start output buffering */
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size)
+PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if (OG(ob_lock)) {
return FAILURE;
}
if (chunk_size) {
- php_ob_init((chunk_size*3/2), chunk_size/2, output_handler, chunk_size);
+ php_ob_init((chunk_size*3/2), chunk_size/2, output_handler, chunk_size TSRMLS_CC);
} else {
- php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
+ php_ob_init(40*1024, 10*1024, output_handler, chunk_size TSRMLS_CC);
}
OG(php_body_write) = php_b_body_write;
return SUCCESS;
/* {{{ php_end_ob_buffer
* End output buffering (one level) */
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
+PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC)
{
char *final_buffer=NULL;
int final_buffer_length=0;
char *to_be_destroyed_buffer;
char *to_be_destroyed_handled_output[2] = { 0, 0 };
int status;
- TSRMLS_FETCH();
if (OG(ob_nesting_level)==0) {
return;
if (OG(active_ob_buffer).internal_output_handler) {
final_buffer = OG(active_ob_buffer).internal_output_handler_buffer;
final_buffer_length = OG(active_ob_buffer).internal_output_handler_buffer_size;
- OG(active_ob_buffer).internal_output_handler(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, &final_buffer, &final_buffer_length, status);
+ OG(active_ob_buffer).internal_output_handler(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, &final_buffer, &final_buffer_length, status TSRMLS_CC);
} else if (OG(active_ob_buffer).output_handler) {
zval **params[2];
zval *orig_buffer;
zval *z_status;
- TSRMLS_FETCH();
ALLOC_INIT_ZVAL(orig_buffer);
ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 0);
}
if (send_buffer) {
- OG(php_body_write)(final_buffer, final_buffer_length);
+ OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
}
if (alternate_buffer) {
/* {{{ php_end_ob_buffers
* End output buffering (all buffers) */
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer)
+PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC)
{
- TSRMLS_FETCH();
-
while (OG(ob_nesting_level)!=0) {
- php_end_ob_buffer(send_buffer, 0);
+ php_end_ob_buffer(send_buffer, 0 TSRMLS_CC);
}
if (!OG(disable_output) && send_buffer && BG(use_trans_sid)) {
- session_adapt_flush(OG(php_header_write));
+ session_adapt_flush(OG(php_header_write) TSRMLS_CC);
}
}
/* }}} */
/* {{{ php_start_implicit_flush
*/
-PHPAPI void php_start_implicit_flush()
+PHPAPI void php_start_implicit_flush(TSRMLS_D)
{
- TSRMLS_FETCH();
-
- php_end_ob_buffer(1, 0); /* Switch out of output buffering if we're in it */
+ php_end_ob_buffer(1, 0 TSRMLS_CC); /* Switch out of output buffering if we're in it */
OG(implicit_flush)=1;
}
/* }}} */
/* {{{ php_end_implicit_flush
*/
-PHPAPI void php_end_implicit_flush()
+PHPAPI void php_end_implicit_flush(TSRMLS_D)
{
- TSRMLS_FETCH();
-
OG(implicit_flush)=0;
}
/* }}} */
/* {{{ php_ob_set_internal_handler
*/
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size)
+PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if (OG(ob_nesting_level)==0) {
return;
}
/* {{{ php_ob_allocate
*/
-static inline void php_ob_allocate(void)
+static inline void php_ob_allocate(TSRMLS_D)
{
- TSRMLS_FETCH();
-
if (OG(active_ob_buffer).size<OG(active_ob_buffer).text_length) {
while (OG(active_ob_buffer).size <= OG(active_ob_buffer).text_length) {
OG(active_ob_buffer).size+=OG(active_ob_buffer).block_size;
/* {{{ php_ob_init
*/
-static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size)
+static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if (OG(ob_nesting_level)>0) {
if (OG(ob_nesting_level)==1) { /* initialize stack */
zend_stack_init(&OG(ob_buffers));
/* {{{ php_ob_append
*/
-static void php_ob_append(const char *text, uint text_length)
+static void php_ob_append(const char *text, uint text_length TSRMLS_DC)
{
char *target;
int original_ob_text_length;
- TSRMLS_FETCH();
original_ob_text_length=OG(active_ob_buffer).text_length;
OG(active_ob_buffer).text_length = OG(active_ob_buffer).text_length + text_length;
- php_ob_allocate();
+ php_ob_allocate(TSRMLS_C);
target = OG(active_ob_buffer).buffer+original_ob_text_length;
memcpy(target, text, text_length);
target[text_length]=0;
if (output_handler) {
output_handler->refcount++;
}
- php_end_ob_buffer(1, 1);
+ php_end_ob_buffer(1, 1 TSRMLS_CC);
return;
}
}
TSRMLS_FETCH();
OG(active_ob_buffer).text_length += text_length;
- php_ob_allocate();
+ php_ob_allocate(TSRMLS_C);
/* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */
p = OG(ob_buffer)+OG(ob_text_length);
/* {{{ php_ob_get_buffer
* Return the current output buffer */
-int php_ob_get_buffer(pval *p)
+int php_ob_get_buffer(pval *p TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if (OG(ob_nesting_level)==0) {
return FAILURE;
}
/* {{{ php_ob_get_length
* Return the size of the current output buffer */
-int php_ob_get_length(pval *p)
+int php_ob_get_length(pval *p TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if (OG(ob_nesting_level) == 0) {
return FAILURE;
}
/* buffered output function */
-static int php_b_body_write(const char *str, uint str_length)
+static int php_b_body_write(const char *str, uint str_length TSRMLS_DC)
{
- php_ob_append(str, str_length);
+ php_ob_append(str, str_length TSRMLS_CC);
return str_length;
}
/* {{{ php_ub_body_write_no_header
*/
-static int php_ub_body_write_no_header(const char *str, uint str_length)
+static int php_ub_body_write_no_header(const char *str, uint str_length TSRMLS_DC)
{
char *newstr = NULL;
size_t new_length=0;
int result;
- TSRMLS_FETCH();
if (OG(disable_output)) {
return 0;
str_length = new_length;
}
- result = OG(php_header_write)(str, str_length);
+ result = OG(php_header_write)(str, str_length TSRMLS_CC);
if (OG(implicit_flush)) {
sapi_flush(TSRMLS_C);
/* {{{ php_ub_body_write
*/
-static int php_ub_body_write(const char *str, uint str_length)
+static int php_ub_body_write(const char *str, uint str_length TSRMLS_DC)
{
int result = 0;
- TSRMLS_FETCH();
if (SG(request_info).headers_only) {
php_header();
}
OG(php_body_write) = php_ub_body_write_no_header;
- result = php_ub_body_write_no_header(str, str_length);
+ result = php_ub_body_write_no_header(str, str_length TSRMLS_CC);
}
return result;
ZEND_WRONG_PARAM_COUNT();
break;
}
- if (php_start_ob_buffer(output_handler, chunk_size)==FAILURE) {
- TSRMLS_FETCH();
-
+ if (php_start_ob_buffer(output_handler, chunk_size TSRMLS_CC)==FAILURE) {
if (SG(headers_sent) && !SG(request_info).headers_only) {
OG(php_body_write) = php_ub_body_write_no_header;
} else {
Flush (send) the output buffer, and turn off output buffering */
PHP_FUNCTION(ob_end_flush)
{
- php_end_ob_buffer(1, 0);
+ php_end_ob_buffer(1, 0 TSRMLS_CC);
}
/* }}} */
Clean (erase) the output buffer, and turn off output buffering */
PHP_FUNCTION(ob_end_clean)
{
- php_end_ob_buffer(0, 0);
+ php_end_ob_buffer(0, 0 TSRMLS_CC);
}
/* }}} */
Return the contents of the output buffer */
PHP_FUNCTION(ob_get_contents)
{
- if (php_ob_get_buffer(return_value)==FAILURE) {
+ if (php_ob_get_buffer(return_value TSRMLS_CC)==FAILURE) {
RETURN_FALSE;
}
}
Return the length of the output buffer */
PHP_FUNCTION(ob_get_length)
{
- if (php_ob_get_length(return_value)==FAILURE) {
+ if (php_ob_get_length(return_value TSRMLS_CC)==FAILURE) {
RETURN_FALSE;
}
}
break;
}
if (flag) {
- php_start_implicit_flush();
+ php_start_implicit_flush(TSRMLS_C);
} else {
- php_end_implicit_flush();
+ php_end_implicit_flush(TSRMLS_C);
}
}
/* }}} */
-PHPAPI char *php_get_output_start_filename()
+PHPAPI char *php_get_output_start_filename(TSRMLS_D)
{
- TSRMLS_FETCH();
-
return OG(output_start_filename);
}
-PHPAPI int php_get_output_start_lineno()
+PHPAPI int php_get_output_start_lineno(TSRMLS_D)
{
- TSRMLS_FETCH();
-
return OG(output_start_lineno);
}
#include "php.h"
-typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode);
+typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC);
PHPAPI void php_output_startup(void);
-PHPAPI void php_output_activate(void);
-PHPAPI void php_output_set_status(zend_bool status);
-void php_output_register_constants(void);
+PHPAPI void php_output_activate(TSRMLS_D);
+PHPAPI void php_output_set_status(zend_bool status TSRMLS_DC);
+void php_output_register_constants(TSRMLS_D);
PHPAPI int php_body_write(const char *str, uint str_length);
PHPAPI int php_header_write(const char *str, uint str_length);
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size);
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush);
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer);
-PHPAPI int php_ob_get_buffer(pval *p);
-PHPAPI int php_ob_get_length(pval *p);
-PHPAPI void php_start_implicit_flush(void);
-PHPAPI void php_end_implicit_flush(void);
-PHPAPI char *php_get_output_start_filename(void);
-PHPAPI int php_get_output_start_lineno(void);
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size);
+PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size TSRMLS_DC);
+PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC);
+PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC);
+PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC);
+PHPAPI int php_ob_get_length(zval *p TSRMLS_DC);
+PHPAPI void php_start_implicit_flush(TSRMLS_D);
+PHPAPI void php_end_implicit_flush(TSRMLS_D);
+PHPAPI char *php_get_output_start_filename(TSRMLS_D);
+PHPAPI int php_get_output_start_lineno(TSRMLS_D);
+PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size TSRMLS_DC);
PHP_FUNCTION(ob_start);
PHP_FUNCTION(ob_end_flush);
} php_ob_buffer;
typedef struct _php_output_globals {
- int (*php_body_write)(const char *str, uint str_length); /* string output */
- int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
+ int (*php_body_write)(const char *str, uint str_length TSRMLS_DC); /* string output */
+ int (*php_header_write)(const char *str, uint str_length TSRMLS_DC); /* unbuffer string output */
php_ob_buffer active_ob_buffer;
unsigned char implicit_flush;
char *output_start_filename;
*/
static int
-php_ns_sapi_ub_write(const char *str, uint str_length)
+php_ns_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int n;
uint sent = 0;
- TSRMLS_FETCH();
while (str_length > 0) {
n = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
/* {{{ sapi_apache_ub_write
*/
-static int sapi_apache_ub_write(const char *str, uint str_length)
+static int sapi_apache_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int ret=0;
- TSRMLS_FETCH();
if (SG(server_context)) {
ret = rwrite(str, str_length, (request_rec *) SG(server_context));
{
TSRMLS_FETCH();
- php_output_set_status(0);
+ php_output_set_status(0 TSRMLS_CC);
SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */
if (AP(in_request)) {
AP(in_request) = 0;
{
pval **filename;
request_rec *rr = NULL;
- TSRMLS_FETCH();
if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
WRONG_PARAM_COUNT;
RETURN_FALSE;
}
- php_end_ob_buffers(1);
+ php_end_ob_buffers(1 TSRMLS_CC);
php_header();
if (run_sub_req(rr)) {
#include "php_apache.h"
static int
-php_apache_sapi_ub_write(const char *str, uint str_length)
+php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
apr_bucket *b;
apr_bucket_brigade *bb;
php_struct *ctx;
uint now;
- TSRMLS_FETCH();
ctx = SG(server_context);
*/
INLINE static int
-php_caudium_low_ub_write(const char *str, uint str_length) {
+php_caudium_low_ub_write(const char *str, uint str_length TSRMLS_DC) {
int sent_bytes = 0;
struct pike_string *to_write = NULL;
- TSRMLS_FETCH();
GET_THIS();
if(!MY_FD_OBJ->prog) {
PG(connection_status) = PHP_CONNECTION_ABORTED;
*/
static int
-php_caudium_sapi_ub_write(const char *str, uint str_length)
+php_caudium_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
- TSRMLS_FETCH();
GET_THIS();
int sent_bytes = 0, fd = MY_FD;
if(fd)
}
THIS->written += sent_bytes;
} else {
- THREAD_SAFE_RUN(sent_bytes = php_caudium_low_ub_write(str, str_length),
+ THREAD_SAFE_RUN(sent_bytes = php_caudium_low_ub_write(str, str_length TSRMLS_CC),
"write");
}
return sent_bytes;
#endif
}
-static int sapi_cgibin_ub_write(const char *str, uint str_length)
+static int sapi_cgibin_ub_write(const char *str, uint str_length TSRMLS_DC)
{
const char *ptr = str;
uint remaining = str_length;
case '?':
no_headers = 1;
php_output_startup();
- php_output_activate();
+ php_output_activate(TSRMLS_C);
SG(headers_sent) = 1;
php_cgi_usage(argv[0]);
- php_end_ob_buffers(1);
+ php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
break;
}
case '?':
no_headers = 1;
php_output_startup();
- php_output_activate();
+ php_output_activate(TSRMLS_C);
SG(headers_sent) = 1;
php_cgi_usage(argv[0]);
- php_end_ob_buffers(1);
+ php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
break;
case 'm': /* list compiled in modules */
php_output_startup();
- php_output_activate();
+ php_output_activate(TSRMLS_C);
SG(headers_sent) = 1;
php_printf("Running PHP %s\n%s\n", PHP_VERSION , get_zend_version());
php_printf("[PHP Modules]\n");
/* zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) _print_module_info, NULL TSRMLS_CC); */
php_printf("Not Implemented\n");
php_printf("\n");
- php_end_ob_buffers(1);
+ php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
break;
SG(request_info).no_headers = 1;
}
php_printf("%s\n", PHP_VERSION);
- php_end_ob_buffers(1);
+ php_end_ob_buffers(1 TSRMLS_CC);
exit(1);
break;
static pid_t pgroup;
-static int sapi_fastcgi_ub_write(const char *str, uint str_length)
+static int sapi_fastcgi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
uint sent = FCGX_PutStr( str, str_length, out );
return sent;
};
-static int sapi_isapi_ub_write(const char *str, uint str_length)
+static int sapi_isapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
DWORD num_bytes = str_length;
LPEXTENSION_CONTROL_BLOCK ecb;
- TSRMLS_FETCH();
ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC ) == FALSE) {
static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]);
static int
-sapi_nsapi_ub_write(const char *str, unsigned int str_length)
+sapi_nsapi_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
{
int retval;
nsapi_request_context *rc;
- TSRMLS_FETCH();
rc = (nsapi_request_context *)SG(server_context);
retval = net_write(rc->sn->csd, (char *)str, str_length);
if (retval == IO_ERROR /*-1*/ || retval == IO_EOF /*0*/)
}
static int
-php_phttpd_sapi_ub_write(const char *str, uint str_length)
+php_phttpd_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int sent_bytes;
- TSRMLS_FETCH();
sent_bytes = fd_write(PHG(cip)->fd, str, str_length);
};
-static int zend_pi3web_ub_write(const char *str, uint str_length)
+static int zend_pi3web_ub_write(const char *str, uint str_length TSRMLS_DC)
{
DWORD num_bytes = str_length;
LPCONTROL_BLOCK cb;
- TSRMLS_FETCH();
cb = (LPCONTROL_BLOCK) SG(server_context);
*/
static int
-php_roxen_low_ub_write(const char *str, uint str_length) {
+php_roxen_low_ub_write(const char *str, uint str_length TSRMLS_DC) {
int sent_bytes = 0;
struct pike_string *to_write = NULL;
#ifdef ROXEN_USE_ZTS
GET_THIS();
#endif
- TSRMLS_FETCH();
if(!MY_FD_OBJ->prog) {
PG(connection_status) = PHP_CONNECTION_ABORTED;
*/
static int
-php_roxen_sapi_ub_write(const char *str, uint str_length)
+php_roxen_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
#ifdef ROXEN_USE_ZTS
GET_THIS();
#endif
- TSRMLS_FETCH();
int sent_bytes = 0, fd = MY_FD;
if(fd)
}
}
} else {
- THREAD_SAFE_RUN(sent_bytes = php_roxen_low_ub_write(str, str_length),
+ THREAD_SAFE_RUN(sent_bytes = php_roxen_low_ub_write(str, str_length TSRMLS_CC),
"write");
}
return sent_bytes;
* sapi callbacks
*/
-static int sapi_servlet_ub_write(const char *str, uint str_length)
+static int sapi_servlet_ub_write(const char *str, uint str_length TSRMLS_DC)
{
- TSRMLS_FETCH();
if (!SG(server_context)) {
fprintf(stderr, str);
return 0;
#define TG(v) (thttpd_globals.v)
#endif
-static int sapi_thttpd_ub_write(const char *str, uint str_length)
+static int sapi_thttpd_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int n;
uint sent = 0;
- TSRMLS_FETCH();
while (str_length > 0) {
n = send(TG(hc)->conn_fd, str, str_length, 0);
#define TG(v) (tux_globals.v)
-static int sapi_tux_ub_write(const char *str, uint str_length)
+static int sapi_tux_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int n;
uint sent = 0;
- TSRMLS_FETCH();
/* combine headers and body */
if (TG(number_vec)) {