diff options
-rw-r--r-- | ext/standard/string.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 0d1862710b..2c415cc8f4 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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); |