cvs: php4 /ext/standard head.c
| From: | Hartmut Holzgraefe | Date: | Tue, 17 Sep 2002 13:54:41 +0000 |
| Subject: | cvs: php4 /ext/standard head.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-14074@lists.php.net to get a copy of this message | ||
hholzgra Tue Sep 17 09:54:41 2002 EDT
Modified files:
/php4/ext/standard head.c
Log:
it should not only work for the failure case
but also not fail (segfault) on the working case
Index: php4/ext/standard/head.c
diff -u php4/ext/standard/head.c:1.64 php4/ext/standard/head.c:1.65
--- php4/ext/standard/head.c:1.64 Tue Sep 17 08:37:26 2002
+++ php4/ext/standard/head.c Tue Sep 17 09:54:40 2002
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: head.c,v 1.64 2002/09/17 12:37:26 hholzgra Exp $ */
+/* $Id: head.c,v 1.65 2002/09/17 13:54:40 hholzgra Exp $ */
#include <stdio.h>
@@ -166,18 +166,24 @@
PHP_FUNCTION(headers_sent)
{
zval *arg1, *arg2;
+ char *file="";
+ int line=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &arg1, &arg2) ==
FAILURE)
return;
-
+ if (SG(headers_sent)) {
+ line = php_get_output_start_lineno(TSRMLS_C);
+ file = php_get_output_start_filename(TSRMLS_C);
+ }
+
switch(ZEND_NUM_ARGS()) {
case 2:
zval_dtor(arg2);
- ZVAL_LONG(arg2, php_get_output_start_lineno(TSRMLS_C));
+ ZVAL_LONG(arg2, line);
case 1:
zval_dtor(arg1);
- ZVAL_STRING(arg1, php_get_output_start_filename(TSRMLS_C), 1);
+ ZVAL_STRING(arg1, file, 1);
break;
}