diff options
-rw-r--r-- | main/main.c | 28 | ||||
-rw-r--r-- | main/php.h | 2 | ||||
-rw-r--r-- | main/php_globals.h | 3 |
3 files changed, 20 insertions, 13 deletions
diff --git a/main/main.c b/main/main.c index 1b81269a3e..405f95bfc2 100644 --- a/main/main.c +++ b/main/main.c @@ -131,23 +131,21 @@ static PHP_INI_MH(OnChangeMemoryLimit) */ static void php_disable_functions(TSRMLS_D) { - char *s = NULL; - char *e = INI_STR("disable_functions"); - char p; + char *s = NULL, *e; - if (!*e) { + if (!*(INI_STR("disable_functions"))) { return; } + e = PG(disable_functions) = strdup(INI_STR("disable_functions")); + while (*e) { switch (*e) { case ' ': case ',': if (s) { - p = *e; *e = '\0'; zend_disable_function(s, e-s TSRMLS_CC); - *e = p; s = NULL; } break; @@ -169,23 +167,21 @@ static void php_disable_functions(TSRMLS_D) */ static void php_disable_classes(TSRMLS_D) { - char *s = NULL; - char *e = INI_STR("disable_classes"); - char p; + char *s = NULL, *e; - if (!*e) { + if (!*(INI_STR("disable_classes"))) { return; } + e = PG(disable_classes) = strdup(INI_STR("disable_classes")); + while (*e) { switch (*e) { case ' ': case ',': if (s) { - p = *e; *e = '\0'; zend_disable_class(s, e-s TSRMLS_CC); - *e = p; s = NULL; } break; @@ -1384,6 +1380,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod PG(last_error_file) = NULL; PG(last_error_lineno) = 0; PG(error_handling) = EH_NORMAL; + PG(disable_functions) = NULL; + PG(disable_classes) = NULL; #if HAVE_SETLOCALE setlocale(LC_CTYPE, ""); @@ -1552,6 +1550,12 @@ void php_module_shutdown(TSRMLS_D) if (PG(last_error_file)) { free(PG(last_error_file)); } + if (PG(disable_functions)) { + free(PG(disable_functions)); + } + if (PG(disable_classes)) { + free(PG(disable_classes)); + } } /* }}} */ diff --git a/main/php.h b/main/php.h index 5b33180a1e..e153c90cdf 100644 --- a/main/php.h +++ b/main/php.h @@ -26,7 +26,7 @@ #include <dmalloc.h> #endif -#define PHP_API_VERSION 20031103 +#define PHP_API_VERSION 20031224 #define PHP_HAVE_STREAMS #define YYDEBUG 0 diff --git a/main/php_globals.h b/main/php_globals.h index c0b3f57722..637759ee48 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -147,6 +147,9 @@ struct _php_core_globals { int last_error_lineno; error_handling_t error_handling; zend_class_entry *exception_class; + + char *disable_functions; + char *disable_classes; }; |