Skip to content

Commit 41e2f2a

Browse files
committed
main: convert output_handler global to zend_string*
This prevents a reallocation
1 parent ba64232 commit 41e2f2a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

main/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ PHP_INI_BEGIN()
819819
STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateReportMemleaks, report_memleaks, php_core_globals, core_globals)
820820
STD_PHP_INI_BOOLEAN("report_zend_debug", "0", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals)
821821
STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals)
822-
STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals)
822+
STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateStrNotEmpty, output_handler, php_core_globals, core_globals)
823823
STD_PHP_INI_BOOLEAN("register_argc_argv", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
824824
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals)
825825
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
@@ -1915,10 +1915,10 @@ zend_result php_request_startup(void)
19151915
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
19161916
}
19171917

1918-
if (PG(output_handler) && PG(output_handler)[0]) {
1918+
if (PG(output_handler)) {
19191919
zval oh;
19201920

1921-
ZVAL_STRING(&oh, PG(output_handler));
1921+
ZVAL_STR_COPY(&oh, PG(output_handler));
19221922
php_output_start_user(&oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS);
19231923
zval_ptr_dtor(&oh);
19241924
} else if (PG(output_buffering)) {

main/php_globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct _php_core_globals {
6565
bool ignore_repeated_source;
6666
bool report_memleaks;
6767

68-
char *output_handler;
68+
zend_string *output_handler;
6969

7070
zend_string *unserialize_callback_func;
7171
zend_long serialize_precision;

0 commit comments

Comments
 (0)