summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2002-09-17 13:54:40 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2002-09-17 13:54:40 +0000
commit4e6635742d9921ae60d84cf3b2d66ed8fb2432cc (patch)
tree06fefa3df7e7d949db2e3adee56803d8f7b2ceaa
parentc5d4be214cb75afe1ad6353b313feb2530c597db (diff)
downloadphp-git-4e6635742d9921ae60d84cf3b2d66ed8fb2432cc.tar.gz
it should not only work for the failure case
but also not fail (segfault) on the working case
-rw-r--r--ext/standard/head.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 0766261a7b..87994bc369 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -166,18 +166,24 @@ PHP_FUNCTION(setcookie)
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;
}