]> granicus.if.org Git - php/commitdiff
Fix chunk_split (#6208)
authorStanislav Malyshev <stas@php.net>
Thu, 17 Aug 2000 08:47:42 +0000 (08:47 +0000)
committerStanislav Malyshev <stas@php.net>
Thu, 17 Aug 2000 08:47:42 +0000 (08:47 +0000)
ext/standard/string.c

index 0d1862710be27c123ab35d10c95f39db80f5cd41..2c415cc8f4c691072ad14da83d71c30da947025a 100644 (file)
@@ -1040,11 +1040,15 @@ PHP_FUNCTION(chunk_split)
                        convert_to_string_ex(p_str);
        }
                        
-       if(chunklen == 0) {
-               php_error(E_WARNING, "chunk length is 0");
+       if(chunklen <= 0) {
+               php_error(E_WARNING, "Chunk length should be greater than zero");
                RETURN_FALSE;
        }
-       
+
+       if((*p_str)->value.str.len == 0) {
+               RETURN_EMPTY_STRING();
+       }
+
        result = php_chunk_split((*p_str)->value.str.val, (*p_str)->value.str.len,
                                                     end, endlen, chunklen, &result_len);