jani Tue Dec 11 08:30:46 2007 UTC
Added files:
/php-src/ext/standard/tests/array bug43541.phpt
Modified files:
/php-src/ext/standard array.c
/php-src/ext/standard/tests/array array_slice.phpt
Log:
- Fixed bug #43541 (array_slice() length parameter messed up)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.432&r2=1.433&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.432 php-src/ext/standard/array.c:1.433
--- php-src/ext/standard/array.c:1.432 Wed Dec 5 19:57:09 2007
+++ php-src/ext/standard/array.c Tue Dec 11 08:30:46 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.432 2007/12/05 19:57:09 iliaa Exp $ */
+/* $Id: array.c,v 1.433 2007/12/11 08:30:46 jani Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -2292,13 +2292,12 @@
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;
zstr 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;
}
@@ -2306,9 +2305,7 @@
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 0 */
- 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;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_slice.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/array/array_slice.phpt
diff -u php-src/ext/standard/tests/array/array_slice.phpt:1.2
php-src/ext/standard/tests/array/array_slice.phpt:1.3
--- php-src/ext/standard/tests/array/array_slice.phpt:1.2 Fri Apr 20
21:13:45 2007
+++ php-src/ext/standard/tests/array/array_slice.phpt Tue Dec 11 08:30:46 2007
@@ -1,7 +1,6 @@
--TEST--
Testing array_slice() function
--FILE--
-
<?php
$var_array = array(
@@ -89,27 +88,26 @@
var_dump (array_slice($var_array[2], -3, -2, false) );
?>
-
--EXPECTF--
*** Output for Zero Argument ***
-Warning: array_slice() expects at least %d parameters, %d given in %s on line
%d
+Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d
*** Output for Single array Argument ***
-Warning: array_slice() expects at least %d parameters, %d given in %s on line
%d
+Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d
*** Output for invalid number of Arguments ***
-Warning: array_slice() expects at most %d parameters, %d given in %s on line %d
+Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d
*** Output for scalar Argument ***
-Warning: array_slice() expects parameter %d to be array, integer given in %s
on line %d
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on
line %d
*** Output for string Argument ***
-Warning: array_slice() expects parameter %d to be array, string given in %s on
line %d%d
+Warning: array_slice() expects parameter 1 to be array, string given in %s on
line %d
*** Iteration 1 ***
@@ -218,7 +216,23 @@
[2]=>
int(4)
}
-array(0) {
+array(8) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+ [4]=>
+ int(6)
+ [5]=>
+ int(7)
+ [6]=>
+ int(8)
+ [7]=>
+ int(9)
}
array(5) {
[0]=>
@@ -240,7 +254,25 @@
[2]=>
int(3)
}
-array(0) {
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(6) {
[0]=>
@@ -262,7 +294,11 @@
[1]=>
int(9)
}
-array(0) {
+array(2) {
+ [0]=>
+ int(8)
+ [1]=>
+ int(9)
}
array(0) {
}
@@ -276,7 +312,23 @@
[3]=>
int(4)
}
-array(0) {
+array(8) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(5) {
[1]=>
@@ -298,7 +350,25 @@
[2]=>
int(3)
}
-array(0) {
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(6) {
[0]=>
@@ -320,7 +390,11 @@
[8]=>
int(9)
}
-array(0) {
+array(2) {
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(0) {
}
@@ -366,7 +440,15 @@
[2]=>
string(4) "Four"
}
-array(0) {
+array(4) {
+ [0]=>
+ string(3) "Two"
+ [1]=>
+ string(5) "Three"
+ [2]=>
+ string(4) "Four"
+ [3]=>
+ string(4) "Five"
}
array(1) {
[0]=>
@@ -380,7 +462,17 @@
[2]=>
string(5) "Three"
}
-array(0) {
+array(5) {
+ [0]=>
+ string(3) "One"
+ [1]=>
+ string(3) "Two"
+ [2]=>
+ string(5) "Three"
+ [3]=>
+ string(4) "Four"
+ [4]=>
+ string(4) "Five"
}
array(2) {
[0]=>
@@ -394,7 +486,11 @@
[1]=>
string(4) "Five"
}
-array(0) {
+array(2) {
+ [0]=>
+ string(4) "Four"
+ [1]=>
+ string(4) "Five"
}
array(0) {
}
@@ -408,7 +504,15 @@
[3]=>
string(4) "Four"
}
-array(0) {
+array(4) {
+ [1]=>
+ string(3) "Two"
+ [2]=>
+ string(5) "Three"
+ [3]=>
+ string(4) "Four"
+ [4]=>
+ string(4) "Five"
}
array(1) {
[1]=>
@@ -422,7 +526,17 @@
[2]=>
string(5) "Three"
}
-array(0) {
+array(5) {
+ [0]=>
+ string(3) "One"
+ [1]=>
+ string(3) "Two"
+ [2]=>
+ string(5) "Three"
+ [3]=>
+ string(4) "Four"
+ [4]=>
+ string(4) "Five"
}
array(2) {
[0]=>
@@ -436,7 +550,11 @@
[4]=>
string(4) "Five"
}
-array(0) {
+array(2) {
+ [3]=>
+ string(4) "Four"
+ [4]=>
+ string(4) "Five"
}
array(0) {
}
@@ -494,7 +612,21 @@
[2]=>
string(5) "seven"
}
-array(0) {
+array(7) {
+ [0]=>
+ string(3) "six"
+ [1]=>
+ int(7)
+ [2]=>
+ string(5) "seven"
+ [3]=>
+ int(8)
+ [4]=>
+ string(5) "eight"
+ [5]=>
+ int(9)
+ [6]=>
+ string(4) "nine"
}
array(4) {
[0]=>
@@ -514,7 +646,23 @@
[2]=>
int(7)
}
-array(0) {
+array(8) {
+ [0]=>
+ int(6)
+ [1]=>
+ string(3) "six"
+ [2]=>
+ int(7)
+ [3]=>
+ string(5) "seven"
+ [4]=>
+ int(8)
+ [5]=>
+ string(5) "eight"
+ [6]=>
+ int(9)
+ [7]=>
+ string(4) "nine"
}
array(5) {
[0]=>
@@ -534,7 +682,11 @@
[1]=>
string(4) "nine"
}
-array(0) {
+array(2) {
+ [0]=>
+ int(9)
+ [1]=>
+ string(4) "nine"
}
array(0) {
}
@@ -548,7 +700,21 @@
[3]=>
string(5) "seven"
}
-array(0) {
+array(7) {
+ [1]=>
+ string(3) "six"
+ [2]=>
+ int(7)
+ [3]=>
+ string(5) "seven"
+ [4]=>
+ int(8)
+ [5]=>
+ string(5) "eight"
+ [6]=>
+ int(9)
+ [7]=>
+ string(4) "nine"
}
array(4) {
[1]=>
@@ -568,7 +734,23 @@
[2]=>
int(7)
}
-array(0) {
+array(8) {
+ [0]=>
+ int(6)
+ [1]=>
+ string(3) "six"
+ [2]=>
+ int(7)
+ [3]=>
+ string(5) "seven"
+ [4]=>
+ int(8)
+ [5]=>
+ string(5) "eight"
+ [6]=>
+ int(9)
+ [7]=>
+ string(4) "nine"
}
array(5) {
[0]=>
@@ -588,7 +770,11 @@
[7]=>
string(4) "nine"
}
-array(0) {
+array(2) {
+ [6]=>
+ int(9)
+ [7]=>
+ string(4) "nine"
}
array(0) {
}
@@ -634,7 +820,15 @@
["d"]=>
string(3) "ddd"
}
-array(0) {
+array(4) {
+ ["A"]=>
+ string(3) "AAA"
+ ["c"]=>
+ string(3) "ccc"
+ ["d"]=>
+ string(3) "ddd"
+ ["e"]=>
+ string(3) "eee"
}
array(1) {
["A"]=>
@@ -648,7 +842,17 @@
["c"]=>
string(3) "ccc"
}
-array(0) {
+array(5) {
+ ["a"]=>
+ string(3) "aaa"
+ ["A"]=>
+ string(3) "AAA"
+ ["c"]=>
+ string(3) "ccc"
+ ["d"]=>
+ string(3) "ddd"
+ ["e"]=>
+ string(3) "eee"
}
array(2) {
["a"]=>
@@ -662,10 +866,14 @@
["e"]=>
string(3) "eee"
}
-array(0) {
-}
-array(0) {
-}
+array(2) {
+ ["d"]=>
+ string(3) "ddd"
+ ["e"]=>
+ string(3) "eee"
+}
+array(0) {
+}
*** Variation with first two arguments with preserve_key value TRUE ***
array(3) {
@@ -676,7 +884,15 @@
["d"]=>
string(3) "ddd"
}
-array(0) {
+array(4) {
+ ["A"]=>
+ string(3) "AAA"
+ ["c"]=>
+ string(3) "ccc"
+ ["d"]=>
+ string(3) "ddd"
+ ["e"]=>
+ string(3) "eee"
}
array(1) {
["A"]=>
@@ -690,7 +906,17 @@
["c"]=>
string(3) "ccc"
}
-array(0) {
+array(5) {
+ ["a"]=>
+ string(3) "aaa"
+ ["A"]=>
+ string(3) "AAA"
+ ["c"]=>
+ string(3) "ccc"
+ ["d"]=>
+ string(3) "ddd"
+ ["e"]=>
+ string(3) "eee"
}
array(2) {
["a"]=>
@@ -704,7 +930,11 @@
["e"]=>
string(3) "eee"
}
-array(0) {
+array(2) {
+ ["d"]=>
+ string(3) "ddd"
+ ["e"]=>
+ string(3) "eee"
}
array(0) {
}
@@ -750,7 +980,15 @@
[2]=>
string(4) "four"
}
-array(0) {
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "four"
+ [3]=>
+ string(4) "five"
}
array(1) {
[0]=>
@@ -764,7 +1002,17 @@
[2]=>
string(5) "three"
}
-array(0) {
+array(5) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(5) "three"
+ [3]=>
+ string(4) "four"
+ [4]=>
+ string(4) "five"
}
array(2) {
[0]=>
@@ -778,7 +1026,11 @@
[1]=>
string(4) "five"
}
-array(0) {
+array(2) {
+ [0]=>
+ string(4) "four"
+ [1]=>
+ string(4) "five"
}
array(0) {
}
@@ -792,7 +1044,15 @@
[4]=>
string(4) "four"
}
-array(0) {
+array(4) {
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
}
array(1) {
[2]=>
@@ -806,7 +1066,17 @@
[3]=>
string(5) "three"
}
-array(0) {
+array(5) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
}
array(2) {
[1]=>
@@ -820,7 +1090,11 @@
[5]=>
string(4) "five"
}
-array(0) {
+array(2) {
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
}
array(0) {
}
@@ -866,7 +1140,15 @@
[2]=>
string(4) "four"
}
-array(0) {
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ int(7)
+ [2]=>
+ string(4) "four"
+ [3]=>
+ string(4) "five"
}
array(1) {
[0]=>
@@ -880,7 +1162,17 @@
[2]=>
int(7)
}
-array(0) {
+array(5) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ int(7)
+ [3]=>
+ string(4) "four"
+ [4]=>
+ string(4) "five"
}
array(2) {
[0]=>
@@ -894,7 +1186,11 @@
[1]=>
string(4) "five"
}
-array(0) {
+array(2) {
+ [0]=>
+ string(4) "four"
+ [1]=>
+ string(4) "five"
}
array(0) {
}
@@ -908,7 +1204,15 @@
[4]=>
string(4) "four"
}
-array(0) {
+array(4) {
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(7)
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
}
array(1) {
[2]=>
@@ -922,7 +1226,17 @@
[3]=>
int(7)
}
-array(0) {
+array(5) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(7)
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
}
array(2) {
[1]=>
@@ -936,7 +1250,11 @@
[5]=>
string(4) "five"
}
-array(0) {
+array(2) {
+ [4]=>
+ string(4) "four"
+ [5]=>
+ string(4) "five"
}
array(0) {
}
@@ -1002,7 +1320,25 @@
[""]=>
string(5) "blank"
}
-array(0) {
+array(9) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(6)
+ [""]=>
+ string(5) "blank"
+ [2]=>
+ string(5) "float"
+ ["F"]=>
+ string(3) "FFF"
+ ["blank"]=>
+ string(0) ""
+ [3]=>
+ float(3.7)
+ [4]=>
+ string(4) "Five"
+ [5]=>
+ float(8.6)
}
array(6) {
[0]=>
@@ -1026,7 +1362,27 @@
[1]=>
int(6)
}
-array(0) {
+array(10) {
+ ["f"]=>
+ string(3) "fff"
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(6)
+ [""]=>
+ string(5) "blank"
+ [2]=>
+ string(5) "float"
+ ["F"]=>
+ string(3) "FFF"
+ ["blank"]=>
+ string(0) ""
+ [3]=>
+ float(3.7)
+ [4]=>
+ string(4) "Five"
+ [5]=>
+ float(8.6)
}
array(7) {
["f"]=>
@@ -1050,7 +1406,11 @@
[1]=>
float(8.6)
}
-array(0) {
+array(2) {
+ [0]=>
+ string(4) "Five"
+ [1]=>
+ float(8.6)
}
array(0) {
}
@@ -1064,7 +1424,25 @@
[""]=>
string(5) "blank"
}
-array(0) {
+array(9) {
+ [1]=>
+ string(3) "one"
+ [4]=>
+ int(6)
+ [""]=>
+ string(5) "blank"
+ [2]=>
+ string(5) "float"
+ ["F"]=>
+ string(3) "FFF"
+ ["blank"]=>
+ string(0) ""
+ [3]=>
+ float(3.7)
+ [5]=>
+ string(4) "Five"
+ [6]=>
+ float(8.6)
}
array(6) {
[1]=>
@@ -1088,7 +1466,27 @@
[4]=>
int(6)
}
-array(0) {
+array(10) {
+ ["f"]=>
+ string(3) "fff"
+ [1]=>
+ string(3) "one"
+ [4]=>
+ int(6)
+ [""]=>
+ string(5) "blank"
+ [2]=>
+ string(5) "float"
+ ["F"]=>
+ string(3) "FFF"
+ ["blank"]=>
+ string(0) ""
+ [3]=>
+ float(3.7)
+ [5]=>
+ string(4) "Five"
+ [6]=>
+ float(8.6)
}
array(7) {
["f"]=>
@@ -1112,7 +1510,11 @@
[6]=>
float(8.6)
}
-array(0) {
+array(2) {
+ [5]=>
+ string(4) "Five"
+ [6]=>
+ float(8.6)
}
array(0) {
}
@@ -1154,7 +1556,13 @@
[2]=>
string(2) "45"
}
-array(0) {
+array(3) {
+ [0]=>
+ string(4) "name"
+ [1]=>
+ string(3) "age"
+ [2]=>
+ string(2) "45"
}
array(0) {
}
@@ -1166,9 +1574,17 @@
[2]=>
string(3) "age"
}
-array(0) {
-}
-array(1) {
+array(4) {
+ [0]=>
+ int(12)
+ [1]=>
+ string(4) "name"
+ [2]=>
+ string(3) "age"
+ [3]=>
+ string(2) "45"
+}
+array(1) {
[0]=>
int(12)
}
@@ -1178,7 +1594,11 @@
[1]=>
string(2) "45"
}
-array(0) {
+array(2) {
+ [0]=>
+ string(3) "age"
+ [1]=>
+ string(2) "45"
}
array(0) {
}
@@ -1192,7 +1612,13 @@
[3]=>
string(2) "45"
}
-array(0) {
+array(3) {
+ [1]=>
+ string(4) "name"
+ [2]=>
+ string(3) "age"
+ [3]=>
+ string(2) "45"
}
array(0) {
}
@@ -1204,7 +1630,15 @@
[2]=>
string(3) "age"
}
-array(0) {
+array(4) {
+ [0]=>
+ int(12)
+ [1]=>
+ string(4) "name"
+ [2]=>
+ string(3) "age"
+ [3]=>
+ string(2) "45"
}
array(1) {
[0]=>
@@ -1216,7 +1650,11 @@
[3]=>
string(2) "45"
}
-array(0) {
+array(2) {
+ [2]=>
+ string(3) "age"
+ [3]=>
+ string(2) "45"
}
array(0) {
}
@@ -1307,7 +1745,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [0]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [1]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -1338,7 +1792,32 @@
array(0) {
}
}
-array(0) {
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(3) "oNe"
+ [1]=>
+ string(3) "tWo"
+ [2]=>
+ int(4)
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -1360,7 +1839,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [0]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [1]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -1384,7 +1879,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -1415,7 +1926,32 @@
array(0) {
}
}
-array(0) {
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(3) "oNe"
+ [1]=>
+ string(3) "tWo"
+ [2]=>
+ int(4)
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -1437,7 +1973,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -1587,7 +2139,23 @@
[2]=>
int(4)
}
-array(0) {
+array(8) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+ [4]=>
+ int(6)
+ [5]=>
+ int(7)
+ [6]=>
+ int(8)
+ [7]=>
+ int(9)
}
array(5) {
[0]=>
@@ -1609,7 +2177,25 @@
[2]=>
int(3)
}
-array(0) {
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(6) {
[0]=>
@@ -1631,7 +2217,11 @@
[1]=>
int(9)
}
-array(0) {
+array(2) {
+ [0]=>
+ int(8)
+ [1]=>
+ int(9)
}
array(0) {
}
@@ -1645,7 +2235,23 @@
[3]=>
int(4)
}
-array(0) {
+array(8) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(5) {
[1]=>
@@ -1667,7 +2273,25 @@
[2]=>
int(3)
}
-array(0) {
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(6) {
[0]=>
@@ -1689,7 +2313,11 @@
[8]=>
int(9)
}
-array(0) {
+array(2) {
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
}
array(0) {
}
@@ -1735,8 +2363,16 @@
[2]=>
unicode(4) "Four"
}
-array(0) {
-}
+array(4) {
+ [0]=>
+ unicode(3) "Two"
+ [1]=>
+ unicode(5) "Three"
+ [2]=>
+ unicode(4) "Four"
+ [3]=>
+ unicode(4) "Five"
+}
array(1) {
[0]=>
unicode(3) "Two"
@@ -1749,7 +2385,17 @@
[2]=>
unicode(5) "Three"
}
-array(0) {
+array(5) {
+ [0]=>
+ unicode(3) "One"
+ [1]=>
+ unicode(3) "Two"
+ [2]=>
+ unicode(5) "Three"
+ [3]=>
+ unicode(4) "Four"
+ [4]=>
+ unicode(4) "Five"
}
array(2) {
[0]=>
@@ -1763,7 +2409,11 @@
[1]=>
unicode(4) "Five"
}
-array(0) {
+array(2) {
+ [0]=>
+ unicode(4) "Four"
+ [1]=>
+ unicode(4) "Five"
}
array(0) {
}
@@ -1777,7 +2427,15 @@
[3]=>
unicode(4) "Four"
}
-array(0) {
+array(4) {
+ [1]=>
+ unicode(3) "Two"
+ [2]=>
+ unicode(5) "Three"
+ [3]=>
+ unicode(4) "Four"
+ [4]=>
+ unicode(4) "Five"
}
array(1) {
[1]=>
@@ -1791,7 +2449,17 @@
[2]=>
unicode(5) "Three"
}
-array(0) {
+array(5) {
+ [0]=>
+ unicode(3) "One"
+ [1]=>
+ unicode(3) "Two"
+ [2]=>
+ unicode(5) "Three"
+ [3]=>
+ unicode(4) "Four"
+ [4]=>
+ unicode(4) "Five"
}
array(2) {
[0]=>
@@ -1805,7 +2473,11 @@
[4]=>
unicode(4) "Five"
}
-array(0) {
+array(2) {
+ [3]=>
+ unicode(4) "Four"
+ [4]=>
+ unicode(4) "Five"
}
array(0) {
}
@@ -1863,7 +2535,21 @@
[2]=>
unicode(5) "seven"
}
-array(0) {
+array(7) {
+ [0]=>
+ unicode(3) "six"
+ [1]=>
+ int(7)
+ [2]=>
+ unicode(5) "seven"
+ [3]=>
+ int(8)
+ [4]=>
+ unicode(5) "eight"
+ [5]=>
+ int(9)
+ [6]=>
+ unicode(4) "nine"
}
array(4) {
[0]=>
@@ -1883,7 +2569,23 @@
[2]=>
int(7)
}
-array(0) {
+array(8) {
+ [0]=>
+ int(6)
+ [1]=>
+ unicode(3) "six"
+ [2]=>
+ int(7)
+ [3]=>
+ unicode(5) "seven"
+ [4]=>
+ int(8)
+ [5]=>
+ unicode(5) "eight"
+ [6]=>
+ int(9)
+ [7]=>
+ unicode(4) "nine"
}
array(5) {
[0]=>
@@ -1903,7 +2605,11 @@
[1]=>
unicode(4) "nine"
}
-array(0) {
+array(2) {
+ [0]=>
+ int(9)
+ [1]=>
+ unicode(4) "nine"
}
array(0) {
}
@@ -1917,7 +2623,21 @@
[3]=>
unicode(5) "seven"
}
-array(0) {
+array(7) {
+ [1]=>
+ unicode(3) "six"
+ [2]=>
+ int(7)
+ [3]=>
+ unicode(5) "seven"
+ [4]=>
+ int(8)
+ [5]=>
+ unicode(5) "eight"
+ [6]=>
+ int(9)
+ [7]=>
+ unicode(4) "nine"
}
array(4) {
[1]=>
@@ -1937,7 +2657,23 @@
[2]=>
int(7)
}
-array(0) {
+array(8) {
+ [0]=>
+ int(6)
+ [1]=>
+ unicode(3) "six"
+ [2]=>
+ int(7)
+ [3]=>
+ unicode(5) "seven"
+ [4]=>
+ int(8)
+ [5]=>
+ unicode(5) "eight"
+ [6]=>
+ int(9)
+ [7]=>
+ unicode(4) "nine"
}
array(5) {
[0]=>
@@ -1957,7 +2693,11 @@
[7]=>
unicode(4) "nine"
}
-array(0) {
+array(2) {
+ [6]=>
+ int(9)
+ [7]=>
+ unicode(4) "nine"
}
array(0) {
}
@@ -2003,7 +2743,15 @@
[u"d"]=>
unicode(3) "ddd"
}
-array(0) {
+array(4) {
+ [u"A"]=>
+ unicode(3) "AAA"
+ [u"c"]=>
+ unicode(3) "ccc"
+ [u"d"]=>
+ unicode(3) "ddd"
+ [u"e"]=>
+ unicode(3) "eee"
}
array(1) {
[u"A"]=>
@@ -2017,7 +2765,17 @@
[u"c"]=>
unicode(3) "ccc"
}
-array(0) {
+array(5) {
+ [u"a"]=>
+ unicode(3) "aaa"
+ [u"A"]=>
+ unicode(3) "AAA"
+ [u"c"]=>
+ unicode(3) "ccc"
+ [u"d"]=>
+ unicode(3) "ddd"
+ [u"e"]=>
+ unicode(3) "eee"
}
array(2) {
[u"a"]=>
@@ -2031,7 +2789,11 @@
[u"e"]=>
unicode(3) "eee"
}
-array(0) {
+array(2) {
+ [u"d"]=>
+ unicode(3) "ddd"
+ [u"e"]=>
+ unicode(3) "eee"
}
array(0) {
}
@@ -2045,7 +2807,15 @@
[u"d"]=>
unicode(3) "ddd"
}
-array(0) {
+array(4) {
+ [u"A"]=>
+ unicode(3) "AAA"
+ [u"c"]=>
+ unicode(3) "ccc"
+ [u"d"]=>
+ unicode(3) "ddd"
+ [u"e"]=>
+ unicode(3) "eee"
}
array(1) {
[u"A"]=>
@@ -2059,7 +2829,17 @@
[u"c"]=>
unicode(3) "ccc"
}
-array(0) {
+array(5) {
+ [u"a"]=>
+ unicode(3) "aaa"
+ [u"A"]=>
+ unicode(3) "AAA"
+ [u"c"]=>
+ unicode(3) "ccc"
+ [u"d"]=>
+ unicode(3) "ddd"
+ [u"e"]=>
+ unicode(3) "eee"
}
array(2) {
[u"a"]=>
@@ -2073,7 +2853,11 @@
[u"e"]=>
unicode(3) "eee"
}
-array(0) {
+array(2) {
+ [u"d"]=>
+ unicode(3) "ddd"
+ [u"e"]=>
+ unicode(3) "eee"
}
array(0) {
}
@@ -2119,7 +2903,15 @@
[2]=>
unicode(4) "four"
}
-array(0) {
+array(4) {
+ [0]=>
+ unicode(3) "two"
+ [1]=>
+ unicode(5) "three"
+ [2]=>
+ unicode(4) "four"
+ [3]=>
+ unicode(4) "five"
}
array(1) {
[0]=>
@@ -2133,7 +2925,17 @@
[2]=>
unicode(5) "three"
}
-array(0) {
+array(5) {
+ [0]=>
+ unicode(3) "one"
+ [1]=>
+ unicode(3) "two"
+ [2]=>
+ unicode(5) "three"
+ [3]=>
+ unicode(4) "four"
+ [4]=>
+ unicode(4) "five"
}
array(2) {
[0]=>
@@ -2147,7 +2949,11 @@
[1]=>
unicode(4) "five"
}
-array(0) {
+array(2) {
+ [0]=>
+ unicode(4) "four"
+ [1]=>
+ unicode(4) "five"
}
array(0) {
}
@@ -2161,7 +2967,15 @@
[4]=>
unicode(4) "four"
}
-array(0) {
+array(4) {
+ [2]=>
+ unicode(3) "two"
+ [3]=>
+ unicode(5) "three"
+ [4]=>
+ unicode(4) "four"
+ [5]=>
+ unicode(4) "five"
}
array(1) {
[2]=>
@@ -2175,7 +2989,17 @@
[3]=>
unicode(5) "three"
}
-array(0) {
+array(5) {
+ [1]=>
+ unicode(3) "one"
+ [2]=>
+ unicode(3) "two"
+ [3]=>
+ unicode(5) "three"
+ [4]=>
+ unicode(4) "four"
+ [5]=>
+ unicode(4) "five"
}
array(2) {
[1]=>
@@ -2189,7 +3013,11 @@
[5]=>
unicode(4) "five"
}
-array(0) {
+array(2) {
+ [4]=>
+ unicode(4) "four"
+ [5]=>
+ unicode(4) "five"
}
array(0) {
}
@@ -2235,21 +3063,39 @@
[2]=>
unicode(4) "four"
}
-array(0) {
-}
-array(1) {
+array(4) {
[0]=>
unicode(3) "two"
-}
-array(3) {
- [0]=>
- unicode(3) "one"
+ [1]=>
+ int(7)
+ [2]=>
+ unicode(4) "four"
+ [3]=>
+ unicode(4) "five"
+}
+array(1) {
+ [0]=>
+ unicode(3) "two"
+}
+array(3) {
+ [0]=>
+ unicode(3) "one"
[1]=>
unicode(3) "two"
[2]=>
int(7)
}
-array(0) {
+array(5) {
+ [0]=>
+ unicode(3) "one"
+ [1]=>
+ unicode(3) "two"
+ [2]=>
+ int(7)
+ [3]=>
+ unicode(4) "four"
+ [4]=>
+ unicode(4) "five"
}
array(2) {
[0]=>
@@ -2263,7 +3109,11 @@
[1]=>
unicode(4) "five"
}
-array(0) {
+array(2) {
+ [0]=>
+ unicode(4) "four"
+ [1]=>
+ unicode(4) "five"
}
array(0) {
}
@@ -2277,7 +3127,15 @@
[4]=>
unicode(4) "four"
}
-array(0) {
+array(4) {
+ [2]=>
+ unicode(3) "two"
+ [3]=>
+ int(7)
+ [4]=>
+ unicode(4) "four"
+ [5]=>
+ unicode(4) "five"
}
array(1) {
[2]=>
@@ -2291,7 +3149,17 @@
[3]=>
int(7)
}
-array(0) {
+array(5) {
+ [1]=>
+ unicode(3) "one"
+ [2]=>
+ unicode(3) "two"
+ [3]=>
+ int(7)
+ [4]=>
+ unicode(4) "four"
+ [5]=>
+ unicode(4) "five"
}
array(2) {
[1]=>
@@ -2305,7 +3173,11 @@
[5]=>
unicode(4) "five"
}
-array(0) {
+array(2) {
+ [4]=>
+ unicode(4) "four"
+ [5]=>
+ unicode(4) "five"
}
array(0) {
}
@@ -2371,7 +3243,25 @@
[u""]=>
unicode(5) "blank"
}
-array(0) {
+array(9) {
+ [0]=>
+ unicode(3) "one"
+ [1]=>
+ int(6)
+ [u""]=>
+ unicode(5) "blank"
+ [2]=>
+ unicode(5) "float"
+ [u"F"]=>
+ unicode(3) "FFF"
+ [u"blank"]=>
+ unicode(0) ""
+ [3]=>
+ float(3.7)
+ [4]=>
+ unicode(4) "Five"
+ [5]=>
+ float(8.6)
}
array(6) {
[0]=>
@@ -2395,7 +3285,27 @@
[1]=>
int(6)
}
-array(0) {
+array(10) {
+ [u"f"]=>
+ unicode(3) "fff"
+ [0]=>
+ unicode(3) "one"
+ [1]=>
+ int(6)
+ [u""]=>
+ unicode(5) "blank"
+ [2]=>
+ unicode(5) "float"
+ [u"F"]=>
+ unicode(3) "FFF"
+ [u"blank"]=>
+ unicode(0) ""
+ [3]=>
+ float(3.7)
+ [4]=>
+ unicode(4) "Five"
+ [5]=>
+ float(8.6)
}
array(7) {
[u"f"]=>
@@ -2419,7 +3329,11 @@
[1]=>
float(8.6)
}
-array(0) {
+array(2) {
+ [0]=>
+ unicode(4) "Five"
+ [1]=>
+ float(8.6)
}
array(0) {
}
@@ -2433,7 +3347,25 @@
[u""]=>
unicode(5) "blank"
}
-array(0) {
+array(9) {
+ [1]=>
+ unicode(3) "one"
+ [4]=>
+ int(6)
+ [u""]=>
+ unicode(5) "blank"
+ [2]=>
+ unicode(5) "float"
+ [u"F"]=>
+ unicode(3) "FFF"
+ [u"blank"]=>
+ unicode(0) ""
+ [3]=>
+ float(3.7)
+ [5]=>
+ unicode(4) "Five"
+ [6]=>
+ float(8.6)
}
array(6) {
[1]=>
@@ -2457,7 +3389,27 @@
[4]=>
int(6)
}
-array(0) {
+array(10) {
+ [u"f"]=>
+ unicode(3) "fff"
+ [1]=>
+ unicode(3) "one"
+ [4]=>
+ int(6)
+ [u""]=>
+ unicode(5) "blank"
+ [2]=>
+ unicode(5) "float"
+ [u"F"]=>
+ unicode(3) "FFF"
+ [u"blank"]=>
+ unicode(0) ""
+ [3]=>
+ float(3.7)
+ [5]=>
+ unicode(4) "Five"
+ [6]=>
+ float(8.6)
}
array(7) {
[u"f"]=>
@@ -2481,7 +3433,11 @@
[6]=>
float(8.6)
}
-array(0) {
+array(2) {
+ [5]=>
+ unicode(4) "Five"
+ [6]=>
+ float(8.6)
}
array(0) {
}
@@ -2523,7 +3479,13 @@
[2]=>
unicode(2) "45"
}
-array(0) {
+array(3) {
+ [0]=>
+ unicode(4) "name"
+ [1]=>
+ unicode(3) "age"
+ [2]=>
+ unicode(2) "45"
}
array(0) {
}
@@ -2535,7 +3497,15 @@
[2]=>
unicode(3) "age"
}
-array(0) {
+array(4) {
+ [0]=>
+ int(12)
+ [1]=>
+ unicode(4) "name"
+ [2]=>
+ unicode(3) "age"
+ [3]=>
+ unicode(2) "45"
}
array(1) {
[0]=>
@@ -2547,7 +3517,11 @@
[1]=>
unicode(2) "45"
}
-array(0) {
+array(2) {
+ [0]=>
+ unicode(3) "age"
+ [1]=>
+ unicode(2) "45"
}
array(0) {
}
@@ -2561,7 +3535,13 @@
[3]=>
unicode(2) "45"
}
-array(0) {
+array(3) {
+ [1]=>
+ unicode(4) "name"
+ [2]=>
+ unicode(3) "age"
+ [3]=>
+ unicode(2) "45"
}
array(0) {
}
@@ -2573,7 +3553,15 @@
[2]=>
unicode(3) "age"
}
-array(0) {
+array(4) {
+ [0]=>
+ int(12)
+ [1]=>
+ unicode(4) "name"
+ [2]=>
+ unicode(3) "age"
+ [3]=>
+ unicode(2) "45"
}
array(1) {
[0]=>
@@ -2585,7 +3573,11 @@
[3]=>
unicode(2) "45"
}
-array(0) {
+array(2) {
+ [2]=>
+ unicode(3) "age"
+ [3]=>
+ unicode(2) "45"
}
array(0) {
}
@@ -2676,7 +3668,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [0]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [1]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -2707,7 +3715,32 @@
array(0) {
}
}
-array(0) {
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ unicode(3) "oNe"
+ [1]=>
+ unicode(3) "tWo"
+ [2]=>
+ int(4)
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -2729,7 +3762,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [0]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [1]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -2753,7 +3802,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -2784,7 +3849,32 @@
array(0) {
}
}
-array(0) {
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ unicode(3) "oNe"
+ [1]=>
+ unicode(3) "tWo"
+ [2]=>
+ int(4)
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
@@ -2806,7 +3896,23 @@
array(0) {
}
}
-array(0) {
+array(2) {
+ [1]=>
+ array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(30)
+ [3]=>
+ int(40)
+ [4]=>
+ int(50)
+ }
+ [2]=>
+ array(0) {
+ }
}
array(0) {
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug43541.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/bug43541.phpt
+++ php-src/ext/standard/tests/array/bug43541.phpt
--TEST--
Bug #43541 (length parameter omitted or not does not work when casted to float)
--FILE--
<?php
$arr = array(1, 2, 3, 4, 5, 6);
var_dump(array_slice($arr, 0, (float)2));
var_dump(array_slice($arr, 0, (int)2));
?>
--EXPECT--
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
--UEXPECT--
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php