Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions | Variables
php_output.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _php_ob_buffer
struct  _php_output_globals

Defines

#define OG(v)   (output_globals.v)
#define PHP_OUTPUT_HANDLER_START   (1<<0)
#define PHP_OUTPUT_HANDLER_CONT   (1<<1)
#define PHP_OUTPUT_HANDLER_END   (1<<2)
#define PHP_OUTPUT_HANDLER_INTERNAL   0
#define PHP_OUTPUT_HANDLER_USER   1

Typedefs

typedef void(* php_output_handler_func_t )(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)
typedef struct _php_ob_buffer php_ob_buffer
typedef struct _php_output_globals php_output_globals

Functions

PHPAPI void php_output_startup (void)
PHPAPI void php_output_activate (TSRMLS_D)
PHPAPI void php_output_set_status (zend_bool status TSRMLS_DC)
PHPAPI void php_output_register_constants (TSRMLS_D)
PHPAPI int php_default_output_func (const char *str, uint str_len TSRMLS_DC)
PHPAPI int php_ub_body_write (const char *str, uint str_length TSRMLS_DC)
PHPAPI int php_ub_body_write_no_header (const char *str, uint str_length TSRMLS_DC)
PHPAPI int php_body_write (const char *str, uint str_length TSRMLS_DC)
PHPAPI int php_header_write (const char *str, uint str_length TSRMLS_DC)
PHPAPI int php_start_ob_buffer (zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC)
PHPAPI int php_start_ob_buffer_named (const char *output_handler_name, uint chunk_size, zend_bool erase 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, char *handler_name, zend_bool erase TSRMLS_DC)
PHPAPI int php_ob_handler_used (char *handler_name TSRMLS_DC)
PHPAPI int php_ob_init_conflict (char *handler_new, char *handler_set TSRMLS_DC)
 PHP_FUNCTION (ob_start)
 PHP_FUNCTION (ob_flush)
 PHP_FUNCTION (ob_clean)
 PHP_FUNCTION (ob_end_flush)
 PHP_FUNCTION (ob_end_clean)
 PHP_FUNCTION (ob_get_flush)
 PHP_FUNCTION (ob_get_clean)
 PHP_FUNCTION (ob_get_contents)
 PHP_FUNCTION (ob_get_length)
 PHP_FUNCTION (ob_get_level)
 PHP_FUNCTION (ob_get_status)
 PHP_FUNCTION (ob_implicit_flush)
 PHP_FUNCTION (ob_list_handlers)
 PHP_FUNCTION (output_add_rewrite_var)
 PHP_FUNCTION (output_reset_rewrite_vars)

Variables

ZEND_API php_output_globals output_globals

Class Documentation

struct _php_ob_buffer

Definition at line 67 of file php_output.h.

Class Members
int block_size
char * buffer
uint chunk_size
zend_bool erase
char * handler_name
php_output_handler_func_t internal_output_handler
char * internal_output_handler_buffer
uint internal_output_handler_buffer_size
zval * output_handler
uint size
int status
uint text_length

Define Documentation

#define OG (   v)    (output_globals.v)

Definition at line 99 of file php_output.h.

#define PHP_OUTPUT_HANDLER_CONT   (1<<1)

Definition at line 104 of file php_output.h.

#define PHP_OUTPUT_HANDLER_END   (1<<2)

Definition at line 105 of file php_output.h.

Definition at line 107 of file php_output.h.

#define PHP_OUTPUT_HANDLER_START   (1<<0)

Definition at line 103 of file php_output.h.

#define PHP_OUTPUT_HANDLER_USER   1

Definition at line 108 of file php_output.h.


Typedef Documentation

typedef struct _php_ob_buffer php_ob_buffer
typedef void(* php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC)

Definition at line 24 of file php_output.h.


Function Documentation

PHPAPI int php_body_write ( const char *  str,
uint str_length  TSRMLS_DC 
)

Definition at line 117 of file output.c.

