]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #26707 (Incorrect error for disabled functions/classes).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 24 Dec 2003 16:43:23 +0000 (16:43 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 24 Dec 2003 16:43:23 +0000 (16:43 +0000)
# 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.

main/main.c

index 318842adba3309506a781f6e3402debbdcf81715..a8eb6e9fae533c2e345a3b43d62e17dc3b366ca1 100644 (file)
@@ -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;