diff options
author | Zeev Suraski <zeev@php.net> | 2000-02-04 14:54:30 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2000-02-04 14:54:30 +0000 |
commit | 8055da983011d27441fd560f39eea9bc0646580b (patch) | |
tree | 271815f6c0e72d661f2475504f96de8aa1b0a2e2 /main/output.c | |
parent | b6197bcf902373c481eac2c5484954c3b3bd5f85 (diff) | |
download | php-git-8055da983011d27441fd560f39eea9bc0646580b.tar.gz |
Use the new state functions
@- If header information is sent after output has already been sent, the warning
@ message will now state the filename and line number at which the first output
@ was made (Zeev)
Diffstat (limited to 'main/output.c')
-rw-r--r-- | main/output.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/main/output.c b/main/output.c index f115a7bab6..b7fa6ebca1 100644 --- a/main/output.c +++ b/main/output.c @@ -46,6 +46,8 @@ typedef struct { uint ob_block_size; uint ob_text_length; unsigned char implicit_flush; + char *output_start_filename; + int output_start_lineno; } php_output_globals; #ifdef ZTS @@ -79,6 +81,8 @@ static void php_output_init_globals(OLS_D) OG(ob_block_size) = 0; OG(ob_text_length) = 0; OG(implicit_flush) = 0; + OG(output_start_filename) = NULL; + OG(output_start_lineno) = 0; } @@ -342,6 +346,18 @@ static int php_ub_body_write(const char *str, uint str_length) zend_bailout(); } if (php_header()) { + 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); + } + OG(php_body_write) = php_ub_body_write_no_header; result = php_ub_body_write_no_header(str, str_length); } @@ -409,6 +425,22 @@ PHP_FUNCTION(ob_implicit_flush) } +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); +} + + /* * Local variables: |