diff --git a/ext/standard/array.c b/ext/standard/array.c index 522e7f715ac..6de78c3900a 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -7046,9 +7046,10 @@ PHP_FUNCTION(array_chunk) /* If reached the chunk size, add it to the result array, and reset the * pointer. */ - if (!(++current % size)) { + if (++current == size) { add_next_index_zval(return_value, &chunk); ZVAL_UNDEF(&chunk); + current = 0; } } ZEND_HASH_FOREACH_END();