iliaa           Wed Dec 24 11:43:25 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/main       main.c 
  Log:
  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.
  
  
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.50 php-src/main/main.c:1.512.2.51
--- php-src/main/main.c:1.512.2.50      Wed Oct  8 22:59:03 2003
+++ php-src/main/main.c Wed Dec 24 11:43:23 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.512.2.50 2003/10/09 02:59:03 iliaa Exp $ */
+/* $Id: main.c,v 1.512.2.51 2003/12/24 16:43:23 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -165,23 +165,22 @@
  */
 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_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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to