From: Andrey Hristov Date: Tue, 20 Jul 1999 18:03:27 +0000 (+0000) Subject: Added headers_sent() function X-Git-Tag: php-4.0b1~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d1b6f08017a7a5733280835b4cfa94c8acfd56c;p=php Added headers_sent() function --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 4ff386f0cd..2a95586043 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -284,6 +284,7 @@ function_entry basic_functions[] = { PHP_FE(print_r, NULL) {"setcookie", php3_SetCookie, NULL}, {"header", php3_Header, NULL}, + PHP_FE(headers_sent, NULL) PHP_FE(function_exists, NULL) PHP_FE(in_array, NULL) PHP_FE(extract, NULL) diff --git a/ext/standard/head.c b/ext/standard/head.c index f1bd0dcdc8..cfc6930f7d 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -24,6 +24,7 @@ #include "main.h" #include "head.h" #include "post.h" +#include "SAPI.h" #ifdef TM_IN_SYS_TIME #include #else @@ -556,6 +557,16 @@ int php3_headers_unsent(void) } } +PHP_FUNCTION(headers_sent) +{ + SLS_FETCH(); + + if (SG(headers_sent)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} function_entry php3_header_functions[] = { {NULL, NULL, NULL} diff --git a/ext/standard/head.h b/ext/standard/head.h index 977fc83345..a8096ecaca 100644 --- a/ext/standard/head.h +++ b/ext/standard/head.h @@ -55,6 +55,7 @@ extern php3_module_entry php3_header_module_entry; extern int php3_init_head(INIT_FUNC_ARGS); PHP_FUNCTION(Header); PHP_FUNCTION(SetCookie); +PHP_FUNCTION(headers_sent); void php4i_add_header_information(char *header_information, uint header_length);