cvs: php4 / main.c

[email protected] ("Hartmut Holzgraefe")
Newsgroups php.version4
Message-ID <cvshholzgra959037896@cvsserver>
hholzgra		Tue May 23 01:24:56 2000 EDT

  Modified files:
    /php4	main.c 
  Log:
  fix for bug #2852 : argc inconsistency
  
  
Index: php4/main.c
diff -u php4/main.c:1.250 php4/main.c:1.251
--- php4/main.c:1.250	Sun May 21 20:05:04 2000
+++ php4/main.c	Tue May 23 01:24:55 2000
@@ -19,7 +19,7 @@
 */
 
 
-/* $Id: main.c,v 1.250 2000/05/21 18:05:04 andi Exp $ */
+/* $Id: main.c,v 1.251 2000/05/22 23:24:55 hholzgra Exp $ */
 
 
 #include <stdio.h>
@@ -1089,29 +1089,31 @@
 	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';
 			}
-		}
-		if (space) {
-			*space = '+';
-			ss = space + 1;
-		} else {
-			ss = space;
+			/* 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;
+			}
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.