mirror of
https://github.com/php/php-src.git
synced 2026-04-20 06:21:12 +02:00
fix for bug #2852 : argc inconsistency
This commit is contained in:
46
main/main.c
46
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user