summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index f0423ccb9e..f72f8aed61 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2309,7 +2309,7 @@ PHP_FUNCTION(array_slice)
ulong num_key;
HashPosition hpos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|lb", &input,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|l!b", &input,
&offset, &length, &preserve_keys) == FAILURE) {
return;
}
@@ -2317,8 +2317,8 @@ PHP_FUNCTION(array_slice)
/* Get number of entries in the input hash */
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
- /* We want all entries from offset to the end if length is not passed */
- if (ZEND_NUM_ARGS() < 3) {
+ /* We want all entries from offset to the end if length is not passed or length is null */
+ if (ZEND_NUM_ARGS() < 3 || length == NULL) {
length = num_in;
}