com php-src: Add ini setting intl.explicit_cleanup: ext /intl/php_intl.c
| From: | Gustavo André dos Santos Lopes | Date: | Mon, 23 Jul 2012 14:36:24 +0000 |
| Subject: | com php-src: Add ini setting intl.explicit_cleanup: ext /intl/php_intl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69667@lists.php.net to get a copy of this message | ||
Commit: 0dfcc3e798cd54714f792bf7507c37b96146ee1b
Author: Gustavo Lopes <glopes@safelinq.com> Mon, 23 Jul 2012 16:36:24 +0200
Parents: f43e4f9883047b4be6bd01bf80f070682131ad5f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0dfcc3e798cd54714f792bf7507c37b96146ee1b
Log:
Add ini setting intl.explicit_cleanup
This is to help with looking for leaks. If set to true, this ini
setting forces a call to u_cleanup() on module shutdown.
Changed paths:
M ext/intl/php_intl.c
Diff:
diff --git a/ext/intl/php_intl..c b/ext/intl/php_intl.c
index d7ed9dc..41a1d1c 100755
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -96,6 +96,7 @@
#include "common/common_enum.h"
#include <unicode/uloc.h>
+#include <unicode/uclean.h>
#include <ext/standard/info.h>
#include "php_ini.h"
@@ -852,16 +853,39 @@ zend_function_entry intl_functions[] = {
};
/* }}} */
+static zend_bool explicit_cleanup = 0;
+
+static ZEND_INI_MH(OnExplicitCleanupUpdate)
+{
+ if (stage == PHP_INI_STAGE_STARTUP) {
+ if (new_value_length == 2 && strcasecmp("on", new_value) == 0) {
+ explicit_cleanup = (zend_bool)1;
+ }
+ else if (new_value_length == 3 && strcasecmp("yes", new_value) == 0) {
+ explicit_cleanup = (zend_bool)1;
+ }
+ else if (new_value_length == 4 && strcasecmp("true", new_value) == 0) {
+ explicit_cleanup = (zend_bool)1;
+ }
+ else {
+ explicit_cleanup = (zend_bool)atoi(new_value);
+ }
+ return SUCCESS;
+ } else {
+ return FAILURE;
+ }
+}
+
/* {{{ INI Settings */
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY(LOCALE_INI_NAME, NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_locale,
zend_intl_globals, intl_globals)
STD_PHP_INI_ENTRY("intl.error_level", "0", PHP_INI_ALL, OnUpdateLong,
error_level, zend_intl_globals, intl_globals)
STD_PHP_INI_ENTRY("intl.use_exceptions", "0", PHP_INI_ALL, OnUpdateBool,
use_exceptions, zend_intl_globals, intl_globals)
+ PHP_INI_ENTRY_EX("intl.explicit_cleanup", "0", 0, OnExplicitCleanupUpdate,
zend_ini_boolean_displayer_cb)
PHP_INI_END()
/* }}} */
-
static PHP_GINIT_FUNCTION(intl);
/* {{{ intl_module_entry */
@@ -1003,6 +1027,10 @@ PHP_MSHUTDOWN_FUNCTION( intl )
/* For the default locale php.ini setting */
UNREGISTER_INI_ENTRIES();
+ if (explicit_cleanup) {
+ u_cleanup();
+ }
+
return SUCCESS;
}
/* }}} */