{
       return OG(php_body_write)(str, str_length TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_default_output_func ( const char *  str,
uint str_len  TSRMLS_DC 
)

Definition at line 50 of file output.c.

{
       fwrite(str, 1, str_len, stderr);
/* See http://support.microsoft.com/kb/190351 */
#ifdef PHP_WIN32
       fflush(stderr);
#endif
       return str_len;
}

Here is the caller graph for this function:

Definition at line 348 of file output.c.

{
       OG(implicit_flush) = 0;
}

Here is the caller graph for this function:

PHPAPI void php_end_ob_buffer ( zend_bool  send_buffer,
zend_bool just_flush  TSRMLS_DC 
)

Definition at line 185 of file output.c.

{
       char *final_buffer=NULL;
       unsigned int final_buffer_length=0;
       zval *alternate_buffer=NULL;
       char *to_be_destroyed_buffer, *to_be_destroyed_handler_name;
       char *to_be_destroyed_handled_output[2] = { 0, 0 };
       int status;
       php_ob_buffer *prev_ob_buffer_p=NULL;
       php_ob_buffer orig_ob_buffer;

       if (OG(ob_nesting_level)==0) {
              return;
       }
       status = 0;
       if (!OG(active_ob_buffer).status & PHP_OUTPUT_HANDLER_START) {
              /* our first call */
              status |= PHP_OUTPUT_HANDLER_START;
       }
       if (just_flush) {
              status |= PHP_OUTPUT_HANDLER_CONT;
       } else {
              status |= PHP_OUTPUT_HANDLER_END;
       }

#if 0
 {
        FILE *fp;
        fp = fopen("/tmp/ob_log", "a");
        fprintf(fp, "NestLevel: %d  ObStatus: %d  HandlerName: %s\n", OG(ob_nesting_level), status, OG(active_ob_buffer).handler_name);
        fclose(fp);
 }
#endif

       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 TSRMLS_CC);
       } else if (OG(active_ob_buffer).output_handler) {
              zval **params[2];
              zval *orig_buffer;
              zval *z_status;

              ALLOC_INIT_ZVAL(orig_buffer);
              ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);

              ALLOC_INIT_ZVAL(z_status);
              ZVAL_LONG(z_status, status);

              params[0] = &orig_buffer;
              params[1] = &z_status;
              OG(ob_lock) = 1;

              if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL TSRMLS_CC)==SUCCESS) {
                     if (alternate_buffer && !(Z_TYPE_P(alternate_buffer)==IS_BOOL && Z_BVAL_P(alternate_buffer)==0)) {
                            convert_to_string_ex(&alternate_buffer);
                            final_buffer = Z_STRVAL_P(alternate_buffer);
                            final_buffer_length = Z_STRLEN_P(alternate_buffer);
                     }
              }
              OG(ob_lock) = 0;
              if (!just_flush) {
                     zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
              }
              zval_ptr_dtor(&orig_buffer);
              zval_ptr_dtor(&z_status);
       }

       if (!final_buffer) {
              final_buffer = OG(active_ob_buffer).buffer;
              final_buffer_length = OG(active_ob_buffer).text_length;
       }

       if (OG(ob_nesting_level)==1) { /* end buffering */
              if (SG(headers_sent) && !SG(request_info).headers_only) {
                     OG(php_body_write) = php_ub_body_write_no_header;
              } else {
                     OG(php_body_write) = php_ub_body_write;
              }
       }

       to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
       to_be_destroyed_handler_name = OG(active_ob_buffer).handler_name;
       if (OG(active_ob_buffer).internal_output_handler
              && (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)
              && (final_buffer != OG(active_ob_buffer).buffer)) {
              to_be_destroyed_handled_output[0] = final_buffer;
       }

       if (!just_flush) {
              if (OG(active_ob_buffer).internal_output_handler) {
                     to_be_destroyed_handled_output[1] = OG(active_ob_buffer).internal_output_handler_buffer;
              }
       }
       if (OG(ob_nesting_level)>1) { /* restore previous buffer */
              zend_stack_top(&OG(ob_buffers), (void **) &prev_ob_buffer_p);
              orig_ob_buffer = OG(active_ob_buffer);
              OG(active_ob_buffer) = *prev_ob_buffer_p;
              zend_stack_del_top(&OG(ob_buffers));
              if (!just_flush && OG(ob_nesting_level)==2) { /* destroy the stack */
                     zend_stack_destroy(&OG(ob_buffers));
              }
       }
       OG(ob_nesting_level)--;

       if (send_buffer) {
              if (just_flush) { /* if flush is called prior to proper end, ensure presence of NUL */
                     final_buffer[final_buffer_length] = '\0';
              }
              OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
       }

       if (just_flush) { /* we restored the previous ob, return to the current */
              if (prev_ob_buffer_p) {
                     zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
                     OG(active_ob_buffer) = orig_ob_buffer;
              }
              OG(ob_nesting_level)++;
       }

       if (alternate_buffer) {
              zval_ptr_dtor(&alternate_buffer);
       }

       if (status & PHP_OUTPUT_HANDLER_END) {
              efree(to_be_destroyed_handler_name);
       }
       if (!just_flush) {
              efree(to_be_destroyed_buffer);
       } else {
              OG(active_ob_buffer).text_length = 0;
              OG(active_ob_buffer).status |= PHP_OUTPUT_HANDLER_START;
              OG(php_body_write) = php_b_body_write;
       }
       if (to_be_destroyed_handled_output[0]) {
              efree(to_be_destroyed_handled_output[0]);
       }
       if (to_be_destroyed_handled_output[1]) {
              efree(to_be_destroyed_handled_output[1]);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI void php_end_ob_buffers ( zend_bool send_buffer  TSRMLS_DC)

Definition at line 330 of file output.c.

{
       while (OG(ob_nesting_level)!=0) {
              php_end_ob_buffer(send_buffer, 0 TSRMLS_CC);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHP_FUNCTION ( ob_start  )

Definition at line 758 of file output.c.

{
       zval *output_handler = NULL;
       long chunk_size = 0;
       zend_bool erase = 1;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/lb", &output_handler, &chunk_size, &erase) == FAILURE) {
              return;
       }

       if (chunk_size < 0) {
              chunk_size = 0;
       }

       if (php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC) == FAILURE) {
              RETURN_FALSE;
       }
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_flush  )

Definition at line 781 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!OG(ob_nesting_level)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer. No buffer to flush");
              RETURN_FALSE;
       }

       if (!OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to flush buffer %s", OG(active_ob_buffer).handler_name);
              RETURN_FALSE;
       }

       php_end_ob_buffer(1, 1 TSRMLS_CC);
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_clean  )

