From: Ilia Alshanetsky Date: Wed, 24 Dec 2003 16:43:23 +0000 (+0000) Subject: MFH: Fixed bug #26707 (Incorrect error for disabled functions/classes). X-Git-Tag: php-4.3.5RC1~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9235a5d001c0ead5e395858fd7de52ef68cba770;p=php MFH: Fixed bug #26707 (Incorrect error for disabled functions/classes). # Direct MFH of the patch in PHP 5.0 cannot be used because that would # require the change of API. So we'll need to make do with a one time # (small) memory leak on startup when disable_functions and/or classes are # used. --- diff --git a/main/main.c b/main/main.c index 318842adba..a8eb6e9fae 100644 --- a/main/main.c +++ b/main/main.c @@ -165,23 +165,22 @@ 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; } + /* Intentional one time memory leak on startup */ + e = 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; @@ -203,23 +202,22 @@ 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; } + /* Intentional one time memory leak on startup */ + e = 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;