summaryrefslogtreecommitdiff
path: root/ext/standard/head.c
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2002-09-17 12:37:26 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2002-09-17 12:37:26 +0000
commit0c7d9c3742667b77a84bb6e571d00b6376c18d50 (patch)
treeb191bcc6492c313897a78997712c03e1fd744a7d /ext/standard/head.c
parent31429c60dbf50b5ad1351f4b9fbe528cd6290d67 (diff)
downloadphp-git-0c7d9c3742667b77a84bb6e571d00b6376c18d50.tar.gz
headers_sent() may now return information about where output started
using the optional $file and $line reference parameters
Diffstat (limited to 'ext/standard/head.c')
-rw-r--r--ext/standard/head.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/ext/standard/head.c b/ext/standard/head.c
index a6672239aa..0766261a7b 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -161,13 +161,24 @@ PHP_FUNCTION(setcookie)
/* }}} */
-/* {{{ proto int headers_sent(void)
+/* {{{ proto bool headers_sent([string &$file [, int &$line]])
Returns true if headers have already been sent, false otherwise */
PHP_FUNCTION(headers_sent)
{
- if (ZEND_NUM_ARGS() != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "No parameters expected, %d given", ZEND_NUM_ARGS());
+ zval *arg1, *arg2;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) == FAILURE)
return;
+
+
+ switch(ZEND_NUM_ARGS()) {
+ case 2:
+ zval_dtor(arg2);
+ ZVAL_LONG(arg2, php_get_output_start_lineno(TSRMLS_C));
+ case 1:
+ zval_dtor(arg1);
+ ZVAL_STRING(arg1, php_get_output_start_filename(TSRMLS_C), 1);
+ break;
}
if (SG(headers_sent)) {