]> granicus.if.org Git - php/commitdiff
fix for bug #2852 : argc inconsistency
authorHartmut Holzgraefe <hholzgra@php.net>
Mon, 22 May 2000 23:24:55 +0000 (23:24 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Mon, 22 May 2000 23:24:55 +0000 (23:24 +0000)
main/main.c

index b85c2ef89fc3c43e986e45991bc466b1a5642cd5..52cd1dbd913a62a6ff903a51db1ce1ba39fc787e 100644 (file)
@@ -1089,29 +1089,31 @@ static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC)
        INIT_PZVAL(arr);
 
        /* Prepare argv */
-       ss = s;
-       while (ss) {
-               space = strchr(ss, '+');
-               if (space) {
-                       *space = '\0';
-               }
-               /* auto-type */
-               ALLOC_ZVAL(tmp);
-               tmp->type = IS_STRING;
-               tmp->value.str.len = strlen(ss);
-               tmp->value.str.val = estrndup(ss, tmp->value.str.len);
-               INIT_PZVAL(tmp);
-               count++;
-               if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) {
-                       if (tmp->type == IS_STRING) {
-                               efree(tmp->value.str.val);
+       if(*s) {
+               ss = s;
+               while (ss) {
+                       space = strchr(ss, '+');
+                       if (space) {
+                               *space = '\0';
+                       }
+                       /* auto-type */
+                       ALLOC_ZVAL(tmp);
+                       tmp->type = IS_STRING;
+                       tmp->value.str.len = strlen(ss);
+                       tmp->value.str.val = estrndup(ss, tmp->value.str.len);
+                       INIT_PZVAL(tmp);
+                       count++;
+                       if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) {
+                               if (tmp->type == IS_STRING) {
+                                       efree(tmp->value.str.val);
+                               }
+                       }
+                       if (space) {
+                               *space = '+';
+                               ss = space + 1;
+                       } else {
+                               ss = space;
                        }
-               }
-               if (space) {
-                       *space = '+';
-                       ss = space + 1;
-               } else {
-                       ss = space;
                }
        }