Definition at line 804 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!OG(ob_nesting_level)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete");
              RETURN_FALSE;
       }

       if (!OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s", OG(active_ob_buffer).handler_name);
              RETURN_FALSE;
       }

       php_end_ob_buffer(0, 1 TSRMLS_CC);
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_end_flush  )

Definition at line 827 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!OG(ob_nesting_level)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush");
              RETURN_FALSE;
       }

       if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s", OG(active_ob_buffer).handler_name);
              RETURN_FALSE;
       }

       php_end_ob_buffer(1, 0 TSRMLS_CC);
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_end_clean  )

Definition at line 850 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!OG(ob_nesting_level)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete");
              RETURN_FALSE;
       }

       if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s", OG(active_ob_buffer).handler_name);
              RETURN_FALSE;
       }

       php_end_ob_buffer(0, 0 TSRMLS_CC);
       RETURN_TRUE;
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_get_flush  )

Definition at line 873 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (php_ob_get_buffer(return_value TSRMLS_CC) == FAILURE) {
              RETURN_FALSE;
       }

       if (!OG(ob_nesting_level)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush");
              zval_dtor(return_value);
              RETURN_FALSE;
       }

       if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s", OG(active_ob_buffer).handler_name);
              zval_dtor(return_value);
              RETURN_FALSE;
       }

       php_end_ob_buffer(1, 0 TSRMLS_CC);
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_get_clean  )

Definition at line 901 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (php_ob_get_buffer(return_value TSRMLS_CC) == FAILURE) {
              RETURN_FALSE;
       }

       if (!OG(ob_nesting_level)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer. No buffer to delete");
              zval_dtor(return_value);
              RETURN_FALSE;
       }
       if (OG(ob_nesting_level) && !OG(active_ob_buffer).status && !OG(active_ob_buffer).erase) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_NOTICE, "failed to delete buffer %s", OG(active_ob_buffer).handler_name);
              zval_dtor(return_value);
              RETURN_FALSE;
       }

       php_end_ob_buffer(0, 0 TSRMLS_CC);
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_get_contents  )

Definition at line 928 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (php_ob_get_buffer(return_value TSRMLS_CC) == FAILURE) {
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_get_length  )

Definition at line 954 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (php_ob_get_length(return_value TSRMLS_CC) == FAILURE) {
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_get_level  )

Definition at line 942 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       RETURN_LONG(OG(ob_nesting_level));
}
PHP_FUNCTION ( ob_get_status  )

Definition at line 987 of file output.c.

