@@ -103,16 +103,20 @@ static size_t (*php_output_direct)(const char *str, size_t str_len) = php_output
103
103
static void php_output_header (void )
104
104
{
105
105
if (!SG (headers_sent )) {
106
- if (!OG (output_start_filename )) {
106
+ if (!OG (output_start_filename_str )) {
107
107
if (zend_is_compiling ()) {
108
- OG (output_start_filename ) = ZSTR_VAL ( zend_get_compiled_filename () );
108
+ OG (output_start_filename_str ) = zend_get_compiled_filename ();
109
109
OG (output_start_lineno ) = zend_get_compiled_lineno ();
110
110
} else if (zend_is_executing ()) {
111
- OG (output_start_filename ) = zend_get_executed_filename ();
111
+ OG (output_start_filename_str ) = zend_get_executed_filename_ex ();
112
112
OG (output_start_lineno ) = zend_get_executed_lineno ();
113
113
}
114
+ if (OG (output_start_filename_str )) {
115
+ zend_string_addref (OG (output_start_filename_str ));
116
+ }
114
117
#if PHP_OUTPUT_DEBUG
115
- fprintf (stderr , "!!! output started at: %s (%d)\n" , OG (output_start_filename ), OG (output_start_lineno ));
118
+ fprintf (stderr , "!!! output started at: %s (%d)\n" ,
119
+ ZSTR_VAL (OG (output_start_filename_str )), OG (output_start_lineno ));
116
120
#endif
117
121
}
118
122
if (!php_header ()) {
@@ -190,6 +194,11 @@ PHPAPI void php_output_deactivate(void)
190
194
}
191
195
zend_stack_destroy (& OG (handlers ));
192
196
}
197
+
198
+ if (OG (output_start_filename_str )) {
199
+ zend_string_release (OG (output_start_filename_str ));
200
+ OG (output_start_filename_str ) = NULL ;
201
+ }
193
202
}
194
203
/* }}} */
195
204
@@ -749,7 +758,7 @@ PHPAPI void php_output_set_implicit_flush(int flush)
749
758
* Get the file name where output has started */
750
759
PHPAPI const char * php_output_get_start_filename (void )
751
760
{
752
- return OG (output_start_filename );
761
+ return ZSTR_VAL ( OG (output_start_filename_str ) );
753
762
}
754
763
/* }}} */
755
764
0 commit comments