]> granicus.if.org Git - php/commitdiff
- Make increment of "" become "1"
authorAndi Gutmans <andi@php.net>
Fri, 13 Oct 2000 16:24:00 +0000 (16:24 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 13 Oct 2000 16:24:00 +0000 (16:24 +0000)
Zend/zend_operators.c

index b112a502570509a52bf09c4ad8e71db6aff372d0..6a4402a9359653861ff412322f9f16d9ed6234f3 100644 (file)
@@ -1339,6 +1339,13 @@ static void increment_string(zval *str)
     int last=0; /* Shut up the compiler warning */
     int ch;
     
+       if (str->value.str.len == 0) {
+               STR_FREE(str->value.str.val);
+               str->value.str.val = estrndup("1", sizeof("1")-1);
+               str->value.str.len = 1;
+               return;
+       }
+
        while(pos >= 0) {
         ch = s[pos];
         if (ch >= 'a' && ch <= 'z') {