]> granicus.if.org Git - php/commitdiff
- Backported from 5.4 branch (Dropped restriction of not setting the same value multi...
authorJérôme Loyet <fat@php.net>
Sat, 8 Oct 2011 14:07:47 +0000 (14:07 +0000)
committerJérôme Loyet <fat@php.net>
Sat, 8 Oct 2011 14:07:47 +0000 (14:07 +0000)
NEWS
sapi/fpm/fpm/fpm_conf.c

diff --git a/NEWS b/NEWS
index 22006b6f3dcef733a0526e7504e880d1352b0928..9f0b8d5212f0e905e205b1e32e2548c3b3f32076 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -75,6 +75,9 @@ PHP                                                                        NEWS
   . Fixed bug #53872 (internal corruption of phar). (Hannes)
 
 - PHP-FPM SAPI:
+  . Backported from 5.4 branch (Dropped restriction of not setting the same
+    value multiple times, the last one holds).
+    (giovanni at giacobbi dot net, fat)
   . Backported FR #55166 from 5.4 branch (Added process.max to control
     the number of process FPM can fork). (fat)
   . Backported FR #55181 from 5.4 branch (Enhance security by limiting access
index bbb7207eb2019691e3489fd6ce22d88d9c4d7434..bcfe618b602d965f63cbe37ff674b2e8344e7d4a 100644 (file)
@@ -195,21 +195,25 @@ static char *fpm_conf_set_boolean(zval *value, void **config, intptr_t offset) /
 
 static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset) /* {{{ */
 {
-       char *new;
-       char **old = (char **) ((char *) *config + offset);
-       if (*old) {
-               return "it's already been defined. Can't do that twice.";
+       char **config_val = (char **) ((char *) *config + offset);
+
+       if (!config_val) {
+               return "internal error: NULL value";
+       }
+
+       /* Check if there is a previous value to deallocate */
+       if (*config_val) {
+               free(*config_val);
        }
 
-       new = strdup(Z_STRVAL_P(value));
-       if (!new) {
+       *config_val = strdup(Z_STRVAL_P(value));
+       if (!*config_val) {
                return "fpm_conf_set_string(): strdup() failed";
        }
-       if (fpm_conf_expand_pool_name(&new) == -1) {
+       if (fpm_conf_expand_pool_name(config_val) == -1) {
                return "Can't use '$pool' when the pool is not defined";
        }
 
-       *old = new;
        return NULL;
 }
 /* }}} */
@@ -219,8 +223,9 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) /
        char *val = Z_STRVAL_P(value);
        char *p;
 
+       /* we don't use strtol because we don't want to allow negative values */
        for (p = val; *p; p++) {
-               if ( p == val && *p == '-' ) continue;
+               if (p == val && *p == '-') continue;
                if (*p < '0' || *p > '9') {
                        return "is not a valid number (greater or equal than zero)";
                }