diff options
Diffstat (limited to 'main/output.c')
-rw-r--r-- | main/output.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/main/output.c b/main/output.c index c895d3856e..cffadede80 100644 --- a/main/output.c +++ b/main/output.c @@ -103,16 +103,20 @@ static size_t (*php_output_direct)(const char *str, size_t str_len) = php_output static void php_output_header(void) { if (!SG(headers_sent)) { - if (!OG(output_start_filename)) { + if (!OG(output_start_filename_str)) { if (zend_is_compiling()) { - OG(output_start_filename) = ZSTR_VAL(zend_get_compiled_filename()); + OG(output_start_filename_str) = zend_get_compiled_filename(); OG(output_start_lineno) = zend_get_compiled_lineno(); } else if (zend_is_executing()) { - OG(output_start_filename) = zend_get_executed_filename(); + OG(output_start_filename_str) = zend_get_executed_filename_ex(); OG(output_start_lineno) = zend_get_executed_lineno(); } + if (OG(output_start_filename_str)) { + zend_string_addref(OG(output_start_filename_str)); + } #if PHP_OUTPUT_DEBUG - fprintf(stderr, "!!! output started at: %s (%d)\n", OG(output_start_filename), OG(output_start_lineno)); + fprintf(stderr, "!!! output started at: %s (%d)\n", + ZSTR_VAL(OG(output_start_filename_str)), OG(output_start_lineno)); #endif } if (!php_header()) { @@ -190,6 +194,11 @@ PHPAPI void php_output_deactivate(void) } zend_stack_destroy(&OG(handlers)); } + + if (OG(output_start_filename_str)) { + zend_string_release(OG(output_start_filename_str)); + OG(output_start_filename_str) = NULL; + } } /* }}} */ @@ -749,7 +758,7 @@ PHPAPI void php_output_set_implicit_flush(int flush) * Get the file name where output has started */ PHPAPI const char *php_output_get_start_filename(void) { - return OG(output_start_filename); + return ZSTR_VAL(OG(output_start_filename_str)); } /* }}} */ |