Skip to content

Commit 2d1b6f0

Browse files
committed
Added headers_sent() function
1 parent f8fdee1 commit 2d1b6f0

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

ext/standard/basic_functions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ function_entry basic_functions[] = {
284284
PHP_FE(print_r, NULL)
285285
{"setcookie", php3_SetCookie, NULL},
286286
{"header", php3_Header, NULL},
287+
PHP_FE(headers_sent, NULL)
287288
PHP_FE(function_exists, NULL)
288289
PHP_FE(in_array, NULL)
289290
PHP_FE(extract, NULL)

ext/standard/head.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "main.h"
2525
#include "head.h"
2626
#include "post.h"
27+
#include "SAPI.h"
2728
#ifdef TM_IN_SYS_TIME
2829
#include <sys/time.h>
2930
#else
@@ -556,6 +557,16 @@ int php3_headers_unsent(void)
556557
}
557558
}
558559

560+
PHP_FUNCTION(headers_sent)
561+
{
562+
SLS_FETCH();
563+
564+
if (SG(headers_sent)) {
565+
RETURN_TRUE;
566+
} else {
567+
RETURN_FALSE;
568+
}
569+
}
559570

560571
function_entry php3_header_functions[] = {
561572
{NULL, NULL, NULL}

ext/standard/head.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ extern php3_module_entry php3_header_module_entry;
5555
extern int php3_init_head(INIT_FUNC_ARGS);
5656
PHP_FUNCTION(Header);
5757
PHP_FUNCTION(SetCookie);
58+
PHP_FUNCTION(headers_sent);
5859

5960
void php4i_add_header_information(char *header_information, uint header_length);
6061

0 commit comments

Comments
 (0)