cvs: php-src /ext/standard array.c
| From: | Jani Taskinen | Date: | Fri, 02 Nov 2007 11:48:35 +0000 |
| Subject: | cvs: php-src /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-46913@lists.php.net to get a copy of this message | ||
jani Fri Nov 2 11:48:35 2007 UTC
Modified files:
/php-src/ext/standard array.c
Log:
- Fix the fix for bug #41686
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.424&r2=1.425&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.424 php-src/ext/standard/array.c:1.425
--- php-src/ext/standard/array.c:1.424 Fri Nov 2 10:50:33 2007
+++ php-src/ext/standard/array.c Fri Nov 2 11:48:35 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.424 2007/11/02 10:50:33 jani Exp $ */
+/* $Id: array.c,v 1.425 2007/11/02 11:48:35 jani Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -2304,13 +2304,13 @@
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 *lenght_param;
zstr string_key;
int string_key_len;
ulong num_key;
HashPosition hpos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|l!b", &input,
- &offset, &length, &preserve_keys) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset,
&length_param, &preserve_keys) == FAILURE) {
return;
}
@@ -2318,7 +2318,9 @@
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 length is null */
- if (ZEND_NUM_ARGS() < 3 || length == NULL) {
+ if (ZEND_NUM_ARGS() >= 3 && Z_TYPE_P(length_param) != IS_NULL) {
+ length = Z_LVAL_P(length_param);
+ } else {
length = num_in;
}