{
       zend_bool full_status = 0;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &full_status) == FAILURE) {
              return;
       }

       array_init(return_value);

       if (full_status) {
              if (OG(ob_nesting_level) > 1) {
                     zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *elem, void *))php_ob_buffer_status, return_value);
              }
              if (OG(ob_nesting_level) > 0 && php_ob_buffer_status(&OG(active_ob_buffer), return_value) == FAILURE) {
                     RETURN_FALSE;
              }
       } else if (OG(ob_nesting_level) > 0) {
              add_assoc_long(return_value, "level", OG(ob_nesting_level));
              if (OG(active_ob_buffer).internal_output_handler) {
                     add_assoc_long(return_value, "type", PHP_OUTPUT_HANDLER_INTERNAL);
              } else {
                     add_assoc_long(return_value, "type", PHP_OUTPUT_HANDLER_USER);
              }
              add_assoc_long(return_value, "status", OG(active_ob_buffer).status);
              add_assoc_string(return_value, "name", OG(active_ob_buffer).handler_name, 1);
              add_assoc_bool(return_value, "del", OG(active_ob_buffer).erase);
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_implicit_flush  )

Definition at line 1020 of file output.c.

{
       long flag = 1;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
              return;
       }

       if (flag) {
              php_start_implicit_flush(TSRMLS_C);
       } else {
              php_end_implicit_flush(TSRMLS_C);
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( ob_list_handlers  )

Definition at line 968 of file output.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       array_init(return_value);

       if (OG(ob_nesting_level)) {
              if (OG(ob_nesting_level) > 1) {
                     zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_ob_list_each, return_value);
              }
              php_ob_list_each(&OG(active_ob_buffer), return_value);
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( output_add_rewrite_var  )

Definition at line 1050 of file output.c.

{
       char *name, *value;
       int name_len, value_len;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) {
              return;
       }

       if (php_url_scanner_add_var(name, name_len, value, value_len, 1 TSRMLS_CC) == SUCCESS) {
              RETURN_TRUE;
       } else {
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( output_reset_rewrite_vars  )

Definition at line 1038 of file output.c.

Here is the call graph for this function:

Definition at line 356 of file output.c.

{
       return OG(output_start_filename);
}

Here is the caller graph for this function:

Definition at line 364 of file output.c.

{
       return OG(output_start_lineno);
}

Here is the caller graph for this function:

PHPAPI int php_header_write ( const char *  str,
uint str_length  TSRMLS_DC 
)

Definition at line 125 of file output.c.

{
       if (OG(disable_output)) {
              return 0;
       } else {
              return OG(php_header_write)(str, str_length TSRMLS_CC);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_ob_get_buffer ( zval *p  TSRMLS_DC)

Definition at line 640 of file output.c.

{
       if (OG(ob_nesting_level)==0) {
              return FAILURE;
       }
       ZVAL_STRINGL(p, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
       return SUCCESS;
}

Here is the caller graph for this function:

PHPAPI int php_ob_get_length ( zval *p  TSRMLS_DC)

Definition at line 652 of file output.c.

{
       if (OG(ob_nesting_level) == 0) {
              return FAILURE;
       }
       ZVAL_LONG(p, OG(active_ob_buffer).text_length);
       return SUCCESS;
}

Here is the caller graph for this function:

PHPAPI int php_ob_handler_used ( char *handler_name  TSRMLS_DC)

Definition at line 578 of file output.c.

{
       char *tmp = handler_name;

       if (OG(ob_nesting_level)) {
              if (!strcmp(OG(active_ob_buffer).handler_name, handler_name)) {
                     return 1;
              }
              if (OG(ob_nesting_level)>1) {
                     zend_stack_apply_with_argument(&OG(ob_buffers), ZEND_STACK_APPLY_BOTTOMUP, (int (*)(void *element, void *)) php_ob_handler_used_each, &tmp);
              }
       }
       return tmp ? 0 : 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_ob_init_conflict ( char *  handler_new,
char *handler_set  TSRMLS_DC 
)

Definition at line 414 of file output.c.

{
       if (php_ob_handler_used(handler_set TSRMLS_CC)) {
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' conflicts with '%s'", handler_new, handler_set);
              return 1;
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI void php_ob_set_internal_handler ( php_output_handler_func_t  internal_output_handler,
uint  buffer_size,
char *  handler_name,
zend_bool erase  TSRMLS_DC 
)

Definition at line 372 of file output.c.

{
       if (OG(ob_nesting_level) == 0 || OG(active_ob_buffer).internal_output_handler || strcmp(OG(active_ob_buffer).handler_name, OB_DEFAULT_HANDLER_NAME)) {
              php_start_ob_buffer(NULL, buffer_size, erase TSRMLS_CC);
       }

       OG(active_ob_buffer).internal_output_handler = internal_output_handler;
       OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size);
       OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size;
       if (OG(active_ob_buffer).handler_name) {
              efree(OG(active_ob_buffer).handler_name);
       }
       OG(active_ob_buffer).handler_name = estrdup(handler_name);
       OG(active_ob_buffer).erase = erase;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 86 of file output.c.

{
       OG(php_body_write) = php_ub_body_write;
       OG(php_header_write) = sapi_module.ub_write;
       OG(ob_nesting_level) = 0;
       OG(ob_lock) = 0;
       OG(disable_output) = 0;
       OG(output_start_filename) = NULL;
       OG(output_start_lineno) = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 99 of file output.c.

Here is the caller graph for this function:

Definition at line 109 of file output.c.

{
       OG(disable_output) = !status;
}

Here is the caller graph for this function:

PHPAPI void php_output_startup ( void  )

Definition at line 74 of file output.c.

{
#ifdef ZTS
       ts_allocate_id(&output_globals_id, sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL);
#else
       php_output_init_globals(&output_globals TSRMLS_CC);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 340 of file output.c.

{
       OG(implicit_flush) = 1;
}

Here is the caller graph for this function:

PHPAPI int php_start_ob_buffer ( zval *  output_handler,
uint  chunk_size,
zend_bool erase  TSRMLS_DC 
)

Definition at line 137 of file output.c.

{
       uint initial_size, block_size;

       if (OG(ob_lock)) {
              if (SG(headers_sent) && !SG(request_info).headers_only) {
                     OG(php_body_write) = php_ub_body_write_no_header;
              } else {
                     OG(php_body_write) = php_ub_body_write;
              }
              OG(ob_nesting_level) = 0;
              php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers");
              return FAILURE;
       }
       if (chunk_size > 0) {
              if (chunk_size==1) {
                     chunk_size = 4096;
              }
              initial_size = (chunk_size*3/2);
              block_size = chunk_size/2;
       } else {
              initial_size = 40*1024;
              block_size = 10*1024;
       }
       return php_ob_init(initial_size, block_size, output_handler, chunk_size, erase TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_start_ob_buffer_named ( const char *  output_handler_name,
uint  chunk_size,
zend_bool erase  TSRMLS_DC 
)

Definition at line 167 of file output.c.

{
       zval *output_handler;
       int result;

       ALLOC_INIT_ZVAL(output_handler);
       Z_STRLEN_P(output_handler) = strlen(output_handler_name);      /* this can be optimized */
       Z_STRVAL_P(output_handler) = estrndup(output_handler_name, Z_STRLEN_P(output_handler));
       Z_TYPE_P(output_handler) = IS_STRING;
       result = php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC);
       zval_dtor(output_handler);
       FREE_ZVAL(output_handler);
       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_ub_body_write ( const char *  str,
uint str_length  TSRMLS_DC 
)

Definition at line 695 of file output.c.

{
       int result = 0;

       if (SG(request_info).headers_only) {
              if(SG(headers_sent)) {
                     return 0;
              }
              php_header(TSRMLS_C);
              zend_bailout();
       }
       if (php_header(TSRMLS_C)) {
              if (zend_is_compiling(TSRMLS_C)) {
                     OG(output_start_filename) = zend_get_compiled_filename(TSRMLS_C);
                     OG(output_start_lineno) = zend_get_compiled_lineno(TSRMLS_C);
              } else if (zend_is_executing(TSRMLS_C)) {
                     OG(output_start_filename) = zend_get_executed_filename(TSRMLS_C);
                     OG(output_start_lineno) = zend_get_executed_lineno(TSRMLS_C);
              }

              OG(php_body_write) = php_ub_body_write_no_header;
              result = php_ub_body_write_no_header(str, str_length TSRMLS_CC);
       }

       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_ub_body_write_no_header ( const char *  str,
uint str_length  TSRMLS_DC 
)

Definition at line 675 of file output.c.

{
       int result;

       if (OG(disable_output)) {
              return 0;
       }

       result = OG(php_header_write)(str, str_length TSRMLS_CC);

       if (OG(implicit_flush)) {
              sapi_flush(TSRMLS_C);
       }

       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 46 of file output.c.