summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/array')
-rw-r--r--ext/standard/tests/array/array_change_key_case.phpt76
-rw-r--r--ext/standard/tests/array/array_change_key_case_errors.phpt28
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation.phpt60
-rw-r--r--ext/standard/tests/array/array_keys.phpt466
-rw-r--r--ext/standard/tests/array/array_keys_64bit.phpt472
-rw-r--r--ext/standard/tests/array/array_keys_error.phpt42
-rw-r--r--ext/standard/tests/array/array_keys_variation_001.phpt147
-rw-r--r--ext/standard/tests/array/array_keys_variation_002.phpt52
-rw-r--r--ext/standard/tests/array/array_keys_variation_002_64bit.phpt56
-rw-r--r--ext/standard/tests/array/array_keys_variation_003.phpt102
-rw-r--r--ext/standard/tests/array/array_keys_variation_004.phpt68
-rw-r--r--ext/standard/tests/array/array_keys_variation_005.phpt40
-rw-r--r--ext/standard/tests/array/array_pop.phpt66
-rw-r--r--ext/standard/tests/array/array_pop_errors.phpt64
-rw-r--r--ext/standard/tests/array/array_pop_variation.phpt55
-rw-r--r--ext/standard/tests/array/array_search.phptbin15762 -> 539 bytes
-rw-r--r--ext/standard/tests/array/array_search_errors.phpt39
-rw-r--r--ext/standard/tests/array/array_search_variation.phpt635
-rw-r--r--ext/standard/tests/array/array_search_variation1.phpt95
-rw-r--r--ext/standard/tests/array/array_search_variation2.phpt53
-rw-r--r--ext/standard/tests/array/array_search_variation3.phpt69
-rw-r--r--ext/standard/tests/array/array_values.phptbin5251 -> 3060 bytes
-rw-r--r--ext/standard/tests/array/array_values_64bit.phptbin5245 -> 0 bytes
-rw-r--r--ext/standard/tests/array/array_values_errors.phpt36
-rw-r--r--ext/standard/tests/array/array_values_variation.phpt76
-rw-r--r--ext/standard/tests/array/array_values_variation_64bit.phpt74
-rw-r--r--ext/standard/tests/array/bug35014_64bit.phpt4
-rw-r--r--ext/standard/tests/array/bug41686.phpt56
-rw-r--r--ext/standard/tests/array/bug42233.phpt33
-rw-r--r--ext/standard/tests/array/extract.phpt276
-rw-r--r--ext/standard/tests/array/extract_error.phpt57
-rw-r--r--ext/standard/tests/array/extract_variation1.phpt27
-rw-r--r--ext/standard/tests/array/extract_variation2.phpt69
-rw-r--r--ext/standard/tests/array/extract_variation3.phpt69
-rw-r--r--ext/standard/tests/array/extract_variation4.phpt69
-rw-r--r--ext/standard/tests/array/extract_variation5.phpt57
-rw-r--r--ext/standard/tests/array/extract_variation6.phpt29
-rw-r--r--ext/standard/tests/array/extract_variation7.phpt23
-rw-r--r--ext/standard/tests/array/extract_variation8.phpt26
-rw-r--r--ext/standard/tests/array/extract_variation9.phpt20
-rw-r--r--ext/standard/tests/array/range.phpt761
-rw-r--r--ext/standard/tests/array/range_64bit.phpt1207
-rw-r--r--ext/standard/tests/array/range_errors.phpt99
-rw-r--r--ext/standard/tests/array/range_variation.phpt626
-rw-r--r--ext/standard/tests/array/range_variation1.phpt60
-rw-r--r--ext/standard/tests/array/range_variation1_64bit.phpt60
46 files changed, 3174 insertions, 3325 deletions
diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt
index 8e785a84d..312345825 100644
--- a/ext/standard/tests/array/array_change_key_case.phpt
+++ b/ext/standard/tests/array/array_change_key_case.phpt
@@ -58,30 +58,6 @@ foreach ($arrays as $item) {
echo "\n";
}
-echo "\n*** Testing possible variations ***\n";
-$int_var = -19;
-$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
-
-/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
-var_dump(array_change_key_case($item, "CASE_UPPER"));
-var_dump(array_change_key_case($item, 5));
-
-/* when keys are different in terms of only case */
-/* should return one value key pair with key being in lowercase */
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
-
-/* should return one value key pair with key being in uppercase */
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) );
-
-echo "\n*** Testing error conditions ***\n";
-/* generate different failure conditions */
-var_dump( array_change_key_case($int_var) ); // args less than expected
-var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first argument
-var_dump( array_change_key_case() ); // Zero argument
-var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more than expected numbers
-
echo "end\n";
?>
--EXPECTF--
@@ -838,56 +814,4 @@ array(4) {
string(4) "four"
}
-
-*** Testing possible variations ***
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "four"
-}
-array(4) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
- ["THREE"]=>
- int(3)
- ["FOUR"]=>
- string(4) "four"
-}
-array(1) {
- ["one"]=>
- int(4)
-}
-array(1) {
- ["one"]=>
- int(5)
-}
-array(1) {
- ["ONE"]=>
- int(3)
-}
-array(1) {
- ["ONE"]=>
- int(2)
-}
-
-*** Testing error conditions ***
-
-Warning: array_change_key_case(): The argument should be an array in %s on line %d
-bool(false)
-
-Warning: array_change_key_case(): The argument should be an array in %s on line %d
-bool(false)
-
-Warning: Wrong parameter count for array_change_key_case() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_change_key_case() in %s on line %d
-NULL
end
diff --git a/ext/standard/tests/array/array_change_key_case_errors.phpt b/ext/standard/tests/array/array_change_key_case_errors.phpt
new file mode 100644
index 000000000..9abe1773b
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_errors.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test array_change_key_case() function - 3
+--FILE--
+<?php
+/* generate different failure conditions */
+$int_var = -19;
+$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
+
+var_dump( array_change_key_case($int_var) ); // args less than expected
+var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first argument
+var_dump( array_change_key_case() ); // Zero argument
+var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more than expected numbers
+
+echo "end\n";
+?>
+--EXPECTF--
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for array_change_key_case() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_change_key_case() in %s on line %d
+NULL
+end
diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt
new file mode 100644
index 000000000..ede297239
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test array_change_key_case() function - 2
+--FILE--
+<?php
+
+$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
+
+/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
+var_dump(array_change_key_case($item, "CASE_UPPER"));
+var_dump(array_change_key_case($item, 5));
+
+/* when keys are different in terms of only case */
+/* should return one value key pair with key being in lowercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
+
+/* should return one value key pair with key being in uppercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) );
+
+echo "end\n";
+?>
+--EXPECTF--
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ ["four"]=>
+ string(4) "four"
+}
+array(4) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+ ["FOUR"]=>
+ string(4) "four"
+}
+array(1) {
+ ["one"]=>
+ int(4)
+}
+array(1) {
+ ["one"]=>
+ int(5)
+}
+array(1) {
+ ["ONE"]=>
+ int(3)
+}
+array(1) {
+ ["ONE"]=>
+ int(2)
+}
+end
diff --git a/ext/standard/tests/array/array_keys.phpt b/ext/standard/tests/array/array_keys.phpt
deleted file mode 100644
index 07bb3446b..000000000
--- a/ext/standard/tests/array/array_keys.phpt
+++ /dev/null
@@ -1,466 +0,0 @@
---TEST--
-Test array_keys() function
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/*
-Prototype: array array_keys( array $input [, mixed $search_value [,
- bool $strict]]);
-Description: Return all the keys of an array
-*/
-
-echo "*** Testing array_keys() on basic array operation ***\n";
-$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
- array(1,2,3));
-var_dump(array_keys($basic_arr));
-
-echo "\n*** Testing array_keys() on various arrays ***";
-$arrays = array(
- array(),
- array(0),
- array( array() ),
- array("Hello" => "World"),
- array("" => ""),
- array(1,2,3, "d" => array(4,6, "d")),
- array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
- array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
- array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
- array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
- array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
- array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
-);
-
-$i = 0;
-/* loop through to test array_keys() with different arrays */
-foreach ($arrays as $array) {
- echo "\n-- Iteration $i --\n";
- var_dump(array_keys($array));
- $i++;
-}
-
-echo "\n*** Testing array_keys() on all the types other than arrays ***";
-$types_arr = array(
- TRUE => TRUE,
- FALSE => FALSE,
- 1 => 1,
- 0 => 0,
- -1 => -1,
- "1" => "1",
- "0" => "0",
- "-1" => "-1",
- NULL,
- array(),
- "php" => "php",
- "" => ""
-);
-$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
-foreach ($values as $value){
- echo "\n-- Loose type checking --\n";
- var_dump(array_keys($types_arr, $value));
- echo "\n-- strict type checking --\n";
- var_dump(array_keys($types_arr, $value, TRUE));
-}
-
-echo "\n*** Testing array_keys() with resource type ***\n";
-$resource1 = fopen( __FILE__, "r");
-$resource2 = opendir( "." );
-
-/* creating an array with resource types as elements */
-$arr_resource = array($resource1, $resource2);
-
-var_dump(array_keys($arr_resource, $resource1)); // loose type checking
-var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
-var_dump(array_keys($arr_resource, $resource2)); // loose type checking
-var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
-
-echo "\n*** Testing array_keys() on range of values ***\n";
-$arr_range = array(
- 2147483647 => 1,
- 2147483648 => 2,
- -2147483647 => 3,
- -2147483648 => 4,
- -2147483649 => 5,
- -0 => 6,
- 0 => 7
-);
-var_dump(array_keys($arr_range));
-
-echo "\n*** Testing array_keys() on an array created on the fly ***\n";
-var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
-var_dump(array_keys(array())); // null array
-
-echo "\n*** Testing error conditions ***";
-var_dump(array_keys(100));
-var_dump(array_keys("string"));
-var_dump(array_keys(new stdclass)); // object
-var_dump(array_keys()); // Zero arguments
-var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
-var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
-
-echo "Done\n";
-
---CLEAN--
-/* Closing the resource handles */
-fclose( $resource1 );
-closedir( $resource2 );
-?>
---EXPECTF--
-*** Testing array_keys() on basic array operation ***
-array(5) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- int(2)
- [3]=>
- int(-23)
- [4]=>
- int(3)
-}
-
-*** Testing array_keys() on various arrays ***
--- Iteration 0 --
-array(0) {
-}
-
--- Iteration 1 --
-array(1) {
- [0]=>
- int(0)
-}
-
--- Iteration 2 --
-array(1) {
- [0]=>
- int(0)
-}
-
--- Iteration 3 --
-array(1) {
- [0]=>
- string(5) "Hello"
-}
-
--- Iteration 4 --
-array(1) {
- [0]=>
- string(0) ""
-}
-
--- Iteration 5 --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- string(1) "d"
-}
-
--- Iteration 6 --
-array(4) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
- [3]=>
- string(1) "d"
-}
-
--- Iteration 7 --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
-}
-
--- Iteration 8 --
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- string(1) "a"
- [3]=>
- int(3)
- [4]=>
- int(5)
-}
-
--- Iteration 9 --
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(0)
- [2]=>
- string(0) ""
- [3]=>
- int(2)
- [4]=>
- int(3)
-}
-
--- Iteration 10 --
-array(3) {
- [0]=>
- string(1) "a"
- [1]=>
- string(2) "ab"
- [2]=>
- string(2) "cd"
-}
-
--- Iteration 11 --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- string(0) ""
-}
-
-*** Testing array_keys() on all the types other than arrays ***
--- Loose type checking --
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(-1)
- [2]=>
- string(3) "php"
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- string(0) ""
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(1)
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- string(3) "php"
- [3]=>
- string(0) ""
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(-1)
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(1)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(1)
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(0)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(0)
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(-1)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(-1)
-}
-
--- Loose type checking --
-array(3) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- [2]=>
- string(0) ""
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(2)
-}
-
--- Loose type checking --
-array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(3)
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- string(3) "php"
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- string(3) "php"
-}
-
--- Loose type checking --
-array(2) {
- [0]=>
- int(2)
- [1]=>
- string(0) ""
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- string(0) ""
-}
-
-*** Testing array_keys() with resource type ***
-array(1) {
- [0]=>
- int(0)
-}
-array(1) {
- [0]=>
- int(0)
-}
-array(1) {
- [0]=>
- int(1)
-}
-array(1) {
- [0]=>
- int(1)
-}
-
-*** Testing array_keys() on range of values ***
-array(4) {
- [0]=>
- int(2147483647)
- [1]=>
- int(-2147483648)
- [2]=>
- int(-2147483647)
- [3]=>
- int(0)
-}
-
-*** Testing array_keys() on an array created on the fly ***
-array(3) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
-}
-array(0) {
-}
-
-*** Testing error conditions ***
-Warning: array_keys(): The first argument should be an array in %s on line %d
-NULL
-
-Warning: array_keys(): The first argument should be an array in %s on line %d
-NULL
-
-Warning: array_keys(): The first argument should be an array in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_keys() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_keys() in %s on line %d
-NULL
-
-Warning: Illegal offset type in %s on line %d
-array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
-}
-Done
diff --git a/ext/standard/tests/array/array_keys_64bit.phpt b/ext/standard/tests/array/array_keys_64bit.phpt
deleted file mode 100644
index 3ffba0b4a..000000000
--- a/ext/standard/tests/array/array_keys_64bit.phpt
+++ /dev/null
@@ -1,472 +0,0 @@
---TEST--
-Test array_keys() function
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---INI--
-precision=14
---FILE--
-<?php
-/*
-Prototype: array array_keys( array $input [, mixed $search_value [,
- bool $strict]]);
-Description: Return all the keys of an array
-*/
-
-echo "*** Testing array_keys() on basic array operation ***\n";
-$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
- array(1,2,3));
-var_dump(array_keys($basic_arr));
-
-echo "\n*** Testing array_keys() on various arrays ***";
-$arrays = array(
- array(),
- array(0),
- array( array() ),
- array("Hello" => "World"),
- array("" => ""),
- array(1,2,3, "d" => array(4,6, "d")),
- array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
- array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
- array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
- array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
- array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
- array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
-);
-
-$i = 0;
-/* loop through to test array_keys() with different arrays */
-foreach ($arrays as $array) {
- echo "\n-- Iteration $i --\n";
- var_dump(array_keys($array));
- $i++;
-}
-
-echo "\n*** Testing array_keys() on all the types other than arrays ***";
-$types_arr = array(
- TRUE => TRUE,
- FALSE => FALSE,
- 1 => 1,
- 0 => 0,
- -1 => -1,
- "1" => "1",
- "0" => "0",
- "-1" => "-1",
- NULL,
- array(),
- "php" => "php",
- "" => ""
-);
-$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
-foreach ($values as $value){
- echo "\n-- Loose type checking --\n";
- var_dump(array_keys($types_arr, $value));
- echo "\n-- strict type checking --\n";
- var_dump(array_keys($types_arr, $value, TRUE));
-}
-
-echo "\n*** Testing array_keys() with resource type ***\n";
-$resource1 = fopen( __FILE__, "r");
-$resource2 = opendir( "." );
-
-/* creating an array with resource types as elements */
-$arr_resource = array($resource1, $resource2);
-
-var_dump(array_keys($arr_resource, $resource1)); // loose type checking
-var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
-var_dump(array_keys($arr_resource, $resource2)); // loose type checking
-var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
-
-echo "\n*** Testing array_keys() on range of values ***\n";
-$arr_range = array(
- 2147483647 => 1,
- 2147483648 => 2,
- -2147483647 => 3,
- -2147483648 => 4,
- -2147483649 => 5,
- -0 => 6,
- 0 => 7
-);
-var_dump(array_keys($arr_range));
-
-echo "\n*** Testing array_keys() on an array created on the fly ***\n";
-var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
-var_dump(array_keys(array())); // null array
-
-echo "\n*** Testing error conditions ***";
-var_dump(array_keys(100));
-var_dump(array_keys("string"));
-var_dump(array_keys(new stdclass)); // object
-var_dump(array_keys()); // Zero arguments
-var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
-var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
-
-echo "Done\n";
-
---CLEAN--
-/* Closing the resource handles */
-fclose( $resource1 );
-closedir( $resource2 );
-?>
---EXPECTF--
-*** Testing array_keys() on basic array operation ***
-array(5) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- int(2)
- [3]=>
- int(-23)
- [4]=>
- int(3)
-}
-
-*** Testing array_keys() on various arrays ***
--- Iteration 0 --
-array(0) {
-}
-
--- Iteration 1 --
-array(1) {
- [0]=>
- int(0)
-}
-
--- Iteration 2 --
-array(1) {
- [0]=>
- int(0)
-}
-
--- Iteration 3 --
-array(1) {
- [0]=>
- string(5) "Hello"
-}
-
--- Iteration 4 --
-array(1) {
- [0]=>
- string(0) ""
-}
-
--- Iteration 5 --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- string(1) "d"
-}
-
--- Iteration 6 --
-array(4) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
- [3]=>
- string(1) "d"
-}
-
--- Iteration 7 --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- int(3)
-}
-
--- Iteration 8 --
-array(5) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- string(1) "a"
- [3]=>
- int(3)
- [4]=>
- int(5)
-}
-
--- Iteration 9 --
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(0)
- [2]=>
- string(0) ""
- [3]=>
- int(2)
- [4]=>
- int(3)
-}
-
--- Iteration 10 --
-array(3) {
- [0]=>
- string(1) "a"
- [1]=>
- string(2) "ab"
- [2]=>
- string(2) "cd"
-}
-
--- Iteration 11 --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [3]=>
- string(0) ""
-}
-
-*** Testing array_keys() on all the types other than arrays ***
--- Loose type checking --
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(-1)
- [2]=>
- string(3) "php"
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- string(0) ""
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(1)
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(4) {
- [0]=>
- int(0)
- [1]=>
- int(2)
- [2]=>
- string(3) "php"
- [3]=>
- string(0) ""
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(-1)
-}
-
--- strict type checking --
-array(0) {
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(1)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(1)
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(0)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(0)
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- int(-1)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(-1)
-}
-
--- Loose type checking --
-array(3) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- [2]=>
- string(0) ""
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(2)
-}
-
--- Loose type checking --
-array(2) {
- [0]=>
- int(2)
- [1]=>
- int(3)
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- int(3)
-}
-
--- Loose type checking --
-array(1) {
- [0]=>
- string(3) "php"
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- string(3) "php"
-}
-
--- Loose type checking --
-array(2) {
- [0]=>
- int(2)
- [1]=>
- string(0) ""
-}
-
--- strict type checking --
-array(1) {
- [0]=>
- string(0) ""
-}
-
-*** Testing array_keys() with resource type ***
-array(1) {
- [0]=>
- int(0)
-}
-array(1) {
- [0]=>
- int(0)
-}
-array(1) {
- [0]=>
- int(1)
-}
-array(1) {
- [0]=>
- int(1)
-}
-
-*** Testing array_keys() on range of values ***
-array(6) {
- [0]=>
- int(2147483647)
- [1]=>
- int(2147483648)
- [2]=>
- int(-2147483647)
- [3]=>
- int(-2147483648)
- [4]=>
- int(-2147483649)
- [5]=>
- int(0)
-}
-
-*** Testing array_keys() on an array created on the fly ***
-array(3) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
-}
-array(0) {
-}
-
-*** Testing error conditions ***
-Warning: array_keys(): The first argument should be an array in %s on line %d
-NULL
-
-Warning: array_keys(): The first argument should be an array in %s on line %d
-NULL
-
-Warning: array_keys(): The first argument should be an array in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_keys() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_keys() in %s on line %d
-NULL
-
-Warning: Illegal offset type in %s on line %d
-array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
-}
-Done
diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt
new file mode 100644
index 000000000..e575b0931
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test array_keys() function (error conditions)
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions ***";
+var_dump(array_keys(100));
+var_dump(array_keys("string"));
+var_dump(array_keys(new stdclass)); // object
+var_dump(array_keys()); // Zero arguments
+var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
+var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Illegal offset type in %s on line %d
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_variation_001.phpt b/ext/standard/tests/array/array_keys_variation_001.phpt
new file mode 100644
index 000000000..1891c131c
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_variation_001.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test array_keys() function (variation - 1)
+--FILE--
+<?php
+
+echo "\n*** Testing array_keys() on various arrays ***";
+$arrays = array(
+ array(),
+ array(0),
+ array( array() ),
+ array("Hello" => "World"),
+ array("" => ""),
+ array(1,2,3, "d" => array(4,6, "d")),
+ array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
+ array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
+ array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
+ array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
+ array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
+ array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
+);
+
+$i = 0;
+/* loop through to test array_keys() with different arrays */
+foreach ($arrays as $array) {
+ echo "\n-- Iteration $i --\n";
+ var_dump(array_keys($array));
+ $i++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing array_keys() on various arrays ***
+-- Iteration 0 --
+array(0) {
+}
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "Hello"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(5) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ int(3)
+ [4]=>
+ int(5)
+}
+
+-- Iteration 9 --
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ string(0) ""
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(2) "ab"
+ [2]=>
+ string(2) "cd"
+}
+
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(0) ""
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_variation_002.phpt b/ext/standard/tests/array/array_keys_variation_002.phpt
new file mode 100644
index 000000000..d5df95b82
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_variation_002.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test array_keys() function (variation - 2)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing array_keys() on range of values ***
+array(4) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(-2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(0)
+}
+
+*** Testing array_keys() on an array created on the fly ***
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_variation_002_64bit.phpt b/ext/standard/tests/array/array_keys_variation_002_64bit.phpt
new file mode 100644
index 000000000..c0a034ec3
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_variation_002_64bit.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test array_keys() function (variation - 2)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing array_keys() on range of values ***
+array(6) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(-2147483648)
+ [4]=>
+ int(-2147483649)
+ [5]=>
+ int(0)
+}
+
+*** Testing array_keys() on an array created on the fly ***
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_variation_003.phpt b/ext/standard/tests/array/array_keys_variation_003.phpt
new file mode 100644
index 000000000..2c881bca0
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_variation_003.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test array_keys() function (variation - 3)
+--FILE--
+<?php
+
+echo "*** Testing array_keys() on all the types other than arrays ***\n";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ var_dump(array_keys($types_arr, $value));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing array_keys() on all the types other than arrays ***
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(-1)
+ [2]=>
+ string(3) "php"
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "php"
+ [3]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ string(0) ""
+}
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(0) ""
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_variation_004.phpt b/ext/standard/tests/array/array_keys_variation_004.phpt
new file mode 100644
index 000000000..1a4f0fcca
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_variation_004.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test array_keys() function (variation - 4)
+--FILE--
+<?php
+
+echo "*** Testing array_keys() on all the types other than arrays ***\n";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ var_dump(array_keys($types_arr, $value, TRUE));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing array_keys() on all the types other than arrays ***
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(-1)
+}
+array(1) {
+ [0]=>
+ int(2)
+}
+array(1) {
+ [0]=>
+ int(3)
+}
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_variation_005.phpt b/ext/standard/tests/array/array_keys_variation_005.phpt
new file mode 100644
index 000000000..9a912d68e
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_variation_005.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_keys() function (variation - 5)
+--FILE--
+<?php
+
+echo "\n*** Testing array_keys() with resource type ***\n";
+$resource1 = fopen( __FILE__, "r");
+$resource2 = opendir( "." );
+
+/* creating an array with resource types as elements */
+$arr_resource = array($resource1, $resource2);
+
+var_dump(array_keys($arr_resource, $resource1)); // loose type checking
+var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
+var_dump(array_keys($arr_resource, $resource2)); // loose type checking
+var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
+
+/* Closing the resource handles */
+fclose( $resource1 );
+closedir( $resource2 );
+
+?>
+--EXPECTF--
+*** Testing array_keys() with resource type ***
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
diff --git a/ext/standard/tests/array/array_pop.phpt b/ext/standard/tests/array/array_pop.phpt
index 544be2211..34a5c5426 100644
--- a/ext/standard/tests/array/array_pop.phpt
+++ b/ext/standard/tests/array/array_pop.phpt
@@ -3,10 +3,6 @@ Test array_pop() function
--FILE--
<?php
-/* Prototype: mixed array_pop( array &array );
- * Description: Pops and returns the last value of the array.
- */
-
array_pop($GLOBALS);
$empty_array = array();
@@ -31,24 +27,6 @@ $mixed_array = array(
5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
);
-/* Testing Error Conditions */
-echo "\n*** Testing Error Conditions ***\n";
-
-/* Zero argument */
-var_dump( array_pop() );
-
-/* Scalar argument */
-var_dump( array_pop($number) );
-
-/* String argument */
-var_dump( array_pop($str) );
-
-/* Invalid Number of arguments */
-var_dump( array_pop($mixed_array[1],$mixed_array[2]) );
-
-/* Empty Array as argument */
-var_dump( array_pop($empty_array) );
-
/* Loop to test normal functionality with different arrays inputs */
echo "\n*** Normal testing with various array inputs ***\n";
@@ -62,41 +40,9 @@ foreach( $mixed_array as $sub_array )
$counter++;
}
-echo"\n*** Checking for internal array pointer being reset when pop is called ***\n";
-
-echo "\nCurrent Element is : ";
-var_dump( current($mixed_array[1]) );
-
-echo "\nNext Element is : ";
-var_dump( next($mixed_array[1]) );
-
-echo "\nNext Element is : ";
-var_dump( next($mixed_array[1]) );
-
-echo "\nPOPed Element is : ";
-var_dump( array_pop($mixed_array[1]) );
-
-echo "\nCurrent Element after POP operation is: ";
-var_dump( current($mixed_array[1]) );
-
echo"\nDone";
?>
--EXPECTF--
-*** Testing Error Conditions ***
-
-Warning: Wrong parameter count for array_pop() in %s on line %d
-NULL
-
-Warning: array_pop(): The argument should be an array in %s on line %d
-NULL
-
-Warning: array_pop(): The argument should be an array in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_pop() in %s on line %d
-NULL
-NULL
-
*** Normal testing with various array inputs ***
-- Input Array for Iteration 1 is --
@@ -271,16 +217,4 @@ Array
Output after Pop is :
int(557)
-*** Checking for internal array pointer being reset when pop is called ***
-
-Current Element is : int(1)
-
-Next Element is : int(2)
-
-Next Element is : int(3)
-
-POPed Element is : int(9)
-
-Current Element after POP operation is: int(1)
-
Done
diff --git a/ext/standard/tests/array/array_pop_errors.phpt b/ext/standard/tests/array/array_pop_errors.phpt
new file mode 100644
index 000000000..6c289936b
--- /dev/null
+++ b/ext/standard/tests/array/array_pop_errors.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test array_pop() function (errors)
+--FILE--
+<?php
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+
+/* Zero argument */
+var_dump( array_pop() );
+
+/* Scalar argument */
+var_dump( array_pop($number) );
+
+/* String argument */
+var_dump( array_pop($str) );
+
+/* Invalid Number of arguments */
+var_dump( array_pop($mixed_array[1],$mixed_array[2]) );
+
+/* Empty Array as argument */
+var_dump( array_pop($empty_array) );
+
+echo"\nDone";
+?>
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for array_pop() in %s on line %d
+NULL
+
+Warning: array_pop(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pop(): The argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_pop() in %s on line %d
+NULL
+NULL
+
+Done
diff --git a/ext/standard/tests/array/array_pop_variation.phpt b/ext/standard/tests/array/array_pop_variation.phpt
new file mode 100644
index 000000000..795a8bcf8
--- /dev/null
+++ b/ext/standard/tests/array/array_pop_variation.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test array_pop() function (variation)
+--FILE--
+<?php
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+echo"\n*** Checking for internal array pointer being reset when pop is called ***\n";
+
+echo "\nCurrent Element is : ";
+var_dump( current($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nPOPed Element is : ";
+var_dump( array_pop($mixed_array[1]) );
+
+echo "\nCurrent Element after POP operation is: ";
+var_dump( current($mixed_array[1]) );
+
+echo"\nDone";
+?>
+--EXPECTF--
+*** Checking for internal array pointer being reset when pop is called ***
+
+Current Element is : int(1)
+
+Next Element is : int(2)
+
+Next Element is : int(3)
+
+POPed Element is : int(9)
+
+Current Element after POP operation is: int(1)
+
+Done
diff --git a/ext/standard/tests/array/array_search.phpt b/ext/standard/tests/array/array_search.phpt
index f6712eee9..1afcb1d4b 100644
--- a/ext/standard/tests/array/array_search.phpt
+++ b/ext/standard/tests/array/array_search.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_search_errors.phpt b/ext/standard/tests/array/array_search_errors.phpt
new file mode 100644
index 000000000..d02b9bc95
--- /dev/null
+++ b/ext/standard/tests/array/array_search_errors.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test array_search() and in_array() functions (errors)
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions of in_array() ***\n";
+/* zero argument */
+var_dump( in_array() );
+
+/* unexpected no.of arguments in in_array() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( in_array(1, $var, 0, "test") );
+var_dump( in_array("test") );
+
+/* unexpected second argument in in_array() */
+$var="test";
+var_dump( in_array("test", $var) );
+var_dump( in_array(1, 123) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions of in_array() ***
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_search_variation.phpt b/ext/standard/tests/array/array_search_variation.phpt
new file mode 100644
index 000000000..c8ca2d7b7
--- /dev/null
+++ b/ext/standard/tests/array/array_search_variation.phpt
@@ -0,0 +1,635 @@
+--TEST--
+Test array_search() and in_array() functions (variation)
+--FILE--
+<?php
+
+/* checking for STRICT option in in_array() */
+echo "\n*** Testing STRICT option of in_array() on arrays ***\n";
+$arrays = array (
+ array(0),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
+ array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
+ array(TRUE, FALSE),
+ array("", array()),
+ array("abcd\x00abcd\x00abcd"),
+ array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
+);
+
+$array_compare = array (
+ 4,
+ "4",
+ 4.00,
+ "b",
+ "5",
+ -2,
+ -2.0,
+ -2.98989,
+ "-.9",
+ "True",
+ "",
+ array(),
+ NULL,
+ "ab",
+ "abcd",
+ 0.0,
+ -0,
+ "abcd\x00abcd\x00abcd"
+);
+/* loop to check if elements in $array_compare exist in $arrays
+ using in_array() */
+$counter = 1;
+foreach($arrays as $array) {
+ foreach($array_compare as $compare) {
+ echo "-- Iteration $counter --\n";
+ //strict option OFF
+ var_dump(in_array($compare,$array));
+ //strict option ON
+ var_dump(in_array($compare,$array,TRUE));
+ //strict option OFF
+ var_dump(in_array($compare,$array,FALSE));
+ $counter++;
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing STRICT option of in_array() on arrays ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 9 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 13 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 24 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 25 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 26 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 27 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 28 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 29 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 31 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 32 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 33 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 34 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 35 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 36 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 37 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 38 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 39 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 40 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 41 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 42 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 43 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 44 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 45 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 46 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 47 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 48 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 49 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 50 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 51 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 52 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 53 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 54 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 55 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 56 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 57 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 58 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 59 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 60 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 61 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 62 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 63 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 64 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 65 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 66 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 67 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 68 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 69 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 70 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 71 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 72 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 73 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 74 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 75 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 76 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 77 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 78 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 79 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 80 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 81 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 82 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 83 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 84 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 85 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 86 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 87 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 88 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 89 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 90 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 91 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 92 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 93 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 94 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 95 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 96 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 97 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 98 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 99 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 100 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 101 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 102 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 103 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 104 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 105 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 106 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 107 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 108 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 109 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 110 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 111 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 112 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 113 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 114 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 115 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 116 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 117 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 118 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 119 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 120 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 121 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 122 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 123 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 124 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 125 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 126 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 127 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 128 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 129 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 130 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 131 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 132 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 133 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 134 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 135 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 136 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 137 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 138 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 139 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 140 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 141 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 142 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 143 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 144 --
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_search_variation1.phpt b/ext/standard/tests/array/array_search_variation1.phpt
new file mode 100644
index 000000000..81c954372
--- /dev/null
+++ b/ext/standard/tests/array/array_search_variation1.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test array_search() and in_array() functions (variation-1)
+--FILE--
+<?php
+
+/* checking loose and strict TYPE comparisons in in_array() */
+echo "\n*** Testing loose and strict TYPE comparison of in_array() ***\n";
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using in_array();
+ checking PHP type comparison tables
+*/
+$counter = 1;
+foreach($array_type as $type) {
+ echo "-- Iteration $counter --\n";
+ //loose type checking
+ var_dump( in_array($type,$misc_array ) );
+ //strict type checking
+ var_dump( in_array($type,$misc_array,true) );
+ //loose type checking
+ var_dump( in_array($type,$misc_array,false) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing loose and strict TYPE comparison of in_array() ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_search_variation2.phpt b/ext/standard/tests/array/array_search_variation2.phpt
new file mode 100644
index 000000000..10b2ea82c
--- /dev/null
+++ b/ext/standard/tests/array/array_search_variation2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_search() and in_array() functions (variation-2)
+--FILE--
+<?php
+
+/* checking for sub-arrays with in_array() */
+echo "\n*** Testing sub-arrays with in_array() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "two", "three" => 3),
+ 4 => "four",
+ "five" => 5,
+ array('', 'i')
+);
+var_dump( in_array("four", $sub_array) );
+//checking for element in a sub-array
+var_dump( in_array(3, $sub_array[1]) );
+var_dump( in_array(array('','i'), $sub_array) );
+
+/* checking for objects in in_array() */
+echo "\n*** Testing objects with in_array() ***\n";
+class in_array_check {
+ public $array_var = array(1=>"one", "two"=>2, 3=>3);
+ public function foo() {
+ echo "Public function\n";
+ }
+}
+
+$in_array_obj = new in_array_check(); //creating new object
+//error: as wrong datatype for second argument
+var_dump( in_array("array_var", $in_array_obj) );
+//error: as wrong datatype for second argument
+var_dump( in_array("foo", $in_array_obj) );
+//element found as "one" exists in array $array_var
+var_dump( in_array("one", $in_array_obj->array_var) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sub-arrays with in_array() ***
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing objects with in_array() ***
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt
new file mode 100644
index 000000000..83b607021
--- /dev/null
+++ b/ext/standard/tests/array/array_search_variation3.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test array_search() and in_array() functions (variation-3)
+--FILE--
+<?php
+
+/* checking for Resources */
+echo "\n*** Testing resource type with in_array() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( in_array($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( in_array((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with in_array() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( in_array("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( in_array("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( in_array(0, array("this")) );
+// false in strict mode
+var_dump( in_array(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( in_array("this", array(0)) );
+// false in stric mode
+var_dump( in_array("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( in_array(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( in_array('123abc', array(123)) );
+var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing resource type with in_array() ***
+bool(true)
+bool(false)
+
+*** Testing miscelleneos inputs with in_array() ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt
index 0aeb5a85a..e5e46ca3f 100644
--- a/ext/standard/tests/array/array_values.phpt
+++ b/ext/standard/tests/array/array_values.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_values_64bit.phpt b/ext/standard/tests/array/array_values_64bit.phpt
deleted file mode 100644
index a04880001..000000000
--- a/ext/standard/tests/array/array_values_64bit.phpt
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/array/array_values_errors.phpt b/ext/standard/tests/array/array_values_errors.phpt
new file mode 100644
index 000000000..0bef5a456
--- /dev/null
+++ b/ext/standard/tests/array/array_values_errors.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_values() function (errors)
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+/* Invalid number of args */
+var_dump( array_values() ); // Zero arguments
+var_dump( array_values(array(1,2,3), "") ); // No. of args > expected
+/* Invalid types */
+var_dump( array_values("") ); // Empty string
+var_dump( array_values(100) ); // Integer
+var_dump( array_values(new stdclass) ); // object
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for array_values() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_values() in %s on line %d
+NULL
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_values_variation.phpt b/ext/standard/tests/array/array_values_variation.phpt
new file mode 100644
index 000000000..15da1a621
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test array_values() function (variation)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing array_values() with resource type ***\n";
+$resource1 = fopen(__FILE__, "r"); // Creating a file resource
+$resource2 = opendir("."); // Creating a dir resource
+
+/* creating an array with resources as elements */
+$arr_resource = array( "a" => $resource1, "b" => $resource2);
+var_dump( array_values($arr_resource) );
+
+echo "\n*** Testing array_values() with range checking ***\n";
+$arr_range = array(
+ 2147483647,
+ 2147483648,
+ -2147483647,
+ -2147483648,
+ -0,
+ 0,
+ -2147483649
+);
+var_dump( array_values($arr_range) );
+
+echo "\n*** Testing array_values() on an array created on the fly ***\n";
+var_dump( array_values(array(1,2,3)) );
+var_dump( array_values(array()) ); // null array
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing array_values() with resource type ***
+array(2) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+}
+
+*** Testing array_values() with range checking ***
+array(7) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ float(2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ float(-2147483648)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ float(-2147483649)
+}
+
+*** Testing array_values() on an array created on the fly ***
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_values_variation_64bit.phpt b/ext/standard/tests/array/array_values_variation_64bit.phpt
new file mode 100644
index 000000000..8b1e2c0b0
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation_64bit.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test array_values() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing array_values() with resource type ***\n";
+$resource1 = fopen(__FILE__, "r"); // Creating a file resource
+$resource2 = opendir("."); // Creating a dir resource
+
+/* creating an array with resources as elements */
+$arr_resource = array( "a" => $resource1, "b" => $resource2);
+var_dump( array_values($arr_resource) );
+
+echo "\n*** Testing array_values() with range checking ***\n";
+$arr_range = array(
+ 2147483647,
+ 2147483648,
+ -2147483647,
+ -2147483648,
+ -0,
+ 0,
+ -2147483649
+);
+var_dump( array_values($arr_range) );
+
+echo "\n*** Testing array_values() on an array created on the fly ***\n";
+var_dump( array_values(array(1,2,3)) );
+var_dump( array_values(array()) ); // null array
+
+?>
+--EXPECTF--
+*** Testing array_values() with resource type ***
+array(2) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+}
+
+*** Testing array_values() with range checking ***
+array(7) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(-2147483648)
+ [4]=>
+ int(0)
+ [5]=>
+ int(0)
+ [6]=>
+ int(-2147483649)
+}
+
+*** Testing array_values() on an array created on the fly ***
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(0) {
+}
diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt
index a5b8da8a3..ae9dc3160 100644
--- a/ext/standard/tests/array/bug35014_64bit.phpt
+++ b/ext/standard/tests/array/bug35014_64bit.phpt
@@ -32,5 +32,5 @@ int(3)
int(9)
float(1)
int(9999999800000001)
-float(2.8404260053903E+20)
-int(8589934590)
+float(1.219953680145E+30)
+float(3.6893488147419E+19)
diff --git a/ext/standard/tests/array/bug41686.phpt b/ext/standard/tests/array/bug41686.phpt
new file mode 100644
index 000000000..9f1384edd
--- /dev/null
+++ b/ext/standard/tests/array/bug41686.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Bug #41686 (Omitting length param in array_slice not possible)
+--FILE--
+<?php
+$a = array(1,2,3);
+$b = array('a'=>1,'b'=>1,'c'=>2);
+
+var_dump(
+ array_slice($a, 1),
+ array_slice($a, 1, 2, TRUE),
+ array_slice($a, 1, NULL, TRUE),
+ array_slice($b, 1),
+ array_slice($b, 1, 2, TRUE),
+ array_slice($b, 1, NULL, TRUE)
+);
+
+echo "Done\n";
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(2) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(2)
+}
+array(2) {
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(2)
+}
+array(2) {
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/bug42233.phpt b/ext/standard/tests/array/bug42233.phpt
new file mode 100644
index 000000000..0cebc428f
--- /dev/null
+++ b/ext/standard/tests/array/bug42233.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #42233 (extract(): scandic characters not allowed as variable name)
+--FILE--
+<?php
+
+$test = array(
+ 'a' => '1',
+ 'æ' => '2',
+ 'æøåäö' => '3',
+);
+
+var_dump($test);
+var_dump(extract($test));
+var_dump($a);
+var_dump($æ);
+var_dump($æøåäö);
+
+echo "Done.\n";
+?>
+--EXPECT--
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["æ"]=>
+ string(1) "2"
+ ["æøåäö"]=>
+ string(1) "3"
+}
+int(3)
+string(1) "1"
+string(1) "2"
+string(1) "3"
+Done.
diff --git a/ext/standard/tests/array/extract.phpt b/ext/standard/tests/array/extract.phpt
deleted file mode 100644
index d9b37c859..000000000
--- a/ext/standard/tests/array/extract.phpt
+++ /dev/null
@@ -1,276 +0,0 @@
---TEST--
-Test extract() function
---FILE--
-<?php
-/* Prototype: int extract( array var_array[, int extract_type[, string prefix]] )
- * Description: Import variables into the current symbol table from an array
- */
-
-/* various combinations of arrays to be used for the test */
-$mixed_array = array(
- array(),
- array( 1,2,3,4,5,6,7,8,9 ),
- array( "One", "Two", "Three", "Four", "Five" ),
- array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
- array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
- array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
- array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
- array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
- "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
- array( 12, "name", 'age', '45' ),
- array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
- array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
- 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
-);
-
-$val = 4;
-$str = "John";
-
-/* Extracting Global Variables */
-extract($GLOBALS, EXTR_REFS);
-
-/* Testing Error Conditions */
-echo "*** Testing Error Conditions ***\n";
-
-/* Zero Arguments */
-var_dump( extract() );
-
-/* Invalid second argument ( only 0-6 is valid) */
-var_dump( extract($mixed_array[7], -1 . "wddr") );
-var_dump( extract($mixed_array[7], 7 , "wddr") );
-
-/* scalar argument */
-var_dump( extract($val) );
-
-/* string argument */
-var_dump( extract($str) );
-
-/* More than valid number of arguments i.e. 3 args */
-var_dump( extract($mixed_array[7], EXTR_SKIP, "aa", "ee") );
-
-/* Two Arguments, second as prefix but without prefix string as third argument */
-var_dump( extract($mixed_array[7],EXTR_PREFIX_IF_EXISTS) );
-
-$counter = 0;
-
-foreach ( $mixed_array as $sub_array ) {
- echo "\n-- Iteration $counter --\n";
- $counter++;
-
- var_dump ( extract($sub_array)); /* Single Argument */
-
- /* variations of two arguments */
- var_dump ( extract($sub_array, EXTR_OVERWRITE));
- var_dump ( extract($sub_array, EXTR_SKIP));
- var_dump ( extract($sub_array, EXTR_IF_EXISTS));
-
- /* variations of three arguments with use of various extract types*/
- var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
- var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
- var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
- var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
- var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
-}
-
-
-/* EXTR_REFS as second Argument */
-$a = array ('foo' => 'aaa');
-var_dump ( extract($a, EXTR_REFS));
-$b = $a;
-$b['foo'] = 'bbb';
-var_dump ( extract($a, EXTR_REFS));
-
-/* EXTR_PREFIX_ALL called twice with same prefix string */
-echo "\n*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***\n";
-var_dump ( extract($mixed_array[5], EXTR_PREFIX_ALL, "same"));
-var_dump ( extract($mixed_array[7], EXTR_PREFIX_ALL, "same"));
-var_dump ( extract($mixed_array[7], EXTR_PREFIX_ALL, "diff"));
-
-/* To show variables with numerical prefixes cannot be extracted */
-$var["i"] = 1;
-$var["j"] = 2;
-$var["k"] = 3;
-echo "\n*** Testing for Numerical prefixes ***\n";
-var_dump(extract($var));
-
-
-$var1["m"] = 1;
-$var1[2] = 2;
-$var1[] = 3;
-var_dump ( extract($var1));
-
-
-/* Using Class and objects */
-
-echo "\n*** Testing for object ***\n";
-class classA
-{
- public $v;
-}
-
-$A = new classA();
-var_dump ( extract(get_object_vars($A),EXTR_REFS));
-
-echo "\nDone";
-?>
-
---EXPECTF--
-*** Testing Error Conditions ***
-
-Warning: Wrong parameter count for extract() in %s on line %d
-NULL
-
-Warning: extract(): Unknown extract type in %s on line %d
-NULL
-
-Warning: extract(): Unknown extract type in %s on line %d
-NULL
-
-Warning: extract(): First argument should be an array in %s on line %d
-NULL
-
-Warning: extract(): First argument should be an array in %s on line %d
-NULL
-
-Warning: Wrong parameter count for extract() in %s on line %d
-NULL
-
-Warning: extract(): Prefix expected to be specified in %s on line %d
-NULL
-
--- Iteration 0 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-
--- Iteration 1 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(9)
-int(0)
-int(9)
-int(9)
-int(0)
-
--- Iteration 2 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(5)
-int(0)
-int(5)
-int(5)
-int(0)
-
--- Iteration 3 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(8)
-int(0)
-int(8)
-int(8)
-int(0)
-
--- Iteration 4 --
-int(5)
-int(5)
-int(0)
-int(5)
-int(5)
-int(5)
-int(5)
-int(5)
-int(5)
-
--- Iteration 5 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(5)
-int(0)
-int(5)
-int(5)
-int(0)
-
--- Iteration 6 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(5)
-int(0)
-int(5)
-int(5)
-int(0)
-
--- Iteration 7 --
-int(4)
-int(4)
-int(0)
-int(4)
-int(12)
-int(4)
-int(11)
-int(11)
-int(4)
-
--- Iteration 8 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(4)
-int(0)
-int(4)
-int(4)
-int(0)
-
--- Iteration 9 --
-int(0)
-int(0)
-int(0)
-int(0)
-int(3)
-int(0)
-int(3)
-int(3)
-int(0)
-
--- Iteration 10 --
-int(2)
-int(2)
-int(0)
-int(2)
-int(8)
-int(2)
-int(8)
-int(8)
-int(2)
-int(1)
-int(1)
-
-*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***
-int(5)
-int(11)
-int(11)
-
-*** Testing for Numerical prefixes ***
-int(3)
-int(1)
-
-*** Testing for object ***
-int(1)
-
-Done
diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt
new file mode 100644
index 000000000..cb8aba215
--- /dev/null
+++ b/ext/standard/tests/array/extract_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test extract() function (error conditions)
+--FILE--
+<?php
+
+/* Testing Error Conditions */
+echo "*** Testing Error Conditions ***\n";
+
+/* Zero Arguments */
+var_dump( extract() );
+
+/* Invalid second argument ( only 0-6 is valid) */
+$arr = array(1);
+var_dump( extract($arr, -1 . "wddr") );
+var_dump( extract($arr, 7 , "wddr") );
+
+/* scalar argument */
+$val = 1;
+var_dump( extract($val) );
+
+/* string argument */
+$str = "test";
+var_dump( extract($str) );
+
+/* More than valid number of arguments i.e. 3 args */
+var_dump( extract($arr, EXTR_SKIP, "aa", "ee") );
+
+/* Two Arguments, second as prefix but without prefix string as third argument */
+var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
+
+echo "Done\n";
+?>
+
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for extract() in %s on line %d
+NULL
+
+Warning: extract(): Unknown extract type in %s on line %d
+NULL
+
+Warning: extract(): Unknown extract type in %s on line %d
+NULL
+
+Warning: extract(): First argument should be an array in %s on line %d
+NULL
+
+Warning: extract(): First argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for extract() in %s on line %d
+NULL
+
+Warning: extract(): Prefix expected to be specified in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/extract_variation1.phpt b/ext/standard/tests/array/extract_variation1.phpt
new file mode 100644
index 000000000..1b2ea193f
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation1.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test extract() function (variation 1)
+--FILE--
+<?php
+
+$val = 4;
+$str = "John";
+
+debug_zval_dump($val);
+debug_zval_dump($str);
+
+/* Extracting Global Variables */
+var_dump(extract($GLOBALS, EXTR_REFS));
+debug_zval_dump($val);
+debug_zval_dump($str);
+
+echo "\nDone";
+?>
+
+--EXPECTF--
+long(4) refcount(2)
+string(4) "John" refcount(2)
+int(%d)
+long(4) refcount(2)
+string(4) "John" refcount(2)
+
+Done
diff --git a/ext/standard/tests/array/extract_variation2.phpt b/ext/standard/tests/array/extract_variation2.phpt
new file mode 100644
index 000000000..570e75f07
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation2.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test extract() function (variation 2)
+--FILE--
+<?php
+
+/* various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "Two", "Three", "Four", "Five" ),
+);
+
+$counter = 0;
+
+foreach ( $mixed_array as $sub_array ) {
+ echo "\n-- Iteration $counter --\n";
+ $counter++;
+
+ var_dump ( extract($sub_array)); /* Single Argument */
+
+ /* variations of two arguments */
+ var_dump ( extract($sub_array, EXTR_OVERWRITE));
+ var_dump ( extract($sub_array, EXTR_SKIP));
+ var_dump ( extract($sub_array, EXTR_IF_EXISTS));
+
+ /* variations of three arguments with use of various extract types*/
+ var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
+ var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+-- Iteration 0 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(9)
+int(0)
+int(9)
+int(9)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+Done
diff --git a/ext/standard/tests/array/extract_variation3.phpt b/ext/standard/tests/array/extract_variation3.phpt
new file mode 100644
index 000000000..2dcb775fe
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation3.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test extract() function (variation 3)
+--FILE--
+<?php
+
+/* various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+);
+
+$counter = 0;
+
+foreach ( $mixed_array as $sub_array ) {
+ echo "\n-- Iteration $counter --\n";
+ $counter++;
+
+ var_dump ( extract($sub_array)); /* Single Argument */
+
+ /* variations of two arguments */
+ var_dump ( extract($sub_array, EXTR_OVERWRITE));
+ var_dump ( extract($sub_array, EXTR_SKIP));
+ var_dump ( extract($sub_array, EXTR_IF_EXISTS));
+
+ /* variations of three arguments with use of various extract types*/
+ var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
+ var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+-- Iteration 0 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(8)
+int(0)
+int(8)
+int(8)
+int(0)
+
+-- Iteration 1 --
+int(5)
+int(5)
+int(0)
+int(5)
+int(5)
+int(5)
+int(5)
+int(5)
+int(5)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+Done
diff --git a/ext/standard/tests/array/extract_variation4.phpt b/ext/standard/tests/array/extract_variation4.phpt
new file mode 100644
index 000000000..11528f4b8
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation4.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test extract() function (variation 4)
+--FILE--
+<?php
+
+$mixed_array = array(
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+);
+
+$counter = 0;
+
+foreach ( $mixed_array as $sub_array ) {
+ echo "\n-- Iteration $counter --\n";
+ $counter++;
+
+ var_dump ( extract($sub_array)); /* Single Argument */
+
+ /* variations of two arguments */
+ var_dump ( extract($sub_array, EXTR_OVERWRITE));
+ var_dump ( extract($sub_array, EXTR_SKIP));
+ var_dump ( extract($sub_array, EXTR_IF_EXISTS));
+
+ /* variations of three arguments with use of various extract types*/
+ var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
+ var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+-- Iteration 0 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 1 --
+int(4)
+int(4)
+int(0)
+int(4)
+int(12)
+int(4)
+int(11)
+int(11)
+int(4)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+Done
diff --git a/ext/standard/tests/array/extract_variation5.phpt b/ext/standard/tests/array/extract_variation5.phpt
new file mode 100644
index 000000000..4a3e95bbb
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation5.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test extract() function (variation 5)
+--FILE--
+<?php
+
+$mixed_array = array(
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+$counter = 0;
+
+foreach ( $mixed_array as $sub_array ) {
+ echo "\n-- Iteration $counter --\n";
+ $counter++;
+
+ var_dump ( extract($sub_array)); /* Single Argument */
+
+ /* variations of two arguments */
+ var_dump ( extract($sub_array, EXTR_OVERWRITE));
+ var_dump ( extract($sub_array, EXTR_SKIP));
+ var_dump ( extract($sub_array, EXTR_IF_EXISTS));
+
+ /* variations of three arguments with use of various extract types*/
+ var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
+ var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+-- Iteration 0 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(3)
+int(0)
+int(3)
+int(3)
+int(0)
+
+-- Iteration 1 --
+int(2)
+int(2)
+int(0)
+int(2)
+int(8)
+int(2)
+int(8)
+int(8)
+int(2)
+Done
diff --git a/ext/standard/tests/array/extract_variation6.phpt b/ext/standard/tests/array/extract_variation6.phpt
new file mode 100644
index 000000000..e1e93e4c7
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation6.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test extract() function (variation 6)
+--FILE--
+<?php
+
+/* EXTR_REFS as second Argument */
+$a = array ('foo' => 'aaa');
+var_dump ( extract($a, EXTR_REFS));
+var_dump($foo);
+
+$b = $a;
+$b['foo'] = 'bbb';
+var_dump ( extract($a, EXTR_REFS));
+var_dump($foo);
+var_dump($a);
+
+echo "Done\n";
+?>
+
+--EXPECTF--
+int(1)
+string(3) "aaa"
+int(1)
+string(3) "bbb"
+array(1) {
+ ["foo"]=>
+ &string(3) "bbb"
+}
+Done
diff --git a/ext/standard/tests/array/extract_variation7.phpt b/ext/standard/tests/array/extract_variation7.phpt
new file mode 100644
index 000000000..653941dc9
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation7.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test extract() function (variation 7)
+--FILE--
+<?php
+
+/* EXTR_PREFIX_ALL called twice with same prefix string */
+echo "\n*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***\n";
+$a = array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" );
+var_dump ( extract($a, EXTR_PREFIX_ALL, "same"));
+
+$b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 );
+var_dump ( extract($b, EXTR_PREFIX_ALL, "same"));
+var_dump ( extract($b, EXTR_PREFIX_ALL, "diff"));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***
+int(5)
+int(11)
+int(11)
+Done
diff --git a/ext/standard/tests/array/extract_variation8.phpt b/ext/standard/tests/array/extract_variation8.phpt
new file mode 100644
index 000000000..0d15fd494
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation8.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test extract() function (variation 8)
+--FILE--
+<?php
+
+/* To show variables with numerical prefixes cannot be extracted */
+$var["i"] = 1;
+$var["j"] = 2;
+$var["k"] = 3;
+echo "\n*** Testing for Numerical prefixes ***\n";
+var_dump(extract($var));
+
+$var1["m"] = 1;
+$var1[2] = 2;
+$var1[] = 3;
+var_dump ( extract($var1));
+
+echo "\nDone";
+?>
+
+--EXPECTF--
+*** Testing for Numerical prefixes ***
+int(3)
+int(1)
+
+Done
diff --git a/ext/standard/tests/array/extract_variation9.phpt b/ext/standard/tests/array/extract_variation9.phpt
new file mode 100644
index 000000000..9d1db4cc7
--- /dev/null
+++ b/ext/standard/tests/array/extract_variation9.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test extract() function (variation 9)
+--FILE--
+<?php
+/* Using Class and objects */
+echo "\n*** Testing for object ***\n";
+class classA
+{
+ public $v;
+}
+
+$A = new classA();
+var_dump ( extract(get_object_vars($A),EXTR_REFS));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing for object ***
+int(1)
+Done
diff --git a/ext/standard/tests/array/range.phpt b/ext/standard/tests/array/range.phpt
index 3ecdeff6b..9fd0f5ed4 100644
--- a/ext/standard/tests/array/range.phpt
+++ b/ext/standard/tests/array/range.phpt
@@ -2,15 +2,8 @@
Test range() function
--INI--
precision=14
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
--FILE--
<?php
-/* Prototype: array range ( mixed $low, mixed $high [, number $step] );
- Description: Create an array containing a range of elements
-*/
echo "*** Testing range() function on basic operations ***\n";
@@ -53,62 +46,7 @@ var_dump( range("1", "2", 0.1) );
echo "\n-- Testing basic string with step --\n";
var_dump( range("abcd", "mnop", 2) );
-echo "\n*** Testing range() with various low and high values ***";
-$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
-$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
-
-for( $i = 0; $i < count($low_arr); $i++) {
- for( $j = 0; $j < count($high_arr); $j++) {
- echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
- var_dump( range( $low_arr[$i], $high_arr[$j] ) );
- }
-}
-
-
-echo "\n*** Possible variatins with steps ***\n";
-var_dump( range( 1, 5, TRUE ) );
-var_dump( range( 1, 5, array(1, 2) ) );
-
-echo "\n*** Testing max/outof range values ***\n";
-/*var_dump( range("a", "z", 255) );
-var_dump( range("z", "a", 255) ); */
-var_dump( range(2147483645, 2147483646) );
-var_dump( range(2147483646, 2147483648) );
-var_dump( range(-2147483647, -2147483646) );
-var_dump( range(-2147483648, -2147483647) );
-var_dump( range(-2147483649, -2147483647) );
-
-echo "\n*** Testing error conditions ***\n";
-
-echo "\n-- Testing ( (low < high) && (step = 0) ) --";
-var_dump( range(1, 2, 0) );
-var_dump( range("a", "b", 0) );
-
-echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
-var_dump( range(2, 1, 0) );
-var_dump( range("b", "a", 0) );
-
-echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
-var_dump( range(1.0, 7.0, 6.5) );
-
-echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
-var_dump( range(7.0, 1.0, 6.5) );
-
-echo "\n-- Testing Invalid number of arguments --";
-var_dump( range() ); // No.of args = 0
-var_dump( range(1) ); // No.of args < expected
-var_dump( range(1,2,3,4) ); // No.of args > expected
-var_dump( range(-1, -2, 2) );
-var_dump( range("a", "j", "z") );
-
-echo "\n-- Testing Invalid steps --";
-$step_arr = array( "string", NULL, FALSE, "", "\0" );
-
-foreach( $step_arr as $step ) {
- var_dump( range( 1, 5, $step ) );
-}
-
-echo "\nDone";
+echo "Done\n";
?>
--EXPECTF--
*** Testing range() function on basic operations ***
@@ -507,701 +445,4 @@ array(7) {
[6]=>
string(1) "m"
}
-
-*** Testing range() with various low and high values ***
--- creating an array with low = 'ABCD' and high = 'ABCD' --
-array(1) {
- [0]=>
- string(1) "A"
-}
-
--- creating an array with low = 'ABCD' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = 'ABCD' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = 'ABCD' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = 'ABCD' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = 'ABCD' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = 'ABCD' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '-10.5555' and high = 'ABCD' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '-10.5555' --
-array(1) {
- [0]=>
- float(-10.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '1' --
-array(12) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
- [11]=>
- float(0.4445)
-}
-
--- creating an array with low = '-10.5555' and high = '' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = 'Array' --
-array(12) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
- [11]=>
- float(0.4445)
-}
-
--- creating an array with low = '1' and high = 'ABCD' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = '-10.5555' --
-array(12) {
- [0]=>
- float(1)
- [1]=>
- float(0)
- [2]=>
- float(-1)
- [3]=>
- float(-2)
- [4]=>
- float(-3)
- [5]=>
- float(-4)
- [6]=>
- float(-5)
- [7]=>
- float(-6)
- [8]=>
- float(-7)
- [9]=>
- float(-8)
- [10]=>
- float(-9)
- [11]=>
- float(-10)
-}
-
--- creating an array with low = '1' and high = '1' --
-array(1) {
- [0]=>
- int(1)
-}
-
--- creating an array with low = '1' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = 'Array' --
-array(1) {
- [0]=>
- int(1)
-}
-
--- creating an array with low = '' and high = 'ABCD' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = '' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = 'ABCD' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = '' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = 'ABCD' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = '' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = 'Array' and high = 'ABCD' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = '-10.5555' --
-array(12) {
- [0]=>
- float(1)
- [1]=>
- float(0)
- [2]=>
- float(-1)
- [3]=>
- float(-2)
- [4]=>
- float(-3)
- [5]=>
- float(-4)
- [6]=>
- float(-5)
- [7]=>
- float(-6)
- [8]=>
- float(-7)
- [9]=>
- float(-8)
- [10]=>
- float(-9)
- [11]=>
- float(-10)
-}
-
--- creating an array with low = 'Array' and high = '1' --
-array(1) {
- [0]=>
- int(1)
-}
-
--- creating an array with low = 'Array' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = 'Array' --
-array(1) {
- [0]=>
- int(1)
-}
-
-*** Possible variatins with steps ***
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-
-*** Testing max/outof range values ***
-array(2) {
- [0]=>
- int(2147483645)
- [1]=>
- int(2147483646)
-}
-array(3) {
- [0]=>
- float(2147483646)
- [1]=>
- float(2147483647)
- [2]=>
- float(2147483648)
-}
-array(2) {
- [0]=>
- int(-2147483647)
- [1]=>
- int(-2147483646)
-}
-array(2) {
- [0]=>
- float(-2147483648)
- [1]=>
- float(-2147483647)
-}
-array(3) {
- [0]=>
- float(-2147483649)
- [1]=>
- float(-2147483648)
- [2]=>
- float(-2147483647)
-}
-
-*** Testing error conditions ***
-
--- Testing ( (low < high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-
--- Testing ( (low > high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-
--- Testing ( (low < high) && (high-low < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-
--- Testing ( (low > high) && (low-high < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
--- Testing Invalid number of arguments --
-Warning: range() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: range() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: range() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
--- Testing Invalid steps --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
Done
diff --git a/ext/standard/tests/array/range_64bit.phpt b/ext/standard/tests/array/range_64bit.phpt
deleted file mode 100644
index 2f348afab..000000000
--- a/ext/standard/tests/array/range_64bit.phpt
+++ /dev/null
@@ -1,1207 +0,0 @@
---TEST--
-Test range() function
---INI--
-precision=14
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype: array range ( mixed $low, mixed $high [, number $step] );
- Description: Create an array containing a range of elements
-*/
-
-echo "*** Testing range() function on basic operations ***\n";
-
-echo "\n-- Integers as Low and High --\n";
-echo "-- An array of elements from low to high --\n";
-var_dump( range(1, 10) );
-echo "\n-- An array of elements from high to low --\n";
-var_dump( range(10, 1) );
-
-echo "\n-- Numeric Strings as Low and High --\n";
-echo "-- An array of elements from low to high --\n";
-var_dump( range("1", "10") );
-echo "\n-- An array of elements from high to low --\n";
-var_dump( range("10", "1") );
-
-echo "\n-- Chars as Low and High --\n";
-echo "-- An array of elements from low to high --\n";
-var_dump( range("a", "z") );
-echo "\n-- An array of elements from high to low --\n";
-var_dump( range("z", "a") );
-
-echo "\n-- Low and High are equal --\n";
-var_dump( range(5, 5) );
-var_dump( range("q", "q") );
-
-echo "\n-- floats as Low and High --\n";
-var_dump( range(5.1, 10.1) );
-var_dump( range(10.1, 5.1) );
-
-var_dump( range("5.1", "10.1") );
-var_dump( range("10.1", "5.1") );
-
-echo "\n-- Passing step with Low and High --\n";
-var_dump( range(1, 2, 0.1) );
-var_dump( range(2, 1, 0.1) );
-
-var_dump( range(1, 2, "0.1") );
-var_dump( range("1", "2", 0.1) );
-
-echo "\n-- Testing basic string with step --\n";
-var_dump( range("abcd", "mnop", 2) );
-
-echo "\n*** Testing range() with various low and high values ***";
-$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
-$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
-
-for( $i = 0; $i < count($low_arr); $i++) {
- for( $j = 0; $j < count($high_arr); $j++) {
- echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
- var_dump( range( $low_arr[$i], $high_arr[$j] ) );
- }
-}
-
-
-echo "\n*** Possible variatins with steps ***\n";
-var_dump( range( 1, 5, TRUE ) );
-var_dump( range( 1, 5, array(1, 2) ) );
-
-echo "\n*** Testing max/outof range values ***\n";
-/*var_dump( range("a", "z", 255) );
-var_dump( range("z", "a", 255) ); */
-var_dump( range(2147483645, 2147483646) );
-var_dump( range(2147483646, 2147483648) );
-var_dump( range(-2147483647, -2147483646) );
-var_dump( range(-2147483648, -2147483647) );
-var_dump( range(-2147483649, -2147483647) );
-
-echo "\n*** Testing error conditions ***\n";
-
-echo "\n-- Testing ( (low < high) && (step = 0) ) --";
-var_dump( range(1, 2, 0) );
-var_dump( range("a", "b", 0) );
-
-echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
-var_dump( range(2, 1, 0) );
-var_dump( range("b", "a", 0) );
-
-echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
-var_dump( range(1.0, 7.0, 6.5) );
-
-echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
-var_dump( range(7.0, 1.0, 6.5) );
-
-echo "\n-- Testing Invalid number of arguments --";
-var_dump( range() ); // No.of args = 0
-var_dump( range(1) ); // No.of args < expected
-var_dump( range(1,2,3,4) ); // No.of args > expected
-var_dump( range(-1, -2, 2) );
-var_dump( range("a", "j", "z") );
-
-echo "\n-- Testing Invalid steps --";
-$step_arr = array( "string", NULL, FALSE, "", "\0" );
-
-foreach( $step_arr as $step ) {
- var_dump( range( 1, 5, $step ) );
-}
-
-echo "\nDone";
-?>
---EXPECTF--
-*** Testing range() function on basic operations ***
-
--- Integers as Low and High --
--- An array of elements from low to high --
-array(10) {
- [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)
- [9]=>
- int(10)
-}
-
--- An array of elements from high to low --
-array(10) {
- [0]=>
- int(10)
- [1]=>
- int(9)
- [2]=>
- int(8)
- [3]=>
- int(7)
- [4]=>
- int(6)
- [5]=>
- int(5)
- [6]=>
- int(4)
- [7]=>
- int(3)
- [8]=>
- int(2)
- [9]=>
- int(1)
-}
-
--- Numeric Strings as Low and High --
--- An array of elements from low to high --
-array(10) {
- [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)
- [9]=>
- int(10)
-}
-
--- An array of elements from high to low --
-array(10) {
- [0]=>
- int(10)
- [1]=>
- int(9)
- [2]=>
- int(8)
- [3]=>
- int(7)
- [4]=>
- int(6)
- [5]=>
- int(5)
- [6]=>
- int(4)
- [7]=>
- int(3)
- [8]=>
- int(2)
- [9]=>
- int(1)
-}
-
--- Chars as Low and High --
--- An array of elements from low to high --
-array(26) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "b"
- [2]=>
- string(1) "c"
- [3]=>
- string(1) "d"
- [4]=>
- string(1) "e"
- [5]=>
- string(1) "f"
- [6]=>
- string(1) "g"
- [7]=>
- string(1) "h"
- [8]=>
- string(1) "i"
- [9]=>
- string(1) "j"
- [10]=>
- string(1) "k"
- [11]=>
- string(1) "l"
- [12]=>
- string(1) "m"
- [13]=>
- string(1) "n"
- [14]=>
- string(1) "o"
- [15]=>
- string(1) "p"
- [16]=>
- string(1) "q"
- [17]=>
- string(1) "r"
- [18]=>
- string(1) "s"
- [19]=>
- string(1) "t"
- [20]=>
- string(1) "u"
- [21]=>
- string(1) "v"
- [22]=>
- string(1) "w"
- [23]=>
- string(1) "x"
- [24]=>
- string(1) "y"
- [25]=>
- string(1) "z"
-}
-
--- An array of elements from high to low --
-array(26) {
- [0]=>
- string(1) "z"
- [1]=>
- string(1) "y"
- [2]=>
- string(1) "x"
- [3]=>
- string(1) "w"
- [4]=>
- string(1) "v"
- [5]=>
- string(1) "u"
- [6]=>
- string(1) "t"
- [7]=>
- string(1) "s"
- [8]=>
- string(1) "r"
- [9]=>
- string(1) "q"
- [10]=>
- string(1) "p"
- [11]=>
- string(1) "o"
- [12]=>
- string(1) "n"
- [13]=>
- string(1) "m"
- [14]=>
- string(1) "l"
- [15]=>
- string(1) "k"
- [16]=>
- string(1) "j"
- [17]=>
- string(1) "i"
- [18]=>
- string(1) "h"
- [19]=>
- string(1) "g"
- [20]=>
- string(1) "f"
- [21]=>
- string(1) "e"
- [22]=>
- string(1) "d"
- [23]=>
- string(1) "c"
- [24]=>
- string(1) "b"
- [25]=>
- string(1) "a"
-}
-
--- Low and High are equal --
-array(1) {
- [0]=>
- int(5)
-}
-array(1) {
- [0]=>
- string(1) "q"
-}
-
--- floats as Low and High --
-array(6) {
- [0]=>
- float(5.1)
- [1]=>
- float(6.1)
- [2]=>
- float(7.1)
- [3]=>
- float(8.1)
- [4]=>
- float(9.1)
- [5]=>
- float(10.1)
-}
-array(6) {
- [0]=>
- float(10.1)
- [1]=>
- float(9.1)
- [2]=>
- float(8.1)
- [3]=>
- float(7.1)
- [4]=>
- float(6.1)
- [5]=>
- float(5.1)
-}
-array(6) {
- [0]=>
- float(5.1)
- [1]=>
- float(6.1)
- [2]=>
- float(7.1)
- [3]=>
- float(8.1)
- [4]=>
- float(9.1)
- [5]=>
- float(10.1)
-}
-array(6) {
- [0]=>
- float(10.1)
- [1]=>
- float(9.1)
- [2]=>
- float(8.1)
- [3]=>
- float(7.1)
- [4]=>
- float(6.1)
- [5]=>
- float(5.1)
-}
-
--- Passing step with Low and High --
-array(11) {
- [0]=>
- float(1)
- [1]=>
- float(1.1)
- [2]=>
- float(1.2)
- [3]=>
- float(1.3)
- [4]=>
- float(1.4)
- [5]=>
- float(1.5)
- [6]=>
- float(1.6)
- [7]=>
- float(1.7)
- [8]=>
- float(1.8)
- [9]=>
- float(1.9)
- [10]=>
- float(2)
-}
-array(11) {
- [0]=>
- float(2)
- [1]=>
- float(1.9)
- [2]=>
- float(1.8)
- [3]=>
- float(1.7)
- [4]=>
- float(1.6)
- [5]=>
- float(1.5)
- [6]=>
- float(1.4)
- [7]=>
- float(1.3)
- [8]=>
- float(1.2)
- [9]=>
- float(1.1)
- [10]=>
- float(1)
-}
-array(11) {
- [0]=>
- float(1)
- [1]=>
- float(1.1)
- [2]=>
- float(1.2)
- [3]=>
- float(1.3)
- [4]=>
- float(1.4)
- [5]=>
- float(1.5)
- [6]=>
- float(1.6)
- [7]=>
- float(1.7)
- [8]=>
- float(1.8)
- [9]=>
- float(1.9)
- [10]=>
- float(2)
-}
-array(11) {
- [0]=>
- float(1)
- [1]=>
- float(1.1)
- [2]=>
- float(1.2)
- [3]=>
- float(1.3)
- [4]=>
- float(1.4)
- [5]=>
- float(1.5)
- [6]=>
- float(1.6)
- [7]=>
- float(1.7)
- [8]=>
- float(1.8)
- [9]=>
- float(1.9)
- [10]=>
- float(2)
-}
-
--- Testing basic string with step --
-array(7) {
- [0]=>
- string(1) "a"
- [1]=>
- string(1) "c"
- [2]=>
- string(1) "e"
- [3]=>
- string(1) "g"
- [4]=>
- string(1) "i"
- [5]=>
- string(1) "k"
- [6]=>
- string(1) "m"
-}
-
-*** Testing range() with various low and high values ***
--- creating an array with low = 'ABCD' and high = 'ABCD' --
-array(1) {
- [0]=>
- string(1) "A"
-}
-
--- creating an array with low = 'ABCD' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = 'ABCD' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = 'ABCD' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = 'ABCD' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = 'ABCD' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = 'ABCD' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '-10.5555' and high = 'ABCD' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '-10.5555' --
-array(1) {
- [0]=>
- float(-10.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '1' --
-array(12) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
- [11]=>
- float(0.4445)
-}
-
--- creating an array with low = '-10.5555' and high = '' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = '' --
-array(11) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
-}
-
--- creating an array with low = '-10.5555' and high = 'Array' --
-array(12) {
- [0]=>
- float(-10.5555)
- [1]=>
- float(-9.5555)
- [2]=>
- float(-8.5555)
- [3]=>
- float(-7.5555)
- [4]=>
- float(-6.5555)
- [5]=>
- float(-5.5555)
- [6]=>
- float(-4.5555)
- [7]=>
- float(-3.5555)
- [8]=>
- float(-2.5555)
- [9]=>
- float(-1.5555)
- [10]=>
- float(-0.5555)
- [11]=>
- float(0.4445)
-}
-
--- creating an array with low = '1' and high = 'ABCD' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = '-10.5555' --
-array(12) {
- [0]=>
- float(1)
- [1]=>
- float(0)
- [2]=>
- float(-1)
- [3]=>
- float(-2)
- [4]=>
- float(-3)
- [5]=>
- float(-4)
- [6]=>
- float(-5)
- [7]=>
- float(-6)
- [8]=>
- float(-7)
- [9]=>
- float(-8)
- [10]=>
- float(-9)
- [11]=>
- float(-10)
-}
-
--- creating an array with low = '1' and high = '1' --
-array(1) {
- [0]=>
- int(1)
-}
-
--- creating an array with low = '1' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = '1' and high = 'Array' --
-array(1) {
- [0]=>
- int(1)
-}
-
--- creating an array with low = '' and high = 'ABCD' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = '' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = 'ABCD' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = '' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = 'ABCD' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '-10.5555' --
-array(11) {
- [0]=>
- float(0)
- [1]=>
- float(-1)
- [2]=>
- float(-2)
- [3]=>
- float(-3)
- [4]=>
- float(-4)
- [5]=>
- float(-5)
- [6]=>
- float(-6)
- [7]=>
- float(-7)
- [8]=>
- float(-8)
- [9]=>
- float(-9)
- [10]=>
- float(-10)
-}
-
--- creating an array with low = '' and high = '1' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = '' --
-array(1) {
- [0]=>
- int(0)
-}
-
--- creating an array with low = '' and high = 'Array' --
-array(2) {
- [0]=>
- int(0)
- [1]=>
- int(1)
-}
-
--- creating an array with low = 'Array' and high = 'ABCD' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = '-10.5555' --
-array(12) {
- [0]=>
- float(1)
- [1]=>
- float(0)
- [2]=>
- float(-1)
- [3]=>
- float(-2)
- [4]=>
- float(-3)
- [5]=>
- float(-4)
- [6]=>
- float(-5)
- [7]=>
- float(-6)
- [8]=>
- float(-7)
- [9]=>
- float(-8)
- [10]=>
- float(-9)
- [11]=>
- float(-10)
-}
-
--- creating an array with low = 'Array' and high = '1' --
-array(1) {
- [0]=>
- int(1)
-}
-
--- creating an array with low = 'Array' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = '' --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(0)
-}
-
--- creating an array with low = 'Array' and high = 'Array' --
-array(1) {
- [0]=>
- int(1)
-}
-
-*** Possible variatins with steps ***
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
-
-*** Testing max/outof range values ***
-array(2) {
- [0]=>
- int(2147483645)
- [1]=>
- int(2147483646)
-}
-array(3) {
- [0]=>
- int(2147483646)
- [1]=>
- int(2147483647)
- [2]=>
- int(2147483648)
-}
-array(2) {
- [0]=>
- int(-2147483647)
- [1]=>
- int(-2147483646)
-}
-array(2) {
- [0]=>
- int(-2147483648)
- [1]=>
- int(-2147483647)
-}
-array(3) {
- [0]=>
- int(-2147483649)
- [1]=>
- int(-2147483648)
- [2]=>
- int(-2147483647)
-}
-
-*** Testing error conditions ***
-
--- Testing ( (low < high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-
--- Testing ( (low > high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-
--- Testing ( (low < high) && (high-low < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-
--- Testing ( (low > high) && (low-high < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
--- Testing Invalid number of arguments --
-Warning: range() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: range() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: range() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
--- Testing Invalid steps --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-
-Done
diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt
new file mode 100644
index 000000000..9652e2834
--- /dev/null
+++ b/ext/standard/tests/array/range_errors.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test range() function (errors)
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing ( (low < high) && (step = 0) ) --";
+var_dump( range(1, 2, 0) );
+var_dump( range("a", "b", 0) );
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
+var_dump( range(2, 1, 0) );
+var_dump( range("b", "a", 0) );
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
+var_dump( range(1.0, 7.0, 6.5) );
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
+var_dump( range(7.0, 1.0, 6.5) );
+
+echo "\n-- Testing Invalid number of arguments --";
+var_dump( range() ); // No.of args = 0
+var_dump( range(1) ); // No.of args < expected
+var_dump( range(1,2,3,4) ); // No.of args > expected
+var_dump( range(-1, -2, 2) );
+var_dump( range("a", "j", "z") );
+
+echo "\n-- Testing Invalid steps --";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
+
+foreach( $step_arr as $step ) {
+ var_dump( range( 1, 5, $step ) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+-- Testing ( (low < high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low < high) && (high-low < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (low-high < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid number of arguments --
+Warning: range() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: range() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: range() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid steps --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/range_variation.phpt b/ext/standard/tests/array/range_variation.phpt
new file mode 100644
index 000000000..0ac8c55e6
--- /dev/null
+++ b/ext/standard/tests/array/range_variation.phpt
@@ -0,0 +1,626 @@
+--TEST--
+Test range() function (variation-1)
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing range() with various low and high values ***";
+$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+
+for( $i = 0; $i < count($low_arr); $i++) {
+ for( $j = 0; $j < count($high_arr); $j++) {
+ echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
+ var_dump( range( $low_arr[$i], $high_arr[$j] ) );
+ }
+}
+
+echo "\n*** Possible variatins with steps ***\n";
+var_dump( range( 1, 5, TRUE ) );
+var_dump( range( 1, 5, array(1, 2) ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing range() with various low and high values ***
+-- creating an array with low = 'ABCD' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+
+-- creating an array with low = 'ABCD' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = 'ABCD' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '-10.5555' and high = 'ABCD' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '-10.5555' --
+array(1) {
+ [0]=>
+ float(-10.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '1' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = 'Array' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '1' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = '1' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = 'Array' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Possible variatins with steps ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+Done
diff --git a/ext/standard/tests/array/range_variation1.phpt b/ext/standard/tests/array/range_variation1.phpt
new file mode 100644
index 000000000..6e57f7312
--- /dev/null
+++ b/ext/standard/tests/array/range_variation1.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test range() function (variation-2)
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\nDone";
+?>
+--EXPECTF--
+*** Testing max/outof range values ***
+array(2) {
+ [0]=>
+ int(2147483645)
+ [1]=>
+ int(2147483646)
+}
+array(3) {
+ [0]=>
+ float(2147483646)
+ [1]=>
+ float(2147483647)
+ [2]=>
+ float(2147483648)
+}
+array(2) {
+ [0]=>
+ int(-2147483647)
+ [1]=>
+ int(-2147483646)
+}
+array(2) {
+ [0]=>
+ float(-2147483648)
+ [1]=>
+ float(-2147483647)
+}
+array(3) {
+ [0]=>
+ float(-2147483649)
+ [1]=>
+ float(-2147483648)
+ [2]=>
+ float(-2147483647)
+}
+
+Done
diff --git a/ext/standard/tests/array/range_variation1_64bit.phpt b/ext/standard/tests/array/range_variation1_64bit.phpt
new file mode 100644
index 000000000..a14dae987
--- /dev/null
+++ b/ext/standard/tests/array/range_variation1_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test range() function (variation-2)
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\nDone";
+?>
+--EXPECTF--
+*** Testing max/outof range values ***
+array(2) {
+ [0]=>
+ int(2147483645)
+ [1]=>
+ int(2147483646)
+}
+array(3) {
+ [0]=>
+ int(2147483646)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(2147483648)
+}
+array(2) {
+ [0]=>
+ int(-2147483647)
+ [1]=>
+ int(-2147483646)
+}
+array(2) {
+ [0]=>
+ int(-2147483648)
+ [1]=>
+ int(-2147483647)
+}
+array(3) {
+ [0]=>
+ int(-2147483649)
+ [1]=>
+ int(-2147483648)
+ [2]=>
+ int(-2147483647)
+}
+
+Done