hholzgra Tue Sep 17 08:37:26 2002 EDT
Modified files:
/php4/ext/standard basic_functions.c head.c
Log:
headers_sent() may now return information about where output started
using the optional $file and $line reference parameters
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.504
php4/ext/standard/basic_functions.c:1.505
--- php4/ext/standard/basic_functions.c:1.504 Wed Sep 11 14:13:48 2002
+++ php4/ext/standard/basic_functions.c Tue Sep 17 08:37:26 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.504 2002/09/11 18:13:48 andrey Exp $ */
+/* $Id: basic_functions.c,v 1.505 2002/09/17 12:37:26 hholzgra Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -94,6 +94,7 @@
#include "php_fopen_wrappers.h"
+static unsigned char first_and_second__args_force_ref[] = { 2, BYREF_FORCE,
+BYREF_FORCE };
static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE,
BYREF_FORCE, BYREF_FORCE };
static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE,
BYREF_FORCE, BYREF_FORCE };
@@ -540,7 +541,7 @@
PHP_FE(ini_restore,
NULL)
PHP_FE(setcookie,
NULL)
- PHP_FE(header,
NULL)
+ PHP_FE(header,
+ first_and_second__args_force_ref)
PHP_FE(headers_sent,
NULL)
PHP_FE(connection_aborted,
NULL)
Index: php4/ext/standard/head.c
diff -u php4/ext/standard/head.c:1.63 php4/ext/standard/head.c:1.64
--- php4/ext/standard/head.c:1.63 Thu Sep 5 10:21:55 2002
+++ php4/ext/standard/head.c Tue Sep 17 08:37:26 2002
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: head.c,v 1.63 2002/09/05 14:21:55 hyanantha Exp $ */
+/* $Id: head.c,v 1.64 2002/09/17 12:37:26 hholzgra Exp $ */
#include <stdio.h>
@@ -161,13 +161,24 @@
/* }}} */
-/* {{{ 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)) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php