summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
authorHartmut Holzgraefe <hholzgra@php.net>2000-05-22 23:24:55 +0000
committerHartmut Holzgraefe <hholzgra@php.net>2000-05-22 23:24:55 +0000
commit1ec84f9c218d4f75040cce7c8c2cd57fc1df2c7e (patch)
tree3b531269c55b6beb65aea8e3809544fe50a20500 /main/main.c
parent22bfb799a70bf5c671a0b2b7bd96e1cece814602 (diff)
downloadphp-git-1ec84f9c218d4f75040cce7c8c2cd57fc1df2c7e.tar.gz
fix for bug #2852 : argc inconsistency
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/main/main.c b/main/main.c
index b85c2ef89f..52cd1dbd91 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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;
}
}