summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-12-11 09:47:21 +0000
committerJani Taskinen <jani@php.net>2007-12-11 09:47:21 +0000
commit9a4de086cbc6bd19bc9fb99810c232ac98d3e078 (patch)
tree9a354f30e0727f7ffa8e184526b09762771995d7 /ext/standard/array.c
parent5ce611677774aa07a4cba963d52c6c4aedb1bbc2 (diff)
downloadphp-git-9a4de086cbc6bd19bc9fb99810c232ac98d3e078.tar.gz
MFH: - Fixed bug #43541
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index e82dd6bbb0..6868c353e2 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2101,17 +2101,16 @@ PHP_FUNCTION(array_slice)
zval *input, /* Input array */
**entry; /* An array entry */
long offset, /* Offset to get elements from */
- length; /* How many elements to get */
+ length = 0; /* How many elements to get */
zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */
int num_in, /* Number of elements in the input array */
pos; /* Current position in the array */
- zval *length_param;
char *string_key;
uint string_key_len;
ulong num_key;
HashPosition hpos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset, &length_param, &preserve_keys) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|lb", &input, &offset, &length, &preserve_keys) == FAILURE) {
return;
}
@@ -2119,12 +2118,10 @@ PHP_FUNCTION(array_slice)
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
/* We want all entries from offset to the end if length is not passed or is null */
- if (ZEND_NUM_ARGS() >= 3 && Z_TYPE_P(length_param) != IS_NULL) {
- length = Z_LVAL_P(length_param);
- } else {
+ if (length == 0) {
length = num_in;
}
-
+
/* Initialize returned array */
array_init(return_value);