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()) {
}
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;
+ }
}
/* }}} */
* 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));
}
/* }}} */
zend_stack handlers;
php_output_handler *active;
php_output_handler *running;
- const char *output_start_filename;
+ const char *output_start_filename; /* TODO: Unused, remove */
int output_start_lineno;
int flags;
+ zend_string *output_start_filename_str;
ZEND_END_MODULE_GLOBALS(output)
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(output)