1999-10-28 02:30:41 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| PHP version 4.0 |
|
|
|
|
+----------------------------------------------------------------------+
|
2000-01-01 09:32:05 +08:00
|
|
|
| Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
|
1999-10-28 02:30:41 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2000-05-18 23:34:45 +08:00
|
|
|
| This source file is subject to version 2.02 of the PHP license, |
|
1999-10-28 02:30:41 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available at through the world-wide-web at |
|
2000-05-18 23:34:45 +08:00
|
|
|
| http://www.php.net/license/2_02.txt. |
|
1999-10-28 02:30:41 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
2000-06-07 02:54:00 +08:00
|
|
|
| Authors: Zeev Suraski <zeev@zend.com> |
|
1999-10-28 02:30:41 +08:00
|
|
|
| Thies C. Arntzen <thies@digicol.de> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2000-07-24 09:40:02 +08:00
|
|
|
/* $Id$ */
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
#include "php.h"
|
|
|
|
#include "ext/standard/head.h"
|
|
|
|
#include "ext/session/php_session.h"
|
|
|
|
#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 void php_ob_init(uint initial_size, uint block_size);
|
1999-12-05 22:16:37 +08:00
|
|
|
static void php_ob_destroy(void);
|
1999-10-28 02:30:41 +08:00
|
|
|
static void php_ob_append(const char *text, uint text_length);
|
1999-12-05 22:16:37 +08:00
|
|
|
#if 0
|
1999-10-28 02:30:41 +08:00
|
|
|
static void php_ob_prepend(const char *text, uint text_length);
|
1999-12-05 22:16:37 +08:00
|
|
|
#endif
|
|
|
|
static inline void php_ob_send(void);
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef ZTS
|
|
|
|
int output_globals_id;
|
|
|
|
#else
|
|
|
|
php_output_globals output_globals;
|
|
|
|
#endif
|
|
|
|
|
1999-11-27 02:34:27 +08:00
|
|
|
static void php_output_init_globals(OLS_D)
|
1999-10-28 02:30:41 +08:00
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OG(php_body_write) = NULL;
|
|
|
|
OG(php_header_write) = NULL;
|
2000-01-14 01:37:25 +08:00
|
|
|
OG(implicit_flush) = 0;
|
2000-02-04 22:54:30 +08:00
|
|
|
OG(output_start_filename) = NULL;
|
|
|
|
OG(output_start_lineno) = 0;
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-23 11:10:46 +08:00
|
|
|
PHP_GINIT_FUNCTION(output)
|
1999-10-28 02:30:41 +08:00
|
|
|
{
|
|
|
|
#ifdef ZTS
|
2000-01-14 01:37:25 +08:00
|
|
|
output_globals_id = ts_allocate_id(sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL);
|
1999-11-27 02:34:27 +08:00
|
|
|
#else
|
1999-11-29 04:38:44 +08:00
|
|
|
php_output_init_globals(OLS_C);
|
1999-10-28 02:30:41 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start output layer */
|
|
|
|
PHPAPI void php_output_startup()
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
1999-11-24 06:10:44 +08:00
|
|
|
OG(php_body_write) = php_ub_body_write;
|
|
|
|
OG(php_header_write) = sapi_module.ub_write;
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(nesting_level) = 0;
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
PHPAPI int php_body_write(const char *str, uint str_length)
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
|
|
|
return OG(php_body_write)(str, str_length);
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
PHPAPI int php_header_write(const char *str, uint str_length)
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
|
|
|
return OG(php_header_write)(str, str_length);
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Start output buffering */
|
2000-07-29 22:46:09 +08:00
|
|
|
PHPAPI void php_start_ob_buffer()
|
1999-10-28 02:30:41 +08:00
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
php_ob_init(4096, 1024);
|
1999-11-24 06:10:44 +08:00
|
|
|
OG(php_body_write) = php_b_body_write;
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
/* End output buffering (one level) */
|
|
|
|
PHPAPI void php_end_ob_buffer(int send_buffer)
|
1999-10-28 02:30:41 +08:00
|
|
|
{
|
|
|
|
SLS_FETCH();
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
if (OG(nesting_level)==0) {
|
1999-10-28 02:30:41 +08:00
|
|
|
return;
|
|
|
|
}
|
2000-07-29 22:46:09 +08:00
|
|
|
if (OG(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;
|
|
|
|
}
|
|
|
|
if (send_buffer) {
|
|
|
|
php_ob_send();
|
|
|
|
}
|
|
|
|
} else { /* only flush the buffer, if necessary */
|
|
|
|
if (send_buffer) {
|
|
|
|
OG(php_body_write)(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
|
|
|
|
}
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
php_ob_destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
/* End output buffering (all buffers) */
|
|
|
|
PHPAPI void php_end_ob_buffers(int send_buffer)
|
|
|
|
{
|
|
|
|
OLS_FETCH();
|
|
|
|
|
|
|
|
while (OG(nesting_level)!=0) {
|
|
|
|
php_end_ob_buffer(send_buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-14 01:37:25 +08:00
|
|
|
PHPAPI void php_start_implicit_flush()
|
|
|
|
{
|
2000-01-14 01:54:51 +08:00
|
|
|
OLS_FETCH();
|
2000-01-14 01:37:25 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
php_end_ob_buffer(1); /* Switch out of output buffering if we're in it */
|
2000-01-14 01:54:51 +08:00
|
|
|
OG(implicit_flush)=1;
|
2000-01-14 01:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PHPAPI void php_end_implicit_flush()
|
|
|
|
{
|
2000-01-14 01:54:51 +08:00
|
|
|
OLS_FETCH();
|
|
|
|
|
|
|
|
OG(implicit_flush)=0;
|
2000-01-14 01:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-28 02:30:41 +08:00
|
|
|
/*
|
|
|
|
* Output buffering - implementation
|
|
|
|
*/
|
|
|
|
|
1999-12-05 22:16:37 +08:00
|
|
|
static inline void php_ob_allocate(void)
|
1999-10-28 02:30:41 +08:00
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
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;
|
|
|
|
}
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, OG(active_ob_buffer).size+1);
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void php_ob_init(uint initial_size, uint block_size)
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
if (OG(nesting_level)>0) {
|
|
|
|
if (OG(nesting_level)==1) { /* initialize stack */
|
|
|
|
zend_stack_init(&OG(ob_buffers));
|
|
|
|
}
|
|
|
|
zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(nesting_level)++;
|
|
|
|
OG(active_ob_buffer).block_size = block_size;
|
|
|
|
OG(active_ob_buffer).size = initial_size;
|
|
|
|
OG(active_ob_buffer).buffer = (char *) emalloc(initial_size+1);
|
|
|
|
OG(active_ob_buffer).text_length = 0;
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void php_ob_destroy()
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
if (OG(nesting_level)>0) {
|
|
|
|
efree(OG(active_ob_buffer).buffer);
|
|
|
|
if (OG(nesting_level)>1) { /* restore previous buffer */
|
|
|
|
php_ob_buffer *ob_buffer_p;
|
|
|
|
|
|
|
|
zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
|
|
|
|
OG(active_ob_buffer) = *ob_buffer_p;
|
|
|
|
zend_stack_del_top(&OG(ob_buffers));
|
|
|
|
if (OG(nesting_level)==2) { /* destroy the stack */
|
|
|
|
zend_stack_destroy(&OG(ob_buffers));
|
|
|
|
}
|
|
|
|
}
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(nesting_level)--;
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void php_ob_append(const char *text, uint text_length)
|
|
|
|
{
|
|
|
|
char *target;
|
|
|
|
int original_ob_text_length;
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
original_ob_text_length=OG(active_ob_buffer).text_length;
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(active_ob_buffer).text_length += text_length;
|
1999-10-28 02:30:41 +08:00
|
|
|
php_ob_allocate();
|
2000-07-29 22:46:09 +08:00
|
|
|
target = OG(active_ob_buffer).buffer+original_ob_text_length;
|
1999-10-28 02:30:41 +08:00
|
|
|
memcpy(target, text, text_length);
|
|
|
|
target[text_length]=0;
|
|
|
|
}
|
|
|
|
|
1999-12-05 22:16:37 +08:00
|
|
|
#if 0
|
1999-10-28 02:30:41 +08:00
|
|
|
static void php_ob_prepend(const char *text, uint text_length)
|
|
|
|
{
|
|
|
|
char *p, *start;
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(active_ob_buffer).text_length += text_length;
|
1999-10-28 02:30:41 +08:00
|
|
|
php_ob_allocate();
|
|
|
|
|
1999-11-24 06:10:44 +08:00
|
|
|
/* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */
|
|
|
|
p = OG(ob_buffer)+OG(ob_text_length);
|
|
|
|
start = OG(ob_buffer);
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
while (--p>=start) {
|
|
|
|
p[text_length] = *p;
|
|
|
|
}
|
1999-11-24 06:10:44 +08:00
|
|
|
memcpy(OG(ob_buffer), text, text_length);
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(ob_buffer)[OG(active_ob_buffer).text_length]=0;
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
1999-12-05 22:16:37 +08:00
|
|
|
#endif
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
static inline void php_ob_send()
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
/* header_write is a simple, unbuffered output function */
|
2000-07-29 22:46:09 +08:00
|
|
|
OG(php_body_write)(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the current output buffer */
|
|
|
|
int php_ob_get_buffer(pval *p)
|
|
|
|
{
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
2000-07-29 22:46:09 +08:00
|
|
|
if (OG(nesting_level)==0) {
|
1999-10-28 02:30:41 +08:00
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
p->type = IS_STRING;
|
2000-07-29 22:46:09 +08:00
|
|
|
p->value.str.val = estrndup(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
|
|
|
|
p->value.str.len = OG(active_ob_buffer).text_length;
|
1999-10-28 02:30:41 +08:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-25 11:10:42 +08:00
|
|
|
/* Return the size of the current output buffer */
|
|
|
|
int php_ob_get_length(pval *p)
|
|
|
|
{
|
|
|
|
OLS_FETCH();
|
|
|
|
|
|
|
|
if (OG(nesting_level) == 0) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
p->type = IS_LONG;
|
|
|
|
p->value.lval = OG(active_ob_buffer).text_length;
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
1999-10-28 02:30:41 +08:00
|
|
|
/*
|
|
|
|
* Wrapper functions - implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* buffered output function */
|
|
|
|
static int php_b_body_write(const char *str, uint str_length)
|
|
|
|
{
|
|
|
|
php_ob_append(str, str_length);
|
|
|
|
return str_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int php_ub_body_write_no_header(const char *str, uint str_length)
|
|
|
|
{
|
|
|
|
char *newstr = NULL;
|
|
|
|
uint new_length=0;
|
|
|
|
int result;
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
session_adapt_uris(str, str_length, &newstr, &new_length);
|
|
|
|
|
|
|
|
if (newstr) {
|
|
|
|
str = newstr;
|
|
|
|
str_length = new_length;
|
|
|
|
}
|
|
|
|
|
1999-11-24 06:10:44 +08:00
|
|
|
result = OG(php_header_write)(str, str_length);
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
if (newstr) {
|
|
|
|
free(newstr);
|
|
|
|
}
|
|
|
|
|
2000-01-14 01:54:51 +08:00
|
|
|
if (OG(implicit_flush)) {
|
|
|
|
sapi_flush();
|
|
|
|
}
|
2000-01-14 01:37:25 +08:00
|
|
|
|
1999-10-28 02:30:41 +08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int php_ub_body_write(const char *str, uint str_length)
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
SLS_FETCH();
|
1999-11-24 06:10:44 +08:00
|
|
|
OLS_FETCH();
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
if (SG(request_info).headers_only) {
|
|
|
|
zend_bailout();
|
|
|
|
}
|
1999-12-18 03:51:39 +08:00
|
|
|
if (php_header()) {
|
2000-02-04 22:54:30 +08:00
|
|
|
if (zend_is_compiling()) {
|
|
|
|
CLS_FETCH();
|
|
|
|
|
|
|
|
OG(output_start_filename) = zend_get_compiled_filename(CLS_C);
|
|
|
|
OG(output_start_lineno) = zend_get_compiled_lineno(CLS_C);
|
|
|
|
} else if (zend_is_executing()) {
|
|
|
|
ELS_FETCH();
|
|
|
|
|
|
|
|
OG(output_start_filename) = zend_get_executed_filename(ELS_C);
|
|
|
|
OG(output_start_lineno) = zend_get_executed_lineno(ELS_C);
|
|
|
|
}
|
|
|
|
|
1999-11-24 06:10:44 +08:00
|
|
|
OG(php_body_write) = php_ub_body_write_no_header;
|
1999-10-28 02:30:41 +08:00
|
|
|
result = php_ub_body_write_no_header(str, str_length);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* HEAD support
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2000-04-19 04:00:21 +08:00
|
|
|
/* {{{ proto void ob_start(void)
|
2000-04-19 03:18:47 +08:00
|
|
|
Turn on Output Buffering */
|
1999-10-28 02:30:41 +08:00
|
|
|
PHP_FUNCTION(ob_start)
|
|
|
|
{
|
2000-07-29 22:46:09 +08:00
|
|
|
php_start_ob_buffer();
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
2000-04-19 03:18:47 +08:00
|
|
|
/* }}} */
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
|
2000-04-19 04:00:21 +08:00
|
|
|
/* {{{ proto void ob_end_flush(void)
|
2000-04-19 03:18:47 +08:00
|
|
|
Flush (send) the output buffer, and turn off output buffering */
|
1999-10-28 02:30:41 +08:00
|
|
|
PHP_FUNCTION(ob_end_flush)
|
|
|
|
{
|
2000-07-29 22:46:09 +08:00
|
|
|
php_end_ob_buffer(1);
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
2000-04-19 03:18:47 +08:00
|
|
|
/* }}} */
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
|
2000-04-19 04:00:21 +08:00
|
|
|
/* {{{ proto void ob_end_clean(void)
|
2000-04-19 03:18:47 +08:00
|
|
|
Clean (erase) the output buffer, and turn off output buffering */
|
1999-10-28 02:30:41 +08:00
|
|
|
PHP_FUNCTION(ob_end_clean)
|
|
|
|
{
|
2000-07-29 22:46:09 +08:00
|
|
|
php_end_ob_buffer(0);
|
1999-10-28 02:30:41 +08:00
|
|
|
}
|
2000-04-19 03:18:47 +08:00
|
|
|
/* }}} */
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
|
2000-05-24 07:13:02 +08:00
|
|
|
/* {{{ proto string ob_get_contents(void)
|
2000-04-19 03:18:47 +08:00
|
|
|
Return the contents of the output buffer */
|
1999-10-28 02:30:41 +08:00
|
|
|
PHP_FUNCTION(ob_get_contents)
|
|
|
|
{
|
|
|
|
if (php_ob_get_buffer(return_value)==FAILURE) {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
}
|
2000-04-19 03:18:47 +08:00
|
|
|
/* }}} */
|
1999-10-28 02:30:41 +08:00
|
|
|
|
|
|
|
|
2000-08-25 11:10:42 +08:00
|
|
|
/* {{{ proto string ob_get_length(void)
|
|
|
|
Return the length of the output buffer */
|
|
|
|
PHP_FUNCTION(ob_get_length)
|
|
|
|
{
|
|
|
|
if (php_ob_get_length(return_value)==FAILURE) {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
2000-04-19 04:00:21 +08:00
|
|
|
/* {{{ proto void ob_implicit_flush([int flag])
|
|
|
|
Turn implicit flush on/off and is equivalent to calling flush() after every output call */
|
2000-01-14 01:37:25 +08:00
|
|
|
PHP_FUNCTION(ob_implicit_flush)
|
|
|
|
{
|
|
|
|
zval **zv_flag;
|
2000-01-16 01:23:18 +08:00
|
|
|
int flag;
|
2000-01-14 01:37:25 +08:00
|
|
|
|
|
|
|
switch(ZEND_NUM_ARGS()) {
|
|
|
|
case 0:
|
|
|
|
flag = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (zend_get_parameters_ex(1, &zv_flag)==FAILURE) {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
convert_to_long_ex(zv_flag);
|
|
|
|
flag = (*zv_flag)->value.lval;
|
|
|
|
break;
|
2000-01-16 01:23:18 +08:00
|
|
|
default:
|
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
break;
|
2000-01-14 01:37:25 +08:00
|
|
|
}
|
2000-01-14 01:54:51 +08:00
|
|
|
if (flag) {
|
|
|
|
php_start_implicit_flush();
|
|
|
|
} else {
|
|
|
|
php_end_implicit_flush();
|
|
|
|
}
|
2000-01-14 01:37:25 +08:00
|
|
|
}
|
2000-04-19 03:18:47 +08:00
|
|
|
/* }}} */
|
2000-01-14 01:37:25 +08:00
|
|
|
|
|
|
|
|
2000-02-04 22:54:30 +08:00
|
|
|
PHPAPI char *php_get_output_start_filename()
|
|
|
|
{
|
|
|
|
OLS_FETCH();
|
|
|
|
|
|
|
|
return OG(output_start_filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PHPAPI int php_get_output_start_lineno()
|
|
|
|
{
|
|
|
|
OLS_FETCH();
|
|
|
|
|
|
|
|
return OG(output_start_lineno);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-14 01:37:25 +08:00
|
|
|
|
1999-10-28 02:30:41 +08:00
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*/
|