Skip to content

Commit f356be6

Browse files
committed
ini intl.explicit_cleanup -> INTL_EXPLICIT_CLEANUP
Added an environment variable and removed the ini setting intl.explicit_cleanup for calling u_cleanup()
1 parent 777160f commit f356be6

1 file changed

Lines changed: 5 additions & 26 deletions

File tree

ext/intl/php_intl.c

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -853,36 +853,11 @@ zend_function_entry intl_functions[] = {
853853
};
854854
/* }}} */
855855

856-
static zend_bool explicit_cleanup = 0;
857-
858-
static ZEND_INI_MH(OnExplicitCleanupUpdate)
859-
{
860-
if (stage == PHP_INI_STAGE_STARTUP) {
861-
if (new_value_length == 2 && strcasecmp("on", new_value) == 0) {
862-
explicit_cleanup = (zend_bool)1;
863-
}
864-
else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) {
865-
explicit_cleanup = (zend_bool)1;
866-
}
867-
else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) {
868-
explicit_cleanup = (zend_bool)1;
869-
}
870-
else {
871-
explicit_cleanup = (zend_bool)atoi(new_value);
872-
}
873-
return SUCCESS;
874-
} else {
875-
return FAILURE;
876-
}
877-
}
878-
879-
880856
/* {{{ INI Settings */
881857
PHP_INI_BEGIN()
882858
STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale, zend_intl_globals, intl_globals)
883859
STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong, error_level, zend_intl_globals, intl_globals)
884860
STD_PHP_INI_ENTRY("intl.use_exceptions", "0", PHP_INI_ALL, OnUpdateBool, use_exceptions, zend_intl_globals, intl_globals)
885-
PHP_INI_ENTRY_EX("intl.explicit_cleanup", "0", 0, OnExplicitCleanupUpdate, zend_ini_boolean_displayer_cb)
886861
PHP_INI_END()
887862
/* }}} */
888863

@@ -1015,14 +990,18 @@ PHP_MINIT_FUNCTION( intl )
1015990
}
1016991
/* }}} */
1017992

993+
#define EXPLICIT_CLEANUP_ENV_VAR "INTL_EXPLICIT_CLEANUP"
994+
1018995
/* {{{ PHP_MSHUTDOWN_FUNCTION
1019996
*/
1020997
PHP_MSHUTDOWN_FUNCTION( intl )
1021998
{
999+
const char *cleanup;
10221000
/* For the default locale php.ini setting */
10231001
UNREGISTER_INI_ENTRIES();
10241002

1025-
if (explicit_cleanup) {
1003+
cleanup = getenv(EXPLICIT_CLEANUP_ENV_VAR);
1004+
if (cleanup != NULL && !(cleanup[0] == '0' && cleanup[1] == '\0')) {
10261005
u_cleanup();
10271006
}
10281007

0 commit comments

Comments
 (0)