diff options
Diffstat (limited to 'ext/standard/tests')
385 files changed, 590 insertions, 52291 deletions
diff --git a/ext/standard/tests/array/array_change_key_case_variation1.phpt b/ext/standard/tests/array/array_change_key_case_variation1.phpt deleted file mode 100644 index 14626deb86..0000000000 --- a/ext/standard/tests/array/array_change_key_case_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test array_change_key_case() function : usage variations - Pass different data types as $input arg ---FILE-- -<?php -/* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Returns an array with all string keys lowercased [or uppercased] - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $input argument to test behaviour of array_change_key_case() - */ - -echo "*** Testing array_change_key_case() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $input argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of array_change_key_case() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_change_key_case($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_change_key_case() : usage variations *** - --- Iteration 1 -- - -Warning: array_change_key_case() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_change_key_case() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_change_key_case() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_change_key_case() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_change_key_case() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_change_key_case() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_change_key_case() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_change_key_case() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_change_key_case() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_change_key_case() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_change_key_case() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_change_key_case() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_change_key_case() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -array(0) { -} - --- Iteration 19 -- - -Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_change_key_case() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_change_key_case() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_change_key_case() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_change_key_case() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_change_key_case_variation2.phpt b/ext/standard/tests/array/array_change_key_case_variation2.phpt deleted file mode 100644 index b0b90bd926..0000000000 --- a/ext/standard/tests/array/array_change_key_case_variation2.phpt +++ /dev/null @@ -1,289 +0,0 @@ ---TEST-- -Test array_change_key_case() function : usage variations - Pass different data types as $case arg ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Returns an array with all string keys lowercased [or uppercased] - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $case argument to array_change_key_case() to test behaviour - * Where possible, CASE_UPPER has been entered as a string value - */ - -echo "*** Testing array_change_key_case() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$array = array ('one' => 1, 'TWO' => 2, 'Three' => 3); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -CASE_UPPER -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $case argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "CASE_UPPER", - 'CASE_UPPER', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of array_change_key_case() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_change_key_case($array, $input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_change_key_case() : usage variations *** - --- Iteration 1 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 2 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 3 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 4 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 5 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 6 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 7 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 8 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 9 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 10 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 11 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 12 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 13 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 14 -- -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["THREE"]=> - int(3) -} - --- Iteration 15 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 16 -- - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_change_key_case() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} - --- Iteration 23 -- -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["three"]=> - int(3) -} -Done diff --git a/ext/standard/tests/array/array_chunk_variation1.phpt b/ext/standard/tests/array/array_chunk_variation1.phpt deleted file mode 100644 index e48f28f8be..0000000000 --- a/ext/standard/tests/array/array_chunk_variation1.phpt +++ /dev/null @@ -1,325 +0,0 @@ ---TEST-- -Test array_chunk() function : usage variations - unexpected values for 'array' argument ---FILE-- -<?php -/* Prototype : proto array array_chunk(array $array, int $size [, bool $preserve_keys]) - * Description: Split array into chunks - * Chunks an array into size large chunks. - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_chunk() function with unexpected values for 'array' argument -*/ - -echo "*** Testing array_chunk() : usage variations ***\n"; - -// Initialise function arguments -$size = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new stdclass(), - - // undefined data -/*21*/ @$undefined_var, - - // unset data -/*22*/ @$unset_var - -); - -$count = 1; -// loop through each element of the array for input -foreach($values as $value){ - echo "\n-- Iteration $count --\n"; - var_dump( array_chunk($value, $size) ); - var_dump( array_chunk($value, $size, true) ); - var_dump( array_chunk($value, $size, false) ); - $count++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_chunk() : usage variations *** - --- Iteration 1 -- - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_chunk_variation2.phpt b/ext/standard/tests/array/array_chunk_variation2.phpt deleted file mode 100644 index b3f66a005a..0000000000 --- a/ext/standard/tests/array/array_chunk_variation2.phpt +++ /dev/null @@ -1,429 +0,0 @@ ---TEST-- -Test array_chunk() function : usage variations - unexpected values for 'size' argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys]) - * Description: Split array into chunks - : Chunks an array into size large chunks - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_chunk() function with unexpected values for 'size' argument -*/ - -echo "*** Testing array_chunk() : usage variations ***\n"; - -// input array -$input = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array ( - - // float data -/*1*/ 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data -/*6*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - - // string data -/*19*/ "string", - 'string', - - // object data -/*21*/ new stdclass(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var - -); - -// loop through each element of the array for size -$count = 1; -foreach($values as $value){ - echo "\n-- Iteration $count --\n"; - var_dump( array_chunk($input, $value) ); - var_dump( array_chunk($input, $value, true) ); - var_dump( array_chunk($input, $value, false) ); - $count++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_chunk() : usage variations *** - --- Iteration 1 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 2 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 3 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 4 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 13 -- -array(2) { - [0]=> - array(1) { - [0]=> - int(1) - } - [1]=> - array(1) { - [0]=> - int(2) - } -} -array(2) { - [0]=> - array(1) { - [0]=> - int(1) - } - [1]=> - array(1) { - [1]=> - int(2) - } -} -array(2) { - [0]=> - array(1) { - [0]=> - int(1) - } - [1]=> - array(1) { - [0]=> - int(2) - } -} - --- Iteration 14 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 15 -- -array(2) { - [0]=> - array(1) { - [0]=> - int(1) - } - [1]=> - array(1) { - [0]=> - int(2) - } -} -array(2) { - [0]=> - array(1) { - [0]=> - int(1) - } - [1]=> - array(1) { - [1]=> - int(2) - } -} -array(2) { - [0]=> - array(1) { - [0]=> - int(1) - } - [1]=> - array(1) { - [0]=> - int(2) - } -} - --- Iteration 16 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_chunk() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: array_chunk() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_chunk_variation3.phpt b/ext/standard/tests/array/array_chunk_variation3.phpt deleted file mode 100644 index 228490e442..0000000000 --- a/ext/standard/tests/array/array_chunk_variation3.phpt +++ /dev/null @@ -1,268 +0,0 @@ ---TEST-- -Test array_chunk() function : usage variations - unexpected values for 'preserve_keys' ---FILE-- -<?php -/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys]) - * Description: Split array into chunks - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_chunk() function with unexpected values for 'preserve_keys' -*/ - -echo "*** Testing array_chunk() : usage variations ***\n"; - -// input array -$input = array(1, 2); -$size = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // empty data -/*12*/ "", - '', - - // string data -/*14*/ "string", - 'string', - - // object data -/*16*/ new stdclass(), - - // undefined data -/*17*/ @$undefined_var, - - // unset data -/*18*/ @$unset_var - -); - -$count = 1; - -// loop through each element of the array for preserve_keys -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump( array_chunk($input, $size, $value) ); - $count++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_chunk() : usage variations *** - --- Iteration 1 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 2 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 3 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 4 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 5 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 6 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 7 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 8 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 9 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 10 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 11 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 12 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 13 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 14 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 15 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 16 -- - -Warning: array_chunk() expects parameter 3 to be bool, object given in %s on line %d -NULL - --- Iteration 17 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} - --- Iteration 18 -- -array(1) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -Done diff --git a/ext/standard/tests/array/array_combine_variation1.phpt b/ext/standard/tests/array/array_combine_variation1.phpt deleted file mode 100644 index f9978f5476..0000000000 --- a/ext/standard/tests/array/array_combine_variation1.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test array_combine() function : usage variations - unexpected values for 'keys' argument ---FILE-- -<?php -/* Prototype : array array_combine(array $keys, array $values) - * Description: Creates an array by using the elements of the first parameter as keys - * and the elements of the second as the corresponding values - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_combine() function by passing values to $keys argument other than arrays -* and see that function emits proper warning messages wherever expected. -* The $values argument passed is a fixed array. -*/ - -echo "*** Testing array_combine() : Passing non-array values to \$keys argument ***\n"; - -// Initialise $values argument -$values = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $keys argument -$keys_passed = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element within $keys_passed to check the behavior of array_combine() -$iterator = 1; -foreach($keys_passed as $keys) { - echo "-- Iteration $iterator --\n"; - var_dump( array_combine($keys,$values) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_combine() : Passing non-array values to $keys argument *** --- Iteration 1 -- - -Warning: array_combine() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_combine() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_combine() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_combine() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_combine() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_combine() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_combine() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_combine() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_combine() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_combine() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_combine() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_combine() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_combine() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_combine() expects parameter 1 to be array, object given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 24 -- - -Warning: array_combine() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_combine_variation2.phpt b/ext/standard/tests/array/array_combine_variation2.phpt deleted file mode 100644 index 2d888df694..0000000000 --- a/ext/standard/tests/array/array_combine_variation2.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test array_combine() function : usage variations - unexpected values for 'values' argument ---FILE-- -<?php -/* Prototype : array array_combine(array $keys, array $values) - * Description: Creates an array by using the elements of the first parameter as keys - * and the elements of the second as the corresponding values - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_combine() function by passing values to $values argument other than arrays -* and see that function emits proper warning messages wherever expected. -* The $keys argument passed is a fixed array. -*/ - -echo "*** Testing array_combine() : Passing non-array values to \$values argument ***\n"; - -// Initialize $keys array -$keys = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $values argument -$values_passed = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element within $values_passed to check the behavior of array_combine() -$iterator = 1; -foreach($values_passed as $values) { - echo "-- Iteration $iterator --\n"; - var_dump( array_combine($keys,$values) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_combine() : Passing non-array values to $values argument *** --- Iteration 1 -- - -Warning: array_combine() expects parameter 2 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_combine() expects parameter 2 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_combine() expects parameter 2 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_combine() expects parameter 2 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_combine() expects parameter 2 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_combine() expects parameter 2 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_combine() expects parameter 2 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_combine() expects parameter 2 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_combine() expects parameter 2 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_combine() expects parameter 2 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_combine() expects parameter 2 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_combine() expects parameter 2 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_combine() expects parameter 2 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_combine() expects parameter 2 to be array, object given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d -NULL --- Iteration 24 -- - -Warning: array_combine() expects parameter 2 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_fill_variation1.phpt b/ext/standard/tests/array/array_fill_variation1.phpt deleted file mode 100644 index f3bdef1b61..0000000000 --- a/ext/standard/tests/array/array_fill_variation1.phpt +++ /dev/null @@ -1,244 +0,0 @@ ---TEST-- -Test array_fill() function : usage variations - unexpected values for 'start_key' argument ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); -?> ---FILE-- -<?php -/* Prototype : proto array array_fill(int start_key, int num, mixed val) - * Description: Create an array containing num elements starting with index start_key each initialized to val - * Source code: ext/standard/array.c - */ - -/* - * testing array_fill() by passing different unexpected value for 'start_key' argument - */ - -echo "*** Testing array_fill() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$num = 2; -$val = 100; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//define a class -class test -{ - var $t = 10; - function __toString() - { - return "testObject"; - } -} - - -//array of different values for 'start_key' argument -$values = array( - - // float values - /* 1 */ 10.5, - -10.5, - 12.3456789000e10, - 12.34567890006E-10, - .5, - - // array values - /* 6 */ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null values - /* 11 */ NULL, - null, - - // boolean values - /* 13 */ true, - false, - TRUE, - FALSE, - - // empty string - /* 17 */ "", - '', - - // string values - /* 19 */ "string", - 'string', - - // objects - /* 21 */ new test(), - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var, - - // resource variable - /* 24 */ $fp -); - -// loop through each element of the array for start_key -// check the working of array_fill() -echo "--- Testing array_fill() with different values for 'start_key' arg ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) -{ - echo "-- Iteration $counter --\n"; - $start_key = $values[$index]; - - var_dump( array_fill($start_key,$num,$val) ); - - $counter ++; -} - -// close the resource used -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_fill() : usage variations *** ---- Testing array_fill() with different values for 'start_key' arg --- --- Iteration 1 -- -array(2) { - [10]=> - int(100) - [11]=> - int(100) -} --- Iteration 2 -- -array(2) { - [-10]=> - int(100) - [0]=> - int(100) -} --- Iteration 3 -- - -Warning: array_fill() expects parameter 1 to be int, float given in %s%eext%estandard%etests%earray%earray_fill_variation1.php on line 92 -NULL --- Iteration 4 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 5 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 6 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 7 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 8 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 9 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 10 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 11 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 12 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 13 -- -array(2) { - [1]=> - int(100) - [2]=> - int(100) -} --- Iteration 14 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 15 -- -array(2) { - [1]=> - int(100) - [2]=> - int(100) -} --- Iteration 16 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 17 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 18 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 19 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 20 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 21 -- - -Warning: array_fill() expects parameter 1 to be int, object given in %sarray_fill_variation1.php on line %d -NULL --- Iteration 22 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 23 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 24 -- - -Warning: array_fill() expects parameter 1 to be int, resource given in %sarray_fill_variation1.php on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_fill_variation1_64bit.phpt b/ext/standard/tests/array/array_fill_variation1_64bit.phpt deleted file mode 100644 index ba3a70c482..0000000000 --- a/ext/standard/tests/array/array_fill_variation1_64bit.phpt +++ /dev/null @@ -1,247 +0,0 @@ ---TEST-- -Test array_fill() function : usage variations - unexpected values for 'start_key' argument ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); -?> ---FILE-- -<?php -/* Prototype : proto array array_fill(int start_key, int num, mixed val) - * Description: Create an array containing num elements starting with index start_key each initialized to val - * Source code: ext/standard/array.c - */ - -/* - * testing array_fill() by passing different unexpected value for 'start_key' argument - */ - -echo "*** Testing array_fill() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$num = 2; -$val = 100; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//define a class -class test -{ - var $t = 10; - function __toString() - { - return "testObject"; - } -} - - -//array of different values for 'start_key' argument -$values = array( - - // float values - /* 1 */ 10.5, - -10.5, - 12.3456789000e10, - 12.34567890006E-10, - .5, - - // array values - /* 6 */ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null values - /* 11 */ NULL, - null, - - // boolean values - /* 13 */ true, - false, - TRUE, - FALSE, - - // empty string - /* 17 */ "", - '', - - // string values - /* 19 */ "string", - 'string', - - // objects - /* 21 */ new test(), - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var, - - // resource variable - /* 24 */ $fp -); - -// loop through each element of the array for start_key -// check the working of array_fill() -echo "--- Testing array_fill() with different values for 'start_key' arg ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) -{ - echo "-- Iteration $counter --\n"; - $start_key = $values[$index]; - - var_dump( array_fill($start_key,$num,$val) ); - - $counter ++; -} - -// close the resource used -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_fill() : usage variations *** ---- Testing array_fill() with different values for 'start_key' arg --- --- Iteration 1 -- -array(2) { - [10]=> - int(100) - [11]=> - int(100) -} --- Iteration 2 -- -array(2) { - [-10]=> - int(100) - [0]=> - int(100) -} --- Iteration 3 -- -array(2) { - [123456789000]=> - int(100) - [123456789001]=> - int(100) -} --- Iteration 4 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 5 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 6 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_fill() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 11 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 12 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 13 -- -array(2) { - [1]=> - int(100) - [2]=> - int(100) -} --- Iteration 14 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 15 -- -array(2) { - [1]=> - int(100) - [2]=> - int(100) -} --- Iteration 16 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 17 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_fill() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_fill() expects parameter 1 to be int, object given in %s on line %d -NULL --- Iteration 22 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 23 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 24 -- - -Warning: array_fill() expects parameter 1 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_fill_variation2.phpt b/ext/standard/tests/array/array_fill_variation2.phpt deleted file mode 100644 index 1209aea44d..0000000000 --- a/ext/standard/tests/array/array_fill_variation2.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test array_fill() function : usage variations - unexpected values for 'num' argument ---FILE-- -<?php -/* Prototype : proto array array_fill(int start_key, int num, mixed val) - * Description: Create an array containing num elements starting with index start_key each initialized to val - * Source code: ext/standard/array.c - */ - -/* - * testing array_fill() by passing different unexpected values for 'num' argument - */ - -echo "*** Testing array_fill() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$start_key = 0; -$val = 100; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//define a class -class test -{ - var $t = 10; - function __toString() - { - return "testObject"; - } -} - - -//array of different values for 'num' argument -$values = array( - - // float values - /* 1 */ 2.5, - -2.5, - 0.5e1, - 0.5E-1, - .5, - - // array values - /* 6 */ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null values - /* 11 */ NULL, - null, - - // boolean values - /* 13 */ true, - false, - TRUE, - FALSE, - - // empty string - /* 17 */ "", - '', - - // string values - /* 19 */ "string", - 'string', - - // objects - /* 21 */ new test(), - - // undefined variable - @$undefined_var, - - // unset variable - /* 24 */ @$unset_var, - -); - -// loop through each element of the array for num -// check the working of array_fill -echo "--- Testing array_fill() with different values for 'num' arg ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) -{ - echo "-- Iteration $counter --\n"; - $num = $values[$index]; - - var_dump( array_fill($start_key,$num,$val) ); - - $counter ++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_fill() : usage variations *** ---- Testing array_fill() with different values for 'num' arg --- --- Iteration 1 -- -array(2) { - [0]=> - int(100) - [1]=> - int(100) -} --- Iteration 2 -- - -Warning: array_fill(): Number of elements can't be negative in %s on line %d -bool(false) --- Iteration 3 -- -array(5) { - [0]=> - int(100) - [1]=> - int(100) - [2]=> - int(100) - [3]=> - int(100) - [4]=> - int(100) -} --- Iteration 4 -- -array(0) { -} --- Iteration 5 -- -array(0) { -} --- Iteration 6 -- - -Warning: array_fill() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_fill() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_fill() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_fill() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_fill() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- -array(0) { -} --- Iteration 12 -- -array(0) { -} --- Iteration 13 -- -array(1) { - [0]=> - int(100) -} --- Iteration 14 -- -array(0) { -} --- Iteration 15 -- -array(1) { - [0]=> - int(100) -} --- Iteration 16 -- -array(0) { -} --- Iteration 17 -- - -Warning: array_fill() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_fill() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_fill() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_fill() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_fill() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 22 -- -array(0) { -} --- Iteration 23 -- -array(0) { -} -Done diff --git a/ext/standard/tests/array/array_filter_variation1.phpt b/ext/standard/tests/array/array_filter_variation1.phpt deleted file mode 100644 index f75b03cbed..0000000000 --- a/ext/standard/tests/array/array_filter_variation1.phpt +++ /dev/null @@ -1,195 +0,0 @@ ---TEST-- -Test array_filter() function : usage variations - Unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : array array_filter(array $input [, callback $callback]) - * Description: Filters elements from the array via the callback. - * Source code: ext/standard/array.c -*/ - -/* Passing different scalar and nonscalar values for 'input' argument -*/ -echo "*** Testing array_filter() : usage variations - unexpected values for 'input'***\n"; - -/* Callback function - * Prototype : bool always_true(array $input) - * Parameters : array for which each elements needs to be used in function - * Return value : Returns true for each element - * Discription : function applied to each element of the passed array and returns true - */ -function always_true($input) -{ - return true; -} - - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// class definition for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -// resource variable -$fp = fopen(__FILE__, 'r'); - -// different values for 'input' argument -$input_values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new MyClass(), - - // resource data - $fp, - - // undefined data - @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of the array for input -for($count = 0; $count < count($input_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_filter($input_values[$count],"always_true") ); -}; - -// closing resource -fclose($fp); - -echo "Done" -?> ---EXPECTF-- -*** Testing array_filter() : usage variations - unexpected values for 'input'*** --- Iteration 1 -- - -Warning: array_filter() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_filter() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_filter() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_filter() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_filter() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_filter() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_filter() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_filter() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_filter() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_filter() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_filter() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_filter() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_filter() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_filter() expects parameter 1 to be array, object given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_filter() expects parameter 1 to be array, resource given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_filter() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_filter_variation2.phpt b/ext/standard/tests/array/array_filter_variation2.phpt deleted file mode 100644 index d47761f470..0000000000 --- a/ext/standard/tests/array/array_filter_variation2.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test array_filter() function : usage variations - Unexpected values for 'callback' function argument ---FILE-- -<?php -/* Prototype : array array_filter(array $input [, callback $callback]) - * Description: Filters elements from the array via the callback. - * Source code: ext/standard/array.c -*/ - -/* Passing different scalar and nonscalar values in place of 'callback' argument -*/ -echo "*** Testing array_filter() : usage variations - unexpected values for 'callback' function***\n"; - -// Initialise variables -$input = array('value1', 'value2', 'value3', 'value4'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// class definition for object variable -class MyClass -{ - public function __toString() - { - return 'object'; - } -} - -// resource variable -$fp = fopen(__FILE__, 'r'); - -// different scalar and nonscalar values in place of callback function -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // string data -/*23*/ "string", - 'string', - - // object data -/*25*/ new MyClass(), - - // resource data - $fp, - - // undefined data - @$undefined_var, - - // unset data -/*28*/ @$unset_var, -); - -// loop through each element of the 'values' for callback -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count + 1)." --"; - var_dump( array_filter($input, $values[$count]) ); -}; - -// closing resource -fclose($fp); - -echo "Done" -?> ---EXPECTF-- -*** Testing array_filter() : usage variations - unexpected values for 'callback' function*** --- Iteration 1 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 2 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 3 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 4 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 5 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 6 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 7 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 8 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 9 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 10 -- -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 11 -- -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 12 -- -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 13 -- -Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL --- Iteration 14 -- -Warning: array_filter() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL --- Iteration 15 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 16 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 17 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 18 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 19 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 20 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 21 -- -Warning: array_filter() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 22 -- -Warning: array_filter() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 23 -- -Warning: array_filter() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d -NULL --- Iteration 24 -- -Warning: array_filter() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d -NULL --- Iteration 25 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 26 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 27 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 28 -- -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_flip_variation1.phpt b/ext/standard/tests/array/array_flip_variation1.phpt deleted file mode 100644 index 98aa459362..0000000000 --- a/ext/standard/tests/array/array_flip_variation1.phpt +++ /dev/null @@ -1,179 +0,0 @@ ---TEST-- -Test array_flip() function : usage variations - unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : array array_flip(array $input) - * Description: Return array with key <-> value flipped - * Source code: ext/standard/array.c -*/ - -echo "*** Testing array_flip() : usage variations - unexpected values for 'input' ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//class definition for object variable -class MyClass -{ - public function __toString() - { - return 'object'; - } -} - -//resource variable -$fp = fopen(__FILE__,'r'); - -//array of values for 'input' argument -$values = array( - // int data - /*1*/ 0, - 1, - 12345, - -2345, - - // float data - /*5*/ 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // null data - /*10*/ NULL, - null, - - // boolean data - /*12*/ true, - false, - TRUE, - /*15*/ FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - /*20*/ new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - /*23*/ $fp -); - -// loop through each element of $values for 'input' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count + 1). " --\n"; - var_dump( array_flip($values[$count]) ); -}; - -//closing resource -fclose($fp); - -echo "Done" -?> ---EXPECTF-- -*** Testing array_flip() : usage variations - unexpected values for 'input' *** --- Iteration 1 -- - -Warning: array_flip() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_flip() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_flip() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_flip() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_flip() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_flip() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_flip() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_flip() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_flip() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_flip() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_flip() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_flip() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_flip() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_flip() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_flip() expects parameter 1 to be array, object given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_flip() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_flip() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt deleted file mode 100644 index b1e3033002..0000000000 --- a/ext/standard/tests/array/array_key_exists_variation2.phpt +++ /dev/null @@ -1,224 +0,0 @@ ---TEST-- -Test array_key_exists() function : usage variations - Pass different data types to $search arg ---FILE-- -<?php -/* Prototype : bool array_key_exists(mixed $key, array $search) - * Description: Checks if the given key or index exists in the array - * Source code: ext/standard/array.c - * Alias to functions: key_exists - */ - -/* - * Pass different data types as $search argument to array_key_exists() to test behaviour - */ - -echo "*** Testing array_key_exists() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$key = 'val'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $search argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of array_key_exists() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_key_exists($key, $input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_key_exists() : usage variations *** - --- Iteration 1 -- - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_key_exists() expects parameter 2 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_map_variation18.phpt b/ext/standard/tests/array/array_map_variation18.phpt deleted file mode 100644 index 4c85d12e88..0000000000 --- a/ext/standard/tests/array/array_map_variation18.phpt +++ /dev/null @@ -1,205 +0,0 @@ ---TEST-- -Test array_map() function : usage variations - unexpected values for 'arr1' argument ---FILE-- -<?php -/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] ) - * Description: Applies the callback to the elements of the given arrays - * Source code: ext/standard/array.c - */ - -/* - * Test array_map() by passing non array values in place of $arr1 - */ - -echo "*** Testing array_map() : unexpected values for 'arr1' ***\n"; - -function callback($a) -{ - return $a; -} - -//get an unset array variable -$unset_var1 = array(1, 2); -unset ($unset_var1); - -// get an unset variable -$unset_var2 = 10; -unset ($unset_var2); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// different scalar/non-scalar values for array input -$unexpected_inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var1, - @$unset_var2, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $unexpected_inputs to check the behavior of array_map -for($count = 0; $count < count($unexpected_inputs); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_map('callback', $unexpected_inputs[$count])); -}; - -fclose($fp); -echo "Done"; -?> ---EXPECTF-- -*** Testing array_map() : unexpected values for 'arr1' *** --- Iteration 1 -- - -Warning: array_map(): Expected parameter 2 to be an array, int given in %s on line %d%d -NULL --- Iteration 2 -- - -Warning: array_map(): Expected parameter 2 to be an array, int given in %s on line %d%d -NULL --- Iteration 3 -- - -Warning: array_map(): Expected parameter 2 to be an array, int given in %s on line %d%d -NULL --- Iteration 4 -- - -Warning: array_map(): Expected parameter 2 to be an array, int given in %s on line %d%d -NULL --- Iteration 5 -- - -Warning: array_map(): Expected parameter 2 to be an array, float given in %s on line %d%d -NULL --- Iteration 6 -- - -Warning: array_map(): Expected parameter 2 to be an array, float given in %s on line %d%d -NULL --- Iteration 7 -- - -Warning: array_map(): Expected parameter 2 to be an array, float given in %s on line %d%d -NULL --- Iteration 8 -- - -Warning: array_map(): Expected parameter 2 to be an array, float given in %s on line %d%d -NULL --- Iteration 9 -- - -Warning: array_map(): Expected parameter 2 to be an array, float given in %s on line %d%d -NULL --- Iteration 10 -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d%d -NULL --- Iteration 11 -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d%d -NULL --- Iteration 12 -- - -Warning: array_map(): Expected parameter 2 to be an array, bool given in %s on line %d%d -NULL --- Iteration 13 -- - -Warning: array_map(): Expected parameter 2 to be an array, bool given in %s on line %d%d -NULL --- Iteration 14 -- - -Warning: array_map(): Expected parameter 2 to be an array, bool given in %s on line %d%d -NULL --- Iteration 15 -- - -Warning: array_map(): Expected parameter 2 to be an array, bool given in %s on line %d%d -NULL --- Iteration 16 -- - -Warning: array_map(): Expected parameter 2 to be an array, string given in %s on line %d%d -NULL --- Iteration 17 -- - -Warning: array_map(): Expected parameter 2 to be an array, string given in %s on line %d%d -NULL --- Iteration 18 -- - -Warning: array_map(): Expected parameter 2 to be an array, string given in %s on line %d%d -NULL --- Iteration 19 -- - -Warning: array_map(): Expected parameter 2 to be an array, string given in %s on line %d%d -NULL --- Iteration 20 -- - -Warning: array_map(): Expected parameter 2 to be an array, string given in %s on line %d%d -NULL --- Iteration 21 -- - -Warning: array_map(): Expected parameter 2 to be an array, object given in %s on line %d%d -NULL --- Iteration 22 -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d%d -NULL --- Iteration 23 -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d%d -NULL --- Iteration 24 -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d%d -NULL --- Iteration 25 -- - -Warning: array_map(): Expected parameter 2 to be an array, resource given in %s on line %d%d -NULL -Done diff --git a/ext/standard/tests/array/array_pad_variation1.phpt b/ext/standard/tests/array/array_pad_variation1.phpt deleted file mode 100644 index b806139d57..0000000000 --- a/ext/standard/tests/array/array_pad_variation1.phpt +++ /dev/null @@ -1,270 +0,0 @@ ---TEST-- -Test array_pad() function : usage variations - unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value) - * Description: Returns a copy of input array padded with pad_value to size pad_size - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_pad() function by passing values to $input argument other than arrays -* and see that function outputs proper warning messages wherever expected. -* The $pad_size and $pad_value arguments passed are fixed values. -*/ - -echo "*** Testing array_pad() : passing non array values to \$input argument ***\n"; - -// Initialise $pad_size and $pad_value -$pad_size = 10; -$pad_value = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $input argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of array_pad() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --"; - var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size' - var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size' - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_pad() : passing non array values to $input argument *** - --- Iteration 1 -- -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 19 -- -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- -Warning: array_pad() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 22 -- -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 23 -- -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- -Warning: array_pad() expects parameter 1 to be array, resource given in %s on line %d -NULL - -Warning: array_pad() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_pad_variation2.phpt b/ext/standard/tests/array/array_pad_variation2.phpt deleted file mode 100644 index c95303974d..0000000000 --- a/ext/standard/tests/array/array_pad_variation2.phpt +++ /dev/null @@ -1,258 +0,0 @@ ---TEST-- -Test array_pad() function : usage variations - unexpected values for 'pad_size' argument(Bug#43482) ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value) - * Description: Returns a copy of input array padded with pad_value to size pad_size - * Source code: ext/standard/array.c -*/ - -/* -* Testing array_pad() function by passing values to $pad_size argument other than integers -* and see that function outputs proper warning messages wherever expected. -* The $input and $pad_value arguments passed are fixed values. -*/ - -echo "*** Testing array_pad() : passing non integer values to \$pad_size argument ***\n"; - -// Initialise $input and $pad_value arguments -$input = array(1, 2); -$pad_value = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -//array of values to iterate over -$pad_sizes = array( - - // float data -/*1*/ 10.5, - -10.5, - 12.3456789000e10, - -12.3456789000e10, - 12.3456789000E-10, - .5, - - // array data -/*6*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - - // string data -/*19*/ "string", - 'string', - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $pad_sizes to check the behavior of array_pad() -$iterator = 1; -foreach($pad_sizes as $pad_size) { - echo "-- Iteration $iterator --\n"; - var_dump( array_pad($input, $pad_size, $pad_value) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_pad() : passing non integer values to $pad_size argument *** --- Iteration 1 -- -array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(1) - [3]=> - int(1) - [4]=> - int(1) - [5]=> - int(1) - [6]=> - int(1) - [7]=> - int(1) - [8]=> - int(1) - [9]=> - int(1) -} --- Iteration 2 -- -array(10) { - [0]=> - int(1) - [1]=> - int(1) - [2]=> - int(1) - [3]=> - int(1) - [4]=> - int(1) - [5]=> - int(1) - [6]=> - int(1) - [7]=> - int(1) - [8]=> - int(1) - [9]=> - int(2) -} --- Iteration 3 -- - -Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d -bool(false) --- Iteration 5 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 6 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 7 -- - -Warning: array_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 12 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 13 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 14 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 15 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 16 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 17 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 18 -- - -Warning: array_pad() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_pad() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_pad() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_pad() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_pad() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 23 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} --- Iteration 24 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} -Done diff --git a/ext/standard/tests/array/array_product_variation5.phpt b/ext/standard/tests/array/array_product_variation5.phpt deleted file mode 100644 index 09284d9096..0000000000 --- a/ext/standard/tests/array/array_product_variation5.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test array_product() function : usage variation ---FILE-- -<?php -/* Prototype : mixed array_product(array input) - * Description: Returns the product of the array entries - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_product() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for input - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_product($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_product() : usage variation *** - ---int 0-- - -Warning: array_product() expects parameter 1 to be array, int given in %sarray_product_variation5.php on line %d -NULL - ---int 1-- - -Warning: array_product() expects parameter 1 to be array, int given in %sarray_product_variation5.php on line %d -NULL - ---int 12345-- - -Warning: array_product() expects parameter 1 to be array, int given in %sarray_product_variation5.php on line %d -NULL - ---int -12345-- - -Warning: array_product() expects parameter 1 to be array, int given in %sarray_product_variation5.php on line %d -NULL - ---float 10.5-- - -Warning: array_product() expects parameter 1 to be array, float given in %sarray_product_variation5.php on line %d -NULL - ---float -10.5-- - -Warning: array_product() expects parameter 1 to be array, float given in %sarray_product_variation5.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_product() expects parameter 1 to be array, float given in %sarray_product_variation5.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_product() expects parameter 1 to be array, float given in %sarray_product_variation5.php on line %d -NULL - ---float .5-- - -Warning: array_product() expects parameter 1 to be array, float given in %sarray_product_variation5.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d -NULL - ---lowercase null-- - -Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d -NULL - ---lowercase true-- - -Warning: array_product() expects parameter 1 to be array, bool given in %sarray_product_variation5.php on line %d -NULL - ---lowercase false-- - -Warning: array_product() expects parameter 1 to be array, bool given in %sarray_product_variation5.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_product() expects parameter 1 to be array, bool given in %sarray_product_variation5.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_product() expects parameter 1 to be array, bool given in %sarray_product_variation5.php on line %d -NULL - ---empty string DQ-- - -Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d -NULL - ---empty string SQ-- - -Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d -NULL - ---string DQ-- - -Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d -NULL - ---string SQ-- - -Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d -NULL - ---mixed case string-- - -Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d -NULL - ---heredoc-- - -Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_variation5.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_product() expects parameter 1 to be array, object given in %sarray_product_variation5.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_product() expects parameter 1 to be array, object given in %sarray_product_variation5.php on line %d -NULL - ---undefined var-- - -Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d -NULL - ---unset var-- - -Warning: array_product() expects parameter 1 to be array, null given in %sarray_product_variation5.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_push_empty.phpt b/ext/standard/tests/array/array_push_empty.phpt index 7ca7e7fdd2..d302159a59 100644 --- a/ext/standard/tests/array/array_push_empty.phpt +++ b/ext/standard/tests/array/array_push_empty.phpt @@ -16,7 +16,7 @@ var_dump( $array ); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- int(3) int(3) array(3) { diff --git a/ext/standard/tests/array/array_push_variation1.phpt b/ext/standard/tests/array/array_push_variation1.phpt deleted file mode 100644 index c04cf4073f..0000000000 --- a/ext/standard/tests/array/array_push_variation1.phpt +++ /dev/null @@ -1,225 +0,0 @@ ---TEST-- -Test array_push() function : usage variations - Pass different data types as $stack arg ---FILE-- -<?php -/* Prototype : int array_push(array $stack, mixed $var [, mixed $...]) - * Description: Pushes elements onto the end of the array - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $stack argument to array_push() to test behaviour - */ - -echo "*** Testing array_push() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$var = 'value'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $stack argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of array_push() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_push($input, $var) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_push() : usage variations *** - --- Iteration 1 -- - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_push() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_push() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_push() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_push() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_push() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_push() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_push() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_push() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_push() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_push() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_push() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -int(1) - --- Iteration 19 -- - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_push() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_push() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_push() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_push() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_rand_variation1.phpt b/ext/standard/tests/array/array_rand_variation1.phpt deleted file mode 100644 index 7aaf48f99f..0000000000 --- a/ext/standard/tests/array/array_rand_variation1.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test array_rand() function : usage variations - unexpected values for 'input' parameter ---FILE-- -<?php -/* Prototype : mixed array_rand(array input [, int num_req]) - * Description: Return key/keys for random entry/entries in the array - * Source code: ext/standard/array.c -*/ - -/* -* Test array_rand() with different types of values other than arrays passed to the 'input' parameter -* to see that function works with unexpeced data and generates warning message as required. -*/ - -echo "*** Testing array_rand() : unexpected values for 'input' parameter ***\n"; - -// Initialise function arguments -$num_req = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//define a class -class test -{ - var $t = 10; - function __toString() - { - return "object"; - } -} - -//array of different values for 'input' parameter -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new test(), - - // resource data -/*21*/ $fp, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -/* loop through each element of the array to test array_rand() function - * for different values for 'input' argument -*/ -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump( array_rand($value,$num_req) ); - $count++; -}; - -// closing the resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_rand() : unexpected values for 'input' parameter *** - --- Iteration 1 -- - -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_rand() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_rand() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_rand() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_rand() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_rand() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_rand() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_rand() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_rand() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_rand() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_rand() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_rand() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_rand() expects parameter 1 to be array, resource given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_rand() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_rand_variation2.phpt b/ext/standard/tests/array/array_rand_variation2.phpt deleted file mode 100644 index 1182d1aeea..0000000000 --- a/ext/standard/tests/array/array_rand_variation2.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test array_rand() function : usage variations - unexpected values for 'num_req' parameter ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : mixed array_rand(array input [, int num_req]) - * Description: Return key/keys for random entry/entries in the array - * Source code: ext/standard/array.c -*/ - -/* -* Test array_rand() with different types of values other than int passed to 'num_req' argument -* to see that function works with unexpeced data and generates warning message as required. -*/ - -echo "*** Testing array_rand() : unexpected values for 'num_req' parameter ***\n"; - -// Initialise function arguments -$input = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//define a class -class test -{ - var $t = 10; - function __toString() - { - return "3object"; - } -} - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new test(), - - // undefined data -/*21*/ @$undefined_var, - - // unset data -/*22*/ @$unset_var, -); - - -// loop through each element of the array for different values for 'num_req' argument -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump( array_rand($input,$value) ); - $count++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_rand() : unexpected values for 'num_req' parameter *** - --- Iteration 1 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 2 -- -int(%d) - --- Iteration 3 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 5 -- -array(10) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) -} - --- Iteration 6 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 12 -- -int(%d) - --- Iteration 13 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 14 -- -int(%d) - --- Iteration 15 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_rand() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_reverse_variation1.phpt b/ext/standard/tests/array/array_reverse_variation1.phpt deleted file mode 100644 index b2936c171c..0000000000 --- a/ext/standard/tests/array/array_reverse_variation1.phpt +++ /dev/null @@ -1,340 +0,0 @@ ---TEST-- -Test array_reverse() function : usage variations - unexpected values for 'array' argument ---FILE-- -<?php -/* Prototype : array array_reverse(array $array [, bool $preserve_keys]) - * Description: Return input as a new array with the order of the entries reversed - * Source code: ext/standard/array.c -*/ - -echo "*** Testing array_reverse() : usage variations - unexpected values for 'array' argument ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//get a class -class classA -{ - public function __toString(){ - return "Class A object"; - } -} - -//get a heredoc string -$heredoc_string = <<<EOT -Hello world\t\n -EOT; - -//array of values to iterate over -$arrays = array ( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data - 'Hello world', - "Hello world", - $heredoc_string, - - // object data -/*21*/ new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable -/*24*/ $fp - -); - -// loop through each element of the array $arrays to check the behavior of array_reverse() -$iterator = 1; -foreach($arrays as $array) { - echo "\n-- Iteration $iterator --"; - // with default argument - var_dump( array_reverse($array) ); - // with all possible arguments - var_dump( array_reverse($array, true) ); - var_dump( array_reverse($array, false) ); - $iterator++; -}; - -// close the file resource used -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_reverse() : usage variations - unexpected values for 'array' argument *** - --- Iteration 1 -- -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 19 -- -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- -Warning: array_reverse() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 22 -- -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 23 -- -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- -Warning: array_reverse() expects parameter 1 to be array, resource given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, resource given in %s on line %d -NULL - -Warning: array_reverse() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_reverse_variation2.phpt b/ext/standard/tests/array/array_reverse_variation2.phpt deleted file mode 100644 index 1cc9a3088e..0000000000 --- a/ext/standard/tests/array/array_reverse_variation2.phpt +++ /dev/null @@ -1,414 +0,0 @@ ---TEST-- -Test array_reverse() function : usage variations - unexpected values for 'preserve_keys' argument ---FILE-- -<?php -/* Prototype : array array_reverse(array $array [, bool $preserve_keys]) - * Description: Return input as a new array with the order of the entries reversed - * Source code: ext/standard/array.c -*/ - -/* - * testing the functionality of array_reverse() by giving unexpected values for $preserve_keys argument -*/ - -echo "*** Testing array_reverse() : usage variations ***\n"; - -// Initialise the array -$array = array("a" => "green", "red", "blue", "red", "orange", "pink"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//get a class -class classA -{ - public function __toString(){ - return "Class A object"; - } -} - -//array of values to iterate over -$preserve_keys = array ( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ - "", - '', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable -/*26*/ $fp - -); - -// loop through each element of the array $preserve_keys to check the behavior of array_reverse() -$iterator = 1; -foreach($preserve_keys as $preserve_key) { - echo "-- Iteration $iterator --\n"; - var_dump( array_reverse($array, $preserve_key) ); - $iterator++; -}; - -// close the file resouce used -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_reverse() : usage variations *** --- Iteration 1 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 2 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 3 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 4 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 5 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 6 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 7 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 8 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 9 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 10 -- - -Warning: array_reverse() expects parameter 2 to be bool, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_reverse() expects parameter 2 to be bool, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_reverse() expects parameter 2 to be bool, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_reverse() expects parameter 2 to be bool, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_reverse() expects parameter 2 to be bool, array given in %s on line %d -NULL --- Iteration 15 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 16 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 17 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 18 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 19 -- -array(6) { - [4]=> - string(4) "pink" - [3]=> - string(6) "orange" - [2]=> - string(3) "red" - [1]=> - string(4) "blue" - [0]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 20 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 21 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 22 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 23 -- - -Warning: array_reverse() expects parameter 2 to be bool, object given in %s on line %d -NULL --- Iteration 24 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 25 -- -array(6) { - [0]=> - string(4) "pink" - [1]=> - string(6) "orange" - [2]=> - string(3) "red" - [3]=> - string(4) "blue" - [4]=> - string(3) "red" - ["a"]=> - string(5) "green" -} --- Iteration 26 -- - -Warning: array_reverse() expects parameter 2 to be bool, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_shift_variation1.phpt b/ext/standard/tests/array/array_shift_variation1.phpt deleted file mode 100644 index 5734da4fb9..0000000000 --- a/ext/standard/tests/array/array_shift_variation1.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test array_shift() function : usage variations - Pass different data types as $stack arg ---FILE-- -<?php -/* Prototype : mixed array_shift(array &$stack) - * Description: Pops an element off the beginning of the array - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $stack argument to array_shift() to test behaviour - */ - -echo "*** Testing array_shift() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $stack argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of array_shift() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_shift($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_shift() : usage variations *** - --- Iteration 1 -- - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_shift() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_shift() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_shift() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_shift() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_shift() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_shift() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_shift() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_shift() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_shift() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_shift() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_shift() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_shift() expects parameter 1 to be array, resource given in %s on line 85 -NULL -Done diff --git a/ext/standard/tests/array/array_slice_variation4.phpt b/ext/standard/tests/array/array_slice_variation4.phpt deleted file mode 100644 index 6591e113af..0000000000 --- a/ext/standard/tests/array/array_slice_variation4.phpt +++ /dev/null @@ -1,326 +0,0 @@ ---TEST-- -Test array_slice() function : usage variations - Pass different data types as $preserve_keys arg ---FILE-- -<?php -/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) - * Description: Returns elements specified by offset and length - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $preserve_keys argument to array_slice() to test behaviour - */ - -echo "*** Testing array_slice() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$input_array = array('one' => 1, 2, 99 => 3, 4); -$offset = 0; -$length = 3; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed to $preserve_keys argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of array_slice() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_slice($input_array, $offset, $length, $input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_slice() : usage variations *** - --- Iteration 1 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 2 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 3 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 4 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 5 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 6 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 7 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 8 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 9 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 10 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 11 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 12 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 13 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 14 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 15 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 16 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 17 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 18 -- - -Warning: array_slice() expects parameter 4 to be bool, array given in %s on line %d -NULL - --- Iteration 19 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 20 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 21 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [99]=> - int(3) -} - --- Iteration 22 -- - -Warning: array_slice() expects parameter 4 to be bool, object given in %s on line %d -NULL - --- Iteration 23 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} - --- Iteration 24 -- -array(3) { - ["one"]=> - int(1) - [0]=> - int(2) - [1]=> - int(3) -} -Done diff --git a/ext/standard/tests/array/array_sum_variation1.phpt b/ext/standard/tests/array/array_sum_variation1.phpt deleted file mode 100644 index 30e2847004..0000000000 --- a/ext/standard/tests/array/array_sum_variation1.phpt +++ /dev/null @@ -1,179 +0,0 @@ ---TEST-- -Test array_sum() function : usage variations - unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : mixed array_sum(array $input) - * Description: Returns the sum of the array entries - * Source code: ext/standard/array.c -*/ - -/* -* Passing different scalar/nonscalar values as 'input' argument to array_sum() -*/ - -echo "*** Testing array_sum() : unexpected values for 'input' ***\n"; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// Class definition -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -// different scalar/non scalar values for 'input' argument -$input_values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new MyClass(), - - // resource data -/*21*/ $fp = fopen(__FILE__,'r'), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of the array for input -for($count = 0; $count < count($input_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_sum($input_values[$count]) ); -}; - -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing array_sum() : unexpected values for 'input' *** --- Iteration 1 -- - -Warning: array_sum() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_sum() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_sum() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_sum() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_sum() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_sum() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_sum() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_sum() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_sum() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_sum() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_sum() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_sum() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_sum() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_sum() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_sum() expects parameter 1 to be array, object given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_sum() expects parameter 1 to be array, resource given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_sum() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_unique_variation1.phpt b/ext/standard/tests/array/array_unique_variation1.phpt deleted file mode 100644 index cc9a695c86..0000000000 --- a/ext/standard/tests/array/array_unique_variation1.phpt +++ /dev/null @@ -1,195 +0,0 @@ ---TEST-- -Test array_unique() function : usage variations - unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : array array_unique(array $input) - * Description: Removes duplicate values from array - * Source code: ext/standard/array.c -*/ - -/* - * Passing non array values to 'input' argument of array_unique() and see - * that the function outputs proper warning messages wherever expected. -*/ - -echo "*** Testing array_unique() : Passing non array values to \$input argument ***\n"; - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $input argument -$inputs = array ( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs and check the behavior of array_unique() -$iterator = 1; -foreach($inputs as $input) { - echo "-- Iteration $iterator --\n"; - var_dump( array_unique($input) ); - $iterator++; -} - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_unique() : Passing non array values to $input argument *** --- Iteration 1 -- - -Warning: array_unique() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_unique() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_unique() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_unique() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_unique() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_unique() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_unique() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_unique() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_unique() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_unique() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_unique() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_unique() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_unique() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_unique() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_unique() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 24 -- - -Warning: array_unique() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_unshift_empty.phpt b/ext/standard/tests/array/array_unshift_empty.phpt index 546a24a98a..fde05c5d75 100644 --- a/ext/standard/tests/array/array_unshift_empty.phpt +++ b/ext/standard/tests/array/array_unshift_empty.phpt @@ -16,7 +16,7 @@ var_dump( $array ); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- int(3) int(3) array(3) { diff --git a/ext/standard/tests/array/array_unshift_variation1.phpt b/ext/standard/tests/array/array_unshift_variation1.phpt deleted file mode 100644 index f80fc0ebc6..0000000000 --- a/ext/standard/tests/array/array_unshift_variation1.phpt +++ /dev/null @@ -1,338 +0,0 @@ ---TEST-- -Test array_unshift() function : usage variations - unexpected values for 'array' argument ---FILE-- -<?php -/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...]) - * Description: Pushes elements onto the beginning of the array - * Source code: ext/standard/array.c -*/ - -/* - * Testing the behavior of array_unshift() by giving values - * other than array values for $array argument -*/ - -echo "*** Testing array_unshift() : unexpected values for \$array argument ***\n"; - -// Initialise $var argument -$var = 12; - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// array of unexpected values to be passed to $array argument -$arrays = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $arrays to test the functionality of array_unshift() -$iterator = 1; -foreach($arrays as $array) { - echo "\n-- Iteration $iterator --"; - - /* with default arguments */ - // returns element count in the resulting array after arguments are pushed to - // beginning of the given array - $temp_array = $array; - var_dump( array_unshift($temp_array, $var) ); - - // dump the resulting array - var_dump($temp_array); - - /* with optional arguments */ - // returns element count in the resulting array after arguments are pushed to - // beginning of the given array - $temp_array = $array; - var_dump( array_unshift($temp_array, $var, "hello", 'world') ); - - // dump the resulting array - var_dump($temp_array); - $iterator++; -}; - -// close the file resource used -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_unshift() : unexpected values for $array argument *** - --- Iteration 1 -- -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(0) - -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(0) - --- Iteration 2 -- -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(1) - -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(1) - --- Iteration 3 -- -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(12345) - -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(12345) - --- Iteration 4 -- -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(-2345) - -Warning: array_unshift() expects parameter 1 to be array, int given in %s on line %d -NULL -int(-2345) - --- Iteration 5 -- -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(10.5) - -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(10.5) - --- Iteration 6 -- -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(-10.5) - -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(-10.5) - --- Iteration 7 -- -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(123456789000) - -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(123456789000) - --- Iteration 8 -- -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(1.23456789E-9) - -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(1.23456789E-9) - --- Iteration 9 -- -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(0.5) - -Warning: array_unshift() expects parameter 1 to be array, float given in %s on line %d -NULL -float(0.5) - --- Iteration 10 -- -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - --- Iteration 11 -- -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - --- Iteration 12 -- -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(true) - -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(true) - --- Iteration 13 -- -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(false) - -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(false) - --- Iteration 14 -- -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(true) - -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(true) - --- Iteration 15 -- -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(false) - -Warning: array_unshift() expects parameter 1 to be array, bool given in %s on line %d -NULL -bool(false) - --- Iteration 16 -- -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(0) "" - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(0) "" - --- Iteration 17 -- -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(0) "" - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(0) "" - --- Iteration 18 -- -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(6) "string" - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(6) "string" - --- Iteration 19 -- -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(6) "string" - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(6) "string" - --- Iteration 20 -- -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(11) "hello world" - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -string(11) "hello world" - --- Iteration 21 -- -Warning: array_unshift() expects parameter 1 to be array, object given in %s on line %d -NULL -object(classA)#1 (0) { -} - -Warning: array_unshift() expects parameter 1 to be array, object given in %s on line %d -NULL -object(classA)#1 (0) { -} - --- Iteration 22 -- -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - --- Iteration 23 -- -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - -Warning: array_unshift() expects parameter 1 to be array, null given in %s on line %d -NULL -NULL - --- Iteration 24 -- -Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d -NULL -resource(%d) of type (stream) - -Warning: array_unshift() expects parameter 1 to be array, resource given in %s on line %d -NULL -resource(%d) of type (stream) -Done diff --git a/ext/standard/tests/array/array_values_variation1.phpt b/ext/standard/tests/array/array_values_variation1.phpt deleted file mode 100644 index 0ee93e2a12..0000000000 --- a/ext/standard/tests/array/array_values_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test array_values() function : usage variations - Pass different data types as $input arg ---FILE-- -<?php -/* Prototype : array array_values(array $input) - * Description: Return just the values from the input array - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $input argument to array_values() to test behaviour - */ - -echo "*** Testing array_values() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $input argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of array_values() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_values($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_values() : usage variations *** - --- Iteration 1 -- - -Warning: array_values() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_values() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_values() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_values() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_values() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_values() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_values() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_values() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_values() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_values() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_values() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_values() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_values() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_values() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_values() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_values() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_values() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -array(0) { -} - --- Iteration 19 -- - -Warning: array_values() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_values() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_values() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_values() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_values() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_values() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_values() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation1.phpt b/ext/standard/tests/array/array_walk_recursive_variation1.phpt deleted file mode 100644 index 56abaca83d..0000000000 --- a/ext/standard/tests/array/array_walk_recursive_variation1.phpt +++ /dev/null @@ -1,250 +0,0 @@ ---TEST-- -Test array_walk_recursive() function : usage variations - unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata]) - * Description: Apply a user function to every member of an array - * Source code: ext/standard/array.c -*/ - -/* - * Passing different scalar/nonscalar values in place of 'input' argument -*/ - -echo "*** Testing array_walk_recursive() : unexpected values for 'input' argument ***\n"; - -// callback function -/* Prototype : callback(mixed $value, mixed $key) - * Parameters : $value - values given in input array - * $key - keys given in input array - * Description : Function prints each element of an array with key - */ -function callback($value, $key) -{ - echo "key : "; - var_dump($key); - echo "value : "; - var_dump($value); -} - -// extra parameter passed to array_walk_recursive() -$user_data = 10; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get resource variable -$fp = fopen(__FILE__, 'r'); - -// different scalar/nonscalar values to be used in place of an 'input' argument -$input_values = array( - - // int data -/* 1*/ 0, - 1, - 12345, - -2345, - - // float data -/* 5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // null data -/* 10*/ NULL, - null, - - // boolean data -/* 12*/ true, - false, - TRUE, - FALSE, - - // empty data -/* 16*/ "", - '', - - // string data -/* 18*/ "string", - 'string', - - // resource data - $fp, - - // undefined data - @$undefined_var, - - // unset data -/* 22*/ @$unset_var, -); - - -for($count = 0; $count < count($input_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_walk_recursive($input_values[$count], "callback") ); - var_dump( array_walk_recursive($input_values[$count], "callback", $user_data) ); -} - -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing array_walk_recursive() : unexpected values for 'input' argument *** --- Iteration 1 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, resource given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, resource given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation2.phpt b/ext/standard/tests/array/array_walk_recursive_variation2.phpt deleted file mode 100644 index 5c8c56dcc2..0000000000 --- a/ext/standard/tests/array/array_walk_recursive_variation2.phpt +++ /dev/null @@ -1,268 +0,0 @@ ---TEST-- -Test array_walk_recursive() function : usage variations - unexpected values in place of 'funcname' argument ---FILE-- -<?php -/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata]) - * Description: Apply a user function to every member of an array - * Source code: ext/standard/array.c -*/ - -/* - * Passing different scalar/nonscalar values in place of 'funcname' argument -*/ - -echo "*** Testing array_walk_recursive() : unexpected values for 'funcname' argument ***\n"; - -$input = array(1, array(2, 3)); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -$user_data = 20; - -// class definition -class MyClass -{ - public function __toString() - { - return 'object'; - } -} - -// different scalar/nonscalar values to be used in place of callback function -$funcname_values = array( - - // int data -/* 1*/ 0, - 1, - 12345, - -2345, - - // float data -/* 5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data -/* 10*/ array(), - array(0), - array(1), - array('color' => 'red', 'item' => 'pen'), - - // null data -/* 14*/ NULL, - null, - - // boolean data -/* 16*/ true, - false, - TRUE, - FALSE, - - // empty data -/* 20*/ "", - '', - - // object data - new MyClass(), - - // resource data -/* 23*/ $fp = fopen(__FILE__, 'r'), - - // undefined data - @$undefined_var, - - // unset data -/* 25*/ @$unset_var, -); - -for($count = 0; $count < count($funcname_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_walk_recursive($input, $funcname_values[$count]) ); - var_dump( array_walk_recursive($input, $funcname_values[$count], $user_data )); -} - -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing array_walk_recursive() : unexpected values for 'funcname' argument *** --- Iteration 1 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 24 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 25 -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_walk_variation1.phpt b/ext/standard/tests/array/array_walk_variation1.phpt deleted file mode 100644 index 5fc3e62f2a..0000000000 --- a/ext/standard/tests/array/array_walk_variation1.phpt +++ /dev/null @@ -1,250 +0,0 @@ ---TEST-- -Test array_walk() function : usage variations - unexpected values for 'input' argument ---FILE-- -<?php -/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata]) - * Description: Apply a user function to every member of an array - * Source code: ext/standard/array.c -*/ - -/* - * Passing different scalar/nonscalar values in place of 'input' argument -*/ - -echo "*** Testing array_walk() : unexpected values for 'input' argument ***\n"; - -// callback function -/* Prototype : callback(mixed $value, mixed $key) - * Parameters : $value - values given in input array - * $key - keys given in input array - * Description : Function prints each element of an array with key - */ -function callback($value, $key) -{ - echo "key : "; - var_dump($key); - echo "value : "; - var_dump($value); -} - -// extra parameter passed to array_walk() -$user_data = 10; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get resource variable -$fp = fopen(__FILE__, 'r'); - -// different scalar/nonscalar values to be used in place of an 'input' argument -$input_values = array( - - // int data -/* 1*/ 0, - 1, - 12345, - -2345, - - // float data -/* 5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // null data -/* 10*/ NULL, - null, - - // boolean data -/* 12*/ true, - false, - TRUE, - FALSE, - - // empty data -/* 16*/ "", - '', - - // string data -/* 18*/ "string", - 'string', - - // resource data - $fp, - - // undefined data - @$undefined_var, - - // unset data -/* 22*/ @$unset_var, -); - - -for($count = 0; $count < count($input_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_walk($input_values[$count], "callback") ); - var_dump( array_walk($input_values[$count], "callback", $user_data) ); -} - -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing array_walk() : unexpected values for 'input' argument *** --- Iteration 1 -- - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_walk() expects parameter 1 to be array, resource given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, resource given in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/array_walk_variation2.phpt b/ext/standard/tests/array/array_walk_variation2.phpt deleted file mode 100644 index 1780f66bae..0000000000 --- a/ext/standard/tests/array/array_walk_variation2.phpt +++ /dev/null @@ -1,268 +0,0 @@ ---TEST-- -Test array_walk() function : usage variations - unexpected values in place of 'funcname' argument ---FILE-- -<?php -/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata]) - * Description: Apply a user function to every member of an array - * Source code: ext/standard/array.c -*/ - -/* - * Passing different scalar/nonscalar values in place of 'funcname' argument -*/ - -echo "*** Testing array_walk() : unexpected values for 'funcname' argument ***\n"; - -$input = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -$user_data = 20; - -// class definition -class MyClass -{ - public function __toString() - { - return 'object'; - } -} - -// different scalar/nonscalar values to be used in place of callback function -$funcname_values = array( - - // int data -/* 1*/ 0, - 1, - 12345, - -2345, - - // float data -/* 5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data -/* 10*/ array(), - array(0), - array(1), - array('color' => 'red', 'item' => 'pen'), - - // null data -/* 14*/ NULL, - null, - - // boolean data -/* 16*/ true, - false, - TRUE, - FALSE, - - // empty data -/* 20*/ "", - '', - - // object data - new MyClass(), - - // resource data -/* 23*/ $fp = fopen(__FILE__, 'r'), - - // undefined data - @$undefined_var, - - // unset data -/* 25*/ @$unset_var, -); - -for($count = 0; $count < count($funcname_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_walk($input, $funcname_values[$count]) ); - var_dump( array_walk($input, $funcname_values[$count], $user_data )); -} - -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing array_walk() : unexpected values for 'funcname' argument *** --- Iteration 1 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 2 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 3 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 4 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 5 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 6 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 7 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 8 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 9 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 10 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 11 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 12 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 13 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL --- Iteration 14 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 15 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 16 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 21 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 22 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 23 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 24 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 25 -- - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/arsort_variation1.phpt b/ext/standard/tests/array/arsort_variation1.phpt deleted file mode 100644 index d4156e3a9c..0000000000 --- a/ext/standard/tests/array/arsort_variation1.phpt +++ /dev/null @@ -1,399 +0,0 @@ ---TEST-- -Test arsort() function : usage variations - unexpected values for 'array_arg' argument ---FILE-- -<?php -/* Prototype : bool arsort(array &array_arg [, int sort_flags]) - * Description: Sort an array and maintain index association - Elements will be arranged from highest to lowest when this function has completed. - * Source code: ext/standard/array.c -*/ - -/* - * testing arsort() by providing different unexpected values for array argument with following flag values. - * 1. flag value as defualt - * 2. SORT_REGULAR - compare items normally - * 3. SORT_NUMERIC - compare items numerically - * 4. SORT_STRING - compare items as strings -*/ - -echo "*** Testing arsort() : usage variations ***\n"; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -//array of values with indices to iterate over -$unexpected_values = array ( - - // int data - 0 => 0, - 1 => 1, - 2 => 12345, - 3 => -2345, - - // float data - 4 => 10.5, - 5 => -10.5, - 6 => 10.5e3, - 7 => 10.6E-2, - 8 => .5, - - // null data - 9 => NULL, - 10 => null, - - // boolean data - 11 => true, - 12 => false, - 13 => TRUE, - 14 => FALSE, - - // empty data - 15 => "", - 16 => '', - - // string data - 17 => "string", - 18 => 'string', - - // object data - 19 => new stdclass(), - - // undefined data - 20 => @$undefined_var, - - // unset data - 21 => @$unset_var, - - // resource variable - 22 => $fp - -); - -// loop though each element of the array and check the working of arsort() -// when $array argument is supplied with different values from $unexpected_values -echo "\n-- Testing arsort() by supplying different unexpected values for 'array' argument --\n"; -echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - var_dump( arsort($value) ); // expecting : bool(false) - var_dump( arsort($value, SORT_REGULAR) ); // expecting : bool(false) - var_dump( arsort($value, SORT_NUMERIC) ); // expecting : bool(false) - var_dump( arsort($value, SORT_STRING) ); // expecting : bool(false) - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing arsort() : usage variations *** - --- Testing arsort() by supplying different unexpected values for 'array' argument -- - --- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- --- Iteration 1 -- - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 15 -- - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: arsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: arsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: arsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/arsort_variation2.phpt b/ext/standard/tests/array/arsort_variation2.phpt deleted file mode 100644 index b2c4385d6e..0000000000 --- a/ext/standard/tests/array/arsort_variation2.phpt +++ /dev/null @@ -1,304 +0,0 @@ ---TEST-- -Test arsort() function : usage variations - unexpected values for 'sort_flags' argument ---FILE-- -<?php -/* Prototype : proto bool arsort(array &array_arg [, int sort_flags]) - * Description: Sort an array and maintain index association - Elements will be arranged from highest to lowest when this function has completed. - * Source code: ext/standard/array.c -*/ - -/* - * Testing arsort() by providing different unexpected values for flag argument -*/ - -echo "*** Testing arsort() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// temperory array for checking unexpected behavior -$unsorted_values = array(1 => 10, 2 => 2, 3 => 45); - -//array of values to iterate over -$unexpected_values = array( - - // int data -/*1*/ -2345, - - // float data -/*2*/ 10.5, - -10.5, - 10.5e2, - 10.6E-2, - .5, - - // null data -/*7*/ NULL, - null, - - // boolean data -/*9*/ true, - false, - TRUE, - FALSE, - - // empty data -/*13*/ "", - '', - - // string data -/*15*/ "string", - 'string', - - // object data -/*16*/ new stdclass(), - - // undefined data -/*17*/ @$undefined_var, - - // unset data -/*18*/ @$unset_var, - - // resource variable -/*19*/ $fp - -); - -// loop though each element of the array and check the working of arsort() -// when $flag argument is supplied with different values from $unexpected_values -echo "\n-- Testing arsort() by supplying different unexpected values for 'sort_flags' argument --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - $temp_array = $unsorted_values; - var_dump( arsort($temp_array, $value) ); - var_dump($temp_array); - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing arsort() : usage variations *** - --- Testing arsort() by supplying different unexpected values for 'sort_flags' argument -- --- Iteration 1 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 2 -- -bool(true) -array(3) { - [3]=> - int(45) - [2]=> - int(2) - [1]=> - int(10) -} --- Iteration 3 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 4 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 5 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 6 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 7 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 8 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 9 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 10 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 11 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 12 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 13 -- - -Warning: arsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 14 -- - -Warning: arsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 15 -- - -Warning: arsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 16 -- - -Warning: arsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 17 -- - -Warning: arsort() expects parameter 2 to be int, object given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 18 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 19 -- -bool(true) -array(3) { - [3]=> - int(45) - [1]=> - int(10) - [2]=> - int(2) -} --- Iteration 20 -- - -Warning: arsort() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} -Done diff --git a/ext/standard/tests/array/asort_variation1.phpt b/ext/standard/tests/array/asort_variation1.phpt deleted file mode 100644 index efc109d28f..0000000000 --- a/ext/standard/tests/array/asort_variation1.phpt +++ /dev/null @@ -1,399 +0,0 @@ ---TEST-- -Test asort() function : usage variations - unexpected values for 'array_arg' argument ---FILE-- -<?php -/* Prototype : bool asort(array &array_arg [, int sort_flags]) - * Description: Sort an array and maintain index association - Elements will be arranged from lowest to highest when this function has completed. - * Source code: ext/standard/array.c -*/ - -/* - * testing asort() by providing different unexpected values for array argument with following flag values. - * 1. flag value as defualt - * 2. SORT_REGULAR - compare items normally - * 3. SORT_NUMERIC - compare items numerically - * 4. SORT_STRING - compare items as strings -*/ - -echo "*** Testing asort() : usage variations ***\n"; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -//array of values with indices to iterate over -$unexpected_values = array ( - - // int data - 0 => 0, - 1 => 1, - 2 => 12345, - 3 => -2345, - - // float data - 4 => 10.5, - 5 => -10.5, - 6 => 10.5e3, - 7 => 10.6E-2, - 8 => .5, - - // null data - 9 => NULL, - 10 => null, - - // boolean data - 11 => true, - 12 => false, - 13 => TRUE, - 14 => FALSE, - - // empty data - 15 => "", - 16 => '', - - // string data - 17 => "string", - 18 => 'string', - - // object data - 19 => new stdclass(), - - // undefined data - 20 => @$undefined_var, - - // unset data - 21 => @$unset_var, - - // resource variable - 22 => $fp - -); - -// loop though each element of the array and check the working of asort() -// when $array argument is supplied with different values from $unexpected_values -echo "\n-- Testing asort() by supplying different unexpected values for 'array' argument --\n"; -echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - var_dump( asort($value) ); // expecting : bool(false) - var_dump( asort($value, SORT_REGULAR) ); // expecting : bool(false) - var_dump( asort($value, SORT_NUMERIC) ); // expecting : bool(false) - var_dump( asort($value, SORT_STRING) ); // expecting : bool(false) - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing asort() : usage variations *** - --- Testing asort() by supplying different unexpected values for 'array' argument -- - --- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- --- Iteration 1 -- - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 15 -- - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: asort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, object given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: asort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: asort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/asort_variation2.phpt b/ext/standard/tests/array/asort_variation2.phpt deleted file mode 100644 index a3960cfddd..0000000000 --- a/ext/standard/tests/array/asort_variation2.phpt +++ /dev/null @@ -1,304 +0,0 @@ ---TEST-- -Test asort() function : usage variations - unexpected values for 'sort_flags' argument ---FILE-- -<?php -/* Prototype : proto bool asort(array &array_arg [, int sort_flags]) - * Description: Sort an array and maintain index association - Elements will be arranged from lowest to highest when this function has completed. - * Source code: ext/standard/array.c -*/ - -/* - * Testing asort() by providing different unexpected values for flag argument -*/ - -echo "*** Testing asort() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// temperory array for checking unexpected behavior -$unsorted_values = array(1 => 10, 2 => 2, 3 => 45); - -//array of values to iterate over -$unexpected_values = array( - - // int data -/*1*/ -2345, - - // float data -/*2*/ 10.5, - -10.5, - 10.5e2, - 10.6E-2, - .5, - - // null data -/*7*/ NULL, - null, - - // boolean data -/*9*/ true, - false, - TRUE, - FALSE, - - // empty data -/*13*/ "", - '', - - // string data -/*15*/ "string", - 'string', - - // object data -/*16*/ new stdclass(), - - // undefined data -/*17*/ @$undefined_var, - - // unset data -/*18*/ @$unset_var, - - // resource variable -/*19*/ $fp - -); - -// loop though each element of the array and check the working of asort() -// when $flag argument is supplied with different values from $unexpected_values -echo "\n-- Testing asort() by supplying different unexpected values for 'sort_flags' argument --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - $temp_array = $unsorted_values; - var_dump( asort($temp_array, $value) ); - var_dump($temp_array); - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing asort() : usage variations *** - --- Testing asort() by supplying different unexpected values for 'sort_flags' argument -- --- Iteration 1 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 2 -- -bool(true) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 3 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 4 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 5 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 6 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 7 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 8 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 9 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 10 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 11 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 12 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 13 -- - -Warning: asort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 14 -- - -Warning: asort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 15 -- - -Warning: asort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 16 -- - -Warning: asort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 17 -- - -Warning: asort() expects parameter 2 to be int, object given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} --- Iteration 18 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 19 -- -bool(true) -array(3) { - [2]=> - int(2) - [1]=> - int(10) - [3]=> - int(45) -} --- Iteration 20 -- - -Warning: asort() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -array(3) { - [1]=> - int(10) - [2]=> - int(2) - [3]=> - int(45) -} -Done diff --git a/ext/standard/tests/array/count_variation1.phpt b/ext/standard/tests/array/count_variation1.phpt deleted file mode 100644 index 10406f71ff..0000000000 --- a/ext/standard/tests/array/count_variation1.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test count() function : usage variations - Pass different data types as $var arg ---FILE-- -<?php -/* Prototype : int count(mixed $var [, int $mode]) - * Description: Count the number of elements in a variable (usually an array) - * Source code: ext/standard/array.c - */ - -/* - * aPass different data types as $var argument to count() to test behaviour - */ - -echo "*** Testing count() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $var argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of count() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( count($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing count() : usage variations *** - --- Iteration 1 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 2 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 3 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 4 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 5 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 6 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 7 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 8 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 9 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 10 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(0) - --- Iteration 11 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(0) - --- Iteration 12 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 13 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 14 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 15 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 16 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 17 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 18 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 19 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 20 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 21 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- Iteration 22 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(0) - --- Iteration 23 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(0) - --- Iteration 24 -- - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) -Done diff --git a/ext/standard/tests/array/count_variation2.phpt b/ext/standard/tests/array/count_variation2.phpt deleted file mode 100644 index 0a654be183..0000000000 --- a/ext/standard/tests/array/count_variation2.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test count() function : usage variations - Pass different data types as $mode arg ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : int count(mixed $var [, int $mode]) - * Description: Count the number of elements in a variable (usually an array) - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $mode argument to count() to test behaviour - */ - -echo "*** Testing count() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$var = array(1, 2, array ('one', 'two')); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $mode argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of count() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( count($var, $input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing count() : usage variations *** - --- Iteration 1 -- -int(3) - --- Iteration 2 -- -int(5) - --- Iteration 3 -- -int(3) - --- Iteration 4 -- -int(3) - --- Iteration 5 -- -int(3) - --- Iteration 6 -- -int(3) - --- Iteration 7 -- -int(3) - --- Iteration 8 -- -int(3) - --- Iteration 9 -- -int(3) - --- Iteration 10 -- -int(3) - --- Iteration 11 -- -int(3) - --- Iteration 12 -- -int(5) - --- Iteration 13 -- -int(3) - --- Iteration 14 -- -int(5) - --- Iteration 15 -- -int(3) - --- Iteration 16 -- - -Warning: count() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: count() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: count() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: count() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: count() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: count() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 22 -- -int(3) - --- Iteration 23 -- -int(3) - --- Iteration 24 -- - -Warning: count() expects parameter 2 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/current_variation1.phpt b/ext/standard/tests/array/current_variation1.phpt deleted file mode 100644 index c6c66f43c9..0000000000 --- a/ext/standard/tests/array/current_variation1.phpt +++ /dev/null @@ -1,217 +0,0 @@ ---TEST-- -Test current() function : usage variations - Pass different data types as $array_arg arg ---FILE-- -<?php -/* Prototype : mixed current(array $array_arg) - * Description: Return the element currently pointed to by the internal array pointer - * Source code: ext/standard/array.c - * Alias to functions: pos - */ - -/* - * Pass different data types as $array_arg argument to current() to test behaviour - */ - -echo "*** Testing current() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - var $var1; - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of current() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( current($input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing current() : usage variations *** - --- Iteration 1 -- - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: current() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: current() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: current() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: current() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- -NULL - --- Iteration 22 -- - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: current() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/end_variation1.phpt b/ext/standard/tests/array/end_variation1.phpt deleted file mode 100644 index 2b7f4cd9d4..0000000000 --- a/ext/standard/tests/array/end_variation1.phpt +++ /dev/null @@ -1,220 +0,0 @@ ---TEST-- -Test end() function : usage variations - Pass different data types as $array_arg ---FILE-- -<?php -/* Prototype : mixed end(array $array_arg) - * Description: Advances array argument's internal pointer to the last element and return it - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg to test behaviour of end() - */ - -echo "*** Testing end() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - var $foo = 'hello, world'; - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of end() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( end($input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing end() : usage variations *** - --- Iteration 1 -- - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: end() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: end() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: end() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: end() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: end() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: end() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: end() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: end() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: end() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: end() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: end() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- -string(12) "hello, world" - --- Iteration 23 -- - -Warning: end() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: end() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: end() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/extract_typed_ref.phpt b/ext/standard/tests/array/extract_typed_ref.phpt new file mode 100644 index 0000000000..8b697d5ccb --- /dev/null +++ b/ext/standard/tests/array/extract_typed_ref.phpt @@ -0,0 +1,23 @@ +--TEST-- +extract() into typed references must respect their type +--FILE-- +<?php + +class Test { + public int $i = 0; + public string $s = ""; +} + +$test = new Test; +$i =& $test->i; +$s =& $test->s; +try { + extract(['i' => 'foo', 's' => 42]); +} catch (TypeError $e) { echo $e->getMessage(), "\n"; } +var_dump($test->i, $test->s); + +?> +--EXPECT-- +Cannot assign string to reference held by property Test::$i of type int +int(0) +string(0) "" diff --git a/ext/standard/tests/array/key_variation1.phpt b/ext/standard/tests/array/key_variation1.phpt deleted file mode 100644 index 12a97e1421..0000000000 --- a/ext/standard/tests/array/key_variation1.phpt +++ /dev/null @@ -1,220 +0,0 @@ ---TEST-- -Test key() function : usage variations - Pass different data types as $array_arg arg. ---FILE-- -<?php -/* Prototype : mixed key(array $array_arg) - * Description: Return the key of the element currently pointed to by the internal array pointer - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to test behaviour of key() - */ - -echo "*** Testing key() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - var $var1; - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of key() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( key($input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing key() : usage variations *** - --- Iteration 1 -- - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: key() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: key() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: key() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: key() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -NULL - --- Iteration 19 -- - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- -string(4) "var1" - --- Iteration 23 -- - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: key() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/krsort_variation1.phpt b/ext/standard/tests/array/krsort_variation1.phpt deleted file mode 100644 index aaba5b91ce..0000000000 --- a/ext/standard/tests/array/krsort_variation1.phpt +++ /dev/null @@ -1,397 +0,0 @@ ---TEST-- -Test krsort() function : usage variations - unexpected values for 'array' argument ---FILE-- -<?php -/* Prototype : bool krsort(array &array_arg [, int sort_flags]) - * Description: Sort an array by key in reverse order, maintaining key to data correlation - * Source code: ext/standard/array.c -*/ - -/* - * testing krsort() by providing different unexpected values for array argument - * with following flag values: - * 1.flag value as defualt - * 2.SORT_REGULAR - compare items normally - * 3.SORT_NUMERIC - compare items numerically - * 4.SORT_STRING - compare items as strings -*/ - -echo "*** Testing krsort() : usage variations ***\n"; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -$unexpected_values = array ( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e3, - 10.6E-2, - 0.5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*11*/ true, - false, - TRUE, - FALSE, - - // empty data -/*15*/ "", - '', - - // string data -/*17*/ "string", - 'string', - - // object data -/*19*/ new stdclass(), - - // undefined data -/*20*/ @$undefined_var, - - // unset data -/*21*/ @$unset_var, - - // resource variable -/*22*/ $fp -); - -// loop though each element of the array and check the working of krsort() -// when $array argument is supplied with different values from $unexpected_values -echo "\n-- Testing krsort() by supplying different unexpected values for 'array' argument --\n"; -echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - var_dump( krsort($value) ); // expecting : bool(false) - var_dump( krsort($value, SORT_REGULAR) ); // expecting : bool(false) - var_dump( krsort($value, SORT_NUMERIC) ); // expecting : bool(false) - var_dump( krsort($value, SORT_STRING) ); // expecting : bool(false) - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing krsort() : usage variations *** - --- Testing krsort() by supplying different unexpected values for 'array' argument -- - --- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- --- Iteration 1 -- - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 15 -- - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: krsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/krsort_variation2.phpt b/ext/standard/tests/array/krsort_variation2.phpt deleted file mode 100644 index 303a9a1eb6..0000000000 --- a/ext/standard/tests/array/krsort_variation2.phpt +++ /dev/null @@ -1,303 +0,0 @@ ---TEST-- -Test krsort() function : usage variations - unexpected values for 'sort_flags' argument ---FILE-- -<?php -/* Prototype : bool krsort(array &array_arg [, int sort_flags]) - * Description: Sort an array by key in reverse order, maintaining key to data correlation - * Source code: ext/standard/array.c -*/ - -/* - * Testing krsort() by providing different unexpected values for flag argument -*/ - -echo "*** Testing krsort() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// an array for checking unexpected behavior -$unsorted_values = array(10 => 10, 2 => 2, 45 => 45); - -//array of unexpected values to iterate over -$unexpected_values = array ( - - // int data -/*1*/ -2345, - - // float data -/*2*/ 10.5, - -10.5, - 10.5e2, - 10.6E-2, - .5, - - // null data -/*7*/ NULL, - null, - - // boolean data -/*9*/ true, - false, - TRUE, - FALSE, - - // empty data -/*13*/ "", - '', - - // string data -/*15*/ "string", - 'string', - - // object data -/*16*/ new stdclass(), - - // undefined data -/*17*/ @$undefined_var, - - // unset data -/*18*/ @$unset_var, - - // resource variable -/*19*/ $fp - -); - -// loop though each element of the array and check the working of krsort() -// when 'sort_flags' argument is supplied with different values -echo "\n-- Testing krsort() by supplying different unexpected values for 'sort_flags' argument --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - $temp_array = $unsorted_values; - var_dump( krsort($temp_array, $value) ); - var_dump($temp_array); - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing krsort() : usage variations *** - --- Testing krsort() by supplying different unexpected values for 'sort_flags' argument -- --- Iteration 1 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 2 -- -bool(true) -array(3) { - [45]=> - int(45) - [2]=> - int(2) - [10]=> - int(10) -} --- Iteration 3 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 4 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 5 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 6 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 7 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 8 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 9 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 10 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 11 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 12 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 13 -- - -Warning: krsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 14 -- - -Warning: krsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 15 -- - -Warning: krsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 16 -- - -Warning: krsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 17 -- - -Warning: krsort() expects parameter 2 to be int, object given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 18 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 19 -- -bool(true) -array(3) { - [45]=> - int(45) - [10]=> - int(10) - [2]=> - int(2) -} --- Iteration 20 -- - -Warning: krsort() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} -Done diff --git a/ext/standard/tests/array/ksort_variation1.phpt b/ext/standard/tests/array/ksort_variation1.phpt deleted file mode 100644 index 87de1647d7..0000000000 --- a/ext/standard/tests/array/ksort_variation1.phpt +++ /dev/null @@ -1,397 +0,0 @@ ---TEST-- -Test ksort() function : usage variations - unexpected values for 'array' argument ---FILE-- -<?php -/* Prototype : bool ksort(array &array [, int sort_flags]) - * Description: Sort an array by key, maintaining key to data correlation - * Source code: ext/standard/array.c -*/ - -/* - * testing ksort() by providing different unexpected values for array argument with following flag values: - * 1. flag value as defualt - * 2. SORT_REGULAR - compare items normally - * 3. SORT_NUMERIC - compare items numerically - * 4. SORT_STRING - compare items as strings -*/ - -echo "*** Testing ksort() : usage variations ***\n"; - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -$unexpected_values = array ( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e3, - 10.6E-2, - 0.5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*11*/ true, - false, - TRUE, - FALSE, - - // empty data -/*15*/ "", - '', - - // string data -/*17*/ "string", - 'string', - - // object data -/*19*/ new stdclass(), - - // undefined data -/*20*/ @$undefined_var, - - // unset data -/*21*/ @$unset_var, - - // resource variable -/*22*/ $fp - -); - -// loop though each element of the array and check the working of ksort() -// when $array argument is supplied with different values from $unexpected_values -echo "\n-- Testing ksort() by supplying different unexpected values for 'array' argument --\n"; -echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - var_dump( ksort($value) ); // expecting : bool(false) - var_dump( ksort($value, SORT_REGULAR) ); // expecting : bool(false) - var_dump( ksort($value, SORT_NUMERIC) ); // expecting : bool(false) - var_dump( ksort($value, SORT_STRING) ); // expecting : bool(false) - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing ksort() : usage variations *** - --- Testing ksort() by supplying different unexpected values for 'array' argument -- - --- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- --- Iteration 1 -- - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 15 -- - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: ksort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, object given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/ksort_variation2.phpt b/ext/standard/tests/array/ksort_variation2.phpt deleted file mode 100644 index 83130d543e..0000000000 --- a/ext/standard/tests/array/ksort_variation2.phpt +++ /dev/null @@ -1,303 +0,0 @@ ---TEST-- -Test ksort() function : usage variations - unexpected values for 'sort_flags' argument ---FILE-- -<?php -/* Prototype : bool ksort(array &array_arg [, int sort_flags]) - * Description: Sort an array by key, maintaining key to data correlation - * Source code: ext/standard/array.c -*/ - -/* - * Testing ksort() by providing different unexpected values for flag argument -*/ - -echo "*** Testing ksort() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// an array for checking unexpected behavior -$unsorted_values = array(10 => 10, 2 => 2, 45 => 45); - -//array of unexpected values to iterate over -$unexpected_values = array ( - - // int data -/*1*/ -2345, - - // float data -/*2*/ 10.5, - -10.5, - 10.5e2, - 10.6E-2, - .5, - - // null data -/*7*/ NULL, - null, - - // boolean data -/*9*/ true, - false, - TRUE, - FALSE, - - // empty data -/*13*/ "", - '', - - // string data -/*15*/ "string", - 'string', - - // object data -/*16*/ new stdclass(), - - // undefined data -/*17*/ @$undefined_var, - - // unset data -/*18*/ @$unset_var, - - // resource variable -/*19*/ $fp - -); - -// loop though each element of the array and check the working of ksort() -// when 'sort_flags' argument is supplied with different values -echo "\n-- Testing ksort() by supplying different unexpected values for 'sort_flags' argument --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - $temp_array = $unsorted_values; - var_dump( ksort($temp_array, $value) ); - var_dump($temp_array); - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing ksort() : usage variations *** - --- Testing ksort() by supplying different unexpected values for 'sort_flags' argument -- --- Iteration 1 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 2 -- -bool(true) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 3 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 4 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 5 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 6 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 7 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 8 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 9 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 10 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 11 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 12 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 13 -- - -Warning: ksort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 14 -- - -Warning: ksort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 15 -- - -Warning: ksort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 16 -- - -Warning: ksort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 17 -- - -Warning: ksort() expects parameter 2 to be int, object given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} --- Iteration 18 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 19 -- -bool(true) -array(3) { - [2]=> - int(2) - [10]=> - int(10) - [45]=> - int(45) -} --- Iteration 20 -- - -Warning: ksort() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -array(3) { - [10]=> - int(10) - [2]=> - int(2) - [45]=> - int(45) -} -Done diff --git a/ext/standard/tests/array/natcasesort_variation1.phpt b/ext/standard/tests/array/natcasesort_variation1.phpt deleted file mode 100644 index 98d6297a3f..0000000000 --- a/ext/standard/tests/array/natcasesort_variation1.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test natcasesort() function : usage variations - Pass different data types as $array_arg arg ---FILE-- -<?php -/* Prototype : bool natcasesort(array &$array_arg) - * Description: Sort an array using case-insensitive natural sort - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to natcasesort() to test behaviour - */ - -echo "*** Testing natcasesort() : usage variation ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of natcasesort() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( natcasesort($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing natcasesort() : usage variation *** - --- Iteration 1 -- - -Warning: natcasesort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: natcasesort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: natcasesort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: natcasesort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: natcasesort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: natcasesort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: natcasesort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: natcasesort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: natcasesort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: natcasesort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: natcasesort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: natcasesort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: natcasesort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(true) - --- Iteration 19 -- - -Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: natcasesort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: natcasesort() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: natcasesort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/next_variation1.phpt b/ext/standard/tests/array/next_variation1.phpt deleted file mode 100644 index 405f34a435..0000000000 --- a/ext/standard/tests/array/next_variation1.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test next() function : usage variation - Pass different data types as $array_arg ---FILE-- -<?php -/* Prototype : mixed next(array $array_arg) - * Description: Move array argument's internal pointer to the next element and return it - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to next() to test behaviour - */ - -echo "*** Testing next() : variation ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of next() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( next($input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing next() : variation *** - --- Iteration 1 -- - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: next() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: next() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: next() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: next() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: next() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/prev_variation1.phpt b/ext/standard/tests/array/prev_variation1.phpt deleted file mode 100644 index 01156d8239..0000000000 --- a/ext/standard/tests/array/prev_variation1.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test prev() function : usage variation - Pass different data types as $array_arg ---FILE-- -<?php -/* Prototype : mixed prev(array $array_arg) - * Description: Move array argument's internal pointer to the previous element and return it - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to prev() to test behaviour - */ - -echo "*** Testing prev() : variation ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of prev() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( prev($input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing prev() : variation *** - --- Iteration 1 -- - -Warning: prev() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: prev() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: prev() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: prev() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: prev() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: prev() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: prev() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: prev() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: prev() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: prev() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: prev() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: prev() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: prev() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: prev() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: prev() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: prev() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: prev() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: prev() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: prev() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: prev() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: prev() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: prev() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: prev() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/reset_variation1.phpt b/ext/standard/tests/array/reset_variation1.phpt deleted file mode 100644 index f273324902..0000000000 --- a/ext/standard/tests/array/reset_variation1.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test reset() function : usage variations - Pass different data types as $array_arg arg. ---FILE-- -<?php -/* Prototype : mixed reset(array $array_arg) - * Description: Set array argument's internal pointer to the first element and return it - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to reset() to test behaviour - */ - -echo "*** Testing reset() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of reset() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( reset($input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing reset() : usage variations *** - --- Iteration 1 -- - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: reset() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: reset() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: reset() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: reset() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: reset() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/rsort_variation1.phpt b/ext/standard/tests/array/rsort_variation1.phpt deleted file mode 100644 index 5b83c89a29..0000000000 --- a/ext/standard/tests/array/rsort_variation1.phpt +++ /dev/null @@ -1,513 +0,0 @@ ---TEST-- -Test rsort() function : usage variations - Pass different data types as $array_arg arg ---FILE-- -<?php -/* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) - * Description: Sort an array in reverse order - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to rsort() to test behaviour - */ - -echo "*** Testing rsort() : variation ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of rsort() -$iterator = 1; -foreach ($inputs as $input) { - echo "-- Iteration $iterator --\n"; - echo "Flag = default:\n"; - var_dump( rsort($input) ); - echo "Flag = SORT_REGULAR:\n"; - var_dump( rsort($input, SORT_REGULAR) ); - echo "Flag = SORT_NUMERIC:\n"; - var_dump( rsort($input, SORT_NUMERIC) ); - echo "Flag = SORT_STRING:\n"; - var_dump( rsort($input, SORT_STRING) ); - $iterator++; -} - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing rsort() : variation *** --- Iteration 1 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 2 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 3 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 4 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 5 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 6 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 7 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 8 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 9 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 10 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 11 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 12 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 13 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 14 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 15 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 16 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 17 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 18 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 19 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 20 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 21 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, object given in %s on line %d -bool(false) --- Iteration 22 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 23 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 24 -- -Flag = default: - -Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Flag = SORT_REGULAR: - -Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Flag = SORT_NUMERIC: - -Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Flag = SORT_STRING: - -Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/rsort_variation2.phpt b/ext/standard/tests/array/rsort_variation2.phpt deleted file mode 100644 index d2b3e0e423..0000000000 --- a/ext/standard/tests/array/rsort_variation2.phpt +++ /dev/null @@ -1,485 +0,0 @@ ---TEST-- -Test rsort() function : usage variations - Pass different data types as $sort_flags arg ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) - * Description: Sort an array in reverse order - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $sort_flags argument to rsort() to test behaviour - * Where possible, 'SORT_NUMERIC' has been entered as a string value - */ - -echo "*** Testing rsort() : variation ***\n"; - -// Initialise function arguments not being substituted -$array_arg = array (1, 5, 2, 3, 1); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "SORT_NUMERIC"; - } -} - -// heredoc string -$heredoc = <<<EOT -SORT_NUMERIC -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $sort_flags argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "SORT_NUMERIC", - 'SORT_NUMERIC', - $heredoc, - - // object data -/*21*/ new classA(), - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behavior of rsort() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - - //create temporary array in case rsort() works - $temp = $array_arg; - - var_dump( rsort($temp, $input) ); - var_dump($temp); - $iterator++; - - $temp = null; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing rsort() : variation *** - --- Iteration 1 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 2 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 3 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 4 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 5 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 6 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 7 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 8 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 9 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 10 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 11 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 12 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 13 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 14 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 15 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 16 -- - -Warning: rsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} - --- Iteration 17 -- - -Warning: rsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} - --- Iteration 18 -- - -Warning: rsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} - --- Iteration 19 -- - -Warning: rsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} - --- Iteration 20 -- - -Warning: rsort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} - --- Iteration 21 -- - -Warning: rsort() expects parameter 2 to be int, object given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} - --- Iteration 22 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 23 -- -bool(true) -array(5) { - [0]=> - int(5) - [1]=> - int(3) - [2]=> - int(2) - [3]=> - int(1) - [4]=> - int(1) -} - --- Iteration 24 -- - -Warning: rsort() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -array(5) { - [0]=> - int(1) - [1]=> - int(5) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(1) -} -Done diff --git a/ext/standard/tests/array/shuffle_variation1.phpt b/ext/standard/tests/array/shuffle_variation1.phpt deleted file mode 100644 index 3c0ab5051a..0000000000 --- a/ext/standard/tests/array/shuffle_variation1.phpt +++ /dev/null @@ -1,213 +0,0 @@ ---TEST-- -Test shuffle() function : usage variations - unexpected values for 'array_arg' argument ---FILE-- -<?php -/* Prototype : bool shuffle(array $array_arg) - * Description: Randomly shuffle the contents of an array - * Source code: ext/standard/array.c -*/ - -/* -* Test behaviour of shuffle() when unexpected values are passed for 'array_arg' -* argument and verify that function outputs required warning messages wherever applicable -*/ - -echo "*** Testing shuffle() : with unexpected values for 'array_arg' argument ***\n"; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//define a class -class test -{ - var $t = 10; - function __toString() - { - return "object"; - } -} - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new test(), - - // undefined data -/*21*/ @$undefined_var, - - // unset data -/*22*/ @$unset_var, - -/*23*/ // resource data - $fp -); - -// loop through the array to test shuffle() function -// with each element of the array -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump( shuffle($value) ); - $count++; -}; - -// closing the resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing shuffle() : with unexpected values for 'array_arg' argument *** - --- Iteration 1 -- - -Warning: shuffle() expects parameter 1 to be array, int given in %s on line %d -bool(false) - --- Iteration 2 -- - -Warning: shuffle() expects parameter 1 to be array, int given in %s on line %d -bool(false) - --- Iteration 3 -- - -Warning: shuffle() expects parameter 1 to be array, int given in %s on line %d -bool(false) - --- Iteration 4 -- - -Warning: shuffle() expects parameter 1 to be array, int given in %s on line %d -bool(false) - --- Iteration 5 -- - -Warning: shuffle() expects parameter 1 to be array, float given in %s on line %d -bool(false) - --- Iteration 6 -- - -Warning: shuffle() expects parameter 1 to be array, float given in %s on line %d -bool(false) - --- Iteration 7 -- - -Warning: shuffle() expects parameter 1 to be array, float given in %s on line %d -bool(false) - --- Iteration 8 -- - -Warning: shuffle() expects parameter 1 to be array, float given in %s on line %d -bool(false) - --- Iteration 9 -- - -Warning: shuffle() expects parameter 1 to be array, float given in %s on line %d -bool(false) - --- Iteration 10 -- - -Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d -bool(false) - --- Iteration 12 -- - -Warning: shuffle() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - --- Iteration 13 -- - -Warning: shuffle() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - --- Iteration 14 -- - -Warning: shuffle() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - --- Iteration 15 -- - -Warning: shuffle() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - --- Iteration 16 -- - -Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d -bool(false) - --- Iteration 18 -- - -Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d -bool(false) - --- Iteration 19 -- - -Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d -bool(false) - --- Iteration 20 -- - -Warning: shuffle() expects parameter 1 to be array, object given in %s on line %d -bool(false) - --- Iteration 21 -- - -Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d -bool(false) - --- Iteration 22 -- - -Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d -bool(false) - --- Iteration 23 -- - -Warning: shuffle() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/sort_variation1.phpt b/ext/standard/tests/array/sort_variation1.phpt deleted file mode 100644 index e8365ea131..0000000000 --- a/ext/standard/tests/array/sort_variation1.phpt +++ /dev/null @@ -1,398 +0,0 @@ ---TEST-- -Test sort() function : usage variations - unexpected values for 'array_arg' argument ---FILE-- -<?php -/* Prototype : bool sort(array &array_arg [, int $sort_flags]) - * Description: Sort an array - * Source code: ext/standard/array.c -*/ - -/* - * testing sort() by providing different unexpected values for array argument - * with following flag values. - * 1. flag value as defualt - * 2. SORT_REGULAR - compare items normally - * 3. SORT_NUMERIC - compare items numerically - * 4. SORT_STRING - compare items as strings -*/ - -echo "*** Testing sort() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -//array of values to iterate over -$unexpected_values = array ( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.5e3, - 10.6E-2, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // object data -/*20*/ new stdclass(), - - // undefined data -/*21*/ @$undefined_var, - - // unset data -/*22*/ @$unset_var, - - // resource variable -/*23*/ $fp -); - -// loop though each element of the array and check the working of sort() -// when $array argument is supplied with different values from $unexpected_values -echo "\n-- Testing sort() by supplying different unexpected values for 'array' argument --\n"; -echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - $value = $unexpected_values [$index]; - var_dump( sort($value) ); // expecting : bool(false) - var_dump( sort($value, SORT_REGULAR) ); // expecting : bool(false) - var_dump( sort($value, SORT_NUMERIC) ); // expecting : bool(false) - var_dump( sort($value, SORT_STRING) ); // expecting : bool(false) - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing sort() : usage variations *** - --- Testing sort() by supplying different unexpected values for 'array' argument -- - --- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING -- --- Iteration 1 -- - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, int given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, float given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 15 -- - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, bool given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: sort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, object given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, object given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, null given in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: sort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) - -Warning: sort() expects parameter 1 to be array, resource given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/array/sort_variation2.phpt b/ext/standard/tests/array/sort_variation2.phpt deleted file mode 100644 index ee0e4b8b17..0000000000 --- a/ext/standard/tests/array/sort_variation2.phpt +++ /dev/null @@ -1,307 +0,0 @@ ---TEST-- -Test sort() function : usage variations - unexpected values for 'sort_flags' argument ---FILE-- -<?php -/* Prototype : bool sort(array &array_arg [, int $sort_flags]) - * Description: Sort an array - * Source code: ext/standard/array.c -*/ - -/* - * Testing sort() by providing different unexpected values for flag argument -*/ - -echo "*** Testing sort() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// temperory array for checking unexpected behavior -$unsorted_values = array(10, 2, 45); - -//array of values to iterate over -$unexpected_values = array( - - // int data -/*1*/ -2345, - - // float data -/*2*/ 10.5, - -10.5, - 10.5e2, - 10.6E-2, - .5, - - // null data -/*7*/ NULL, - null, - - // boolean data -/*9*/ true, - false, - TRUE, - FALSE, - - // empty data -/*13*/ "", - '', - - // string data -/*15*/ "string", - 'string', - - // object data -/*16*/ new stdclass(), - - // undefined data -/*17*/ @$undefined_var, - - // unset data -/*18*/ @$unset_var, - - // resource variable -/*19*/ $fp - -); - -// loop though each element of the array and check the working of sort() -// when $flag argument is supplied with different values -echo "\n-- Testing sort() by supplying different unexpected values for 'flag' argument --\n"; - -$counter = 1; -for($index = 0; $index < count($unexpected_values); $index ++) { - echo "-- Iteration $counter --\n"; - - // sort the array, retain a temp. copy of input array for next iteration - $value = $unexpected_values [$index]; - $temp_array = $unsorted_values; - var_dump( sort($temp_array, $value) ); - - //dump the sorted array - var_dump($temp_array); - $counter++; -} - -echo "Done"; -?> ---EXPECTF-- -*** Testing sort() : usage variations *** - --- Testing sort() by supplying different unexpected values for 'flag' argument -- --- Iteration 1 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 2 -- -bool(true) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} --- Iteration 3 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 4 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 5 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 6 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 7 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 8 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 9 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 10 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 11 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 12 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 13 -- - -Warning: sort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} --- Iteration 14 -- - -Warning: sort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} --- Iteration 15 -- - -Warning: sort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} --- Iteration 16 -- - -Warning: sort() expects parameter 2 to be int, string given in %s on line %d -bool(false) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} --- Iteration 17 -- - -Warning: sort() expects parameter 2 to be int, object given in %s on line %d -bool(false) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} --- Iteration 18 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 19 -- -bool(true) -array(3) { - [0]=> - int(2) - [1]=> - int(10) - [2]=> - int(45) -} --- Iteration 20 -- - -Warning: sort() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -array(3) { - [0]=> - int(10) - [1]=> - int(2) - [2]=> - int(45) -} -Done diff --git a/ext/standard/tests/array/uasort_variation1.phpt b/ext/standard/tests/array/uasort_variation1.phpt deleted file mode 100644 index f3a849b938..0000000000 --- a/ext/standard/tests/array/uasort_variation1.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test uasort() function : usage variations - unexpected values for 'array_arg' argument ---FILE-- -<?php -/* Prototype : bool uasort(array $array_arg, string $cmp_function) - * Description: Sort an array with a user-defined comparison function and maintain index association - * Source code: ext/standard/array.c -*/ - -/* -* Testing uasort() function by passing different scalar/nonscalar values as 'array_arg' argument -*/ - -echo "*** Testing uasort() : unexpected values for 'array_arg' ***\n"; - -// Comparison function -/* Prototype : int cmp_function(mixed $value1, mixed $value2) - * Parameters : $value1 and $value2 - values to be compared - * Return value : 0 - if both values are same - * 1 - if value1 is greater than value2 - * -1 - if value1 is less than value2 - * Description : compares value1 and value2 - */ -function cmp_function($value1, $value2) -{ - if($value1 == $value2) { - return 0; - } - else if($value1 > $value2) { - return 1; - } - else { - return -1; - } -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get resource variable -$fp = fopen(__FILE__,'r'); - -//array of values to iterate over -$input_values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - - // resource data -/*20*/ $fp, - - // undefined data - @$undefined_var, - - // unset data -/*22*/ @$unset_var, -); - -// loop through each value of input_values -for($count = 0; $count < count($input_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( uasort($input_values[$count], 'cmp_function') ); -}; - -//closing resource -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing uasort() : unexpected values for 'array_arg' *** --- Iteration 1 -- - -Warning: uasort() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 2 -- - -Warning: uasort() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 3 -- - -Warning: uasort() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 4 -- - -Warning: uasort() expects parameter 1 to be array, int given in %s on line %d -NULL --- Iteration 5 -- - -Warning: uasort() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 6 -- - -Warning: uasort() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 7 -- - -Warning: uasort() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: uasort() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 9 -- - -Warning: uasort() expects parameter 1 to be array, float given in %s on line %d -NULL --- Iteration 10 -- - -Warning: uasort() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 11 -- - -Warning: uasort() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 12 -- - -Warning: uasort() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 13 -- - -Warning: uasort() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 14 -- - -Warning: uasort() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 15 -- - -Warning: uasort() expects parameter 1 to be array, bool given in %s on line %d -NULL --- Iteration 16 -- - -Warning: uasort() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: uasort() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: uasort() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: uasort() expects parameter 1 to be array, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: uasort() expects parameter 1 to be array, resource given in %s on line %d -NULL --- Iteration 21 -- - -Warning: uasort() expects parameter 1 to be array, null given in %s on line %d -NULL --- Iteration 22 -- - -Warning: uasort() expects parameter 1 to be array, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/uasort_variation2.phpt b/ext/standard/tests/array/uasort_variation2.phpt deleted file mode 100644 index e5278fbab7..0000000000 --- a/ext/standard/tests/array/uasort_variation2.phpt +++ /dev/null @@ -1,212 +0,0 @@ ---TEST-- -Test uasort() function : usage variations - unexpected values for 'cmp_function' argument ---FILE-- -<?php -/* Prototype : bool uasort(array $array_arg, string $cmp_function) - * Description: Sort an array with a user-defined comparison function and maintain index association - * Source code: ext/standard/array.c -*/ - -/* -* Testing uasort() function with different scalar and nonscalar values in place of 'cmp_function' -*/ - -echo "*** Testing uasort() : Unexpected values in place of comparison function ***\n"; - -// Class definition for object variable -class MyClass -{ - public function __toString() - { - return 'object'; - } -} - -$array_arg = array(0 => 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5); - -// Get an unset variable -$unset_var = 10; -unset ($unset_var); - -// Get resource variable -$fp = fopen(__FILE__,'r'); - -// different values for 'cmp_function' -$cmp_values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // string data - "string", - 'string', - - // object data -/*25*/ new MyClass(), - - // resource data - $fp, - - // undefined data - @$undefined_var, - - // unset data -/*28*/ @$unset_var, -); - -// loop through each element of the cmp_values for 'cmp_function' -for($count = 0; $count < count($cmp_values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( uasort($array_arg, $cmp_values[$count]) ); -}; - -//closing resource -fclose($fp); -echo "Done" -?> ---EXPECTF-- -*** Testing uasort() : Unexpected values in place of comparison function *** --- Iteration 1 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 2 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 3 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 4 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 5 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 6 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 7 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 8 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 9 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 10 -- - -Warning: uasort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 11 -- - -Warning: uasort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 12 -- - -Warning: uasort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL --- Iteration 13 -- - -Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL --- Iteration 14 -- - -Warning: uasort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL --- Iteration 15 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 16 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 18 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 21 -- - -Warning: uasort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 22 -- - -Warning: uasort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL --- Iteration 23 -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d -NULL --- Iteration 24 -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d -NULL --- Iteration 25 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 26 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 27 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL --- Iteration 28 -- - -Warning: uasort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/uksort_variation1.phpt b/ext/standard/tests/array/uksort_variation1.phpt deleted file mode 100644 index 21210dee7b..0000000000 --- a/ext/standard/tests/array/uksort_variation1.phpt +++ /dev/null @@ -1,224 +0,0 @@ ---TEST-- -Test uksort() function : usage variation ---FILE-- -<?php -/* Prototype : bool uksort(array array_arg, string cmp_function) - * Description: Sort an array by keys using a user-defined comparison function - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing uksort() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$cmp_function = 'string_val'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for array_arg - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( uksort($value, $cmp_function) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing uksort() : usage variation *** - ---int 0-- - -Warning: uksort() expects parameter 1 to be array, int given in %suksort_variation1.php on line %d -NULL - ---int 1-- - -Warning: uksort() expects parameter 1 to be array, int given in %suksort_variation1.php on line %d -NULL - ---int 12345-- - -Warning: uksort() expects parameter 1 to be array, int given in %suksort_variation1.php on line %d -NULL - ---int -12345-- - -Warning: uksort() expects parameter 1 to be array, int given in %suksort_variation1.php on line %d -NULL - ---float 10.5-- - -Warning: uksort() expects parameter 1 to be array, float given in %suksort_variation1.php on line %d -NULL - ---float -10.5-- - -Warning: uksort() expects parameter 1 to be array, float given in %suksort_variation1.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: uksort() expects parameter 1 to be array, float given in %suksort_variation1.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: uksort() expects parameter 1 to be array, float given in %suksort_variation1.php on line %d -NULL - ---float .5-- - -Warning: uksort() expects parameter 1 to be array, float given in %suksort_variation1.php on line %d -NULL - ---uppercase NULL-- - -Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d -NULL - ---lowercase null-- - -Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d -NULL - ---lowercase true-- - -Warning: uksort() expects parameter 1 to be array, bool given in %suksort_variation1.php on line %d -NULL - ---lowercase false-- - -Warning: uksort() expects parameter 1 to be array, bool given in %suksort_variation1.php on line %d -NULL - ---uppercase TRUE-- - -Warning: uksort() expects parameter 1 to be array, bool given in %suksort_variation1.php on line %d -NULL - ---uppercase FALSE-- - -Warning: uksort() expects parameter 1 to be array, bool given in %suksort_variation1.php on line %d -NULL - ---empty string DQ-- - -Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d -NULL - ---empty string SQ-- - -Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d -NULL - ---string DQ-- - -Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d -NULL - ---string SQ-- - -Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d -NULL - ---mixed case string-- - -Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d -NULL - ---heredoc-- - -Warning: uksort() expects parameter 1 to be array, string given in %suksort_variation1.php on line %d -NULL - ---instance of classWithToString-- - -Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: uksort() expects parameter 1 to be array, object given in %suksort_variation1.php on line %d -NULL - ---undefined var-- - -Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d -NULL - ---unset var-- - -Warning: uksort() expects parameter 1 to be array, null given in %suksort_variation1.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/uksort_variation2.phpt b/ext/standard/tests/array/uksort_variation2.phpt deleted file mode 100644 index 5ac32f02b8..0000000000 --- a/ext/standard/tests/array/uksort_variation2.phpt +++ /dev/null @@ -1,224 +0,0 @@ ---TEST-- -Test uksort() function : usage variation ---FILE-- -<?php -/* Prototype : bool uksort(array array_arg, string cmp_function) - * Description: Sort an array by keys using a user-defined comparison function - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing uksort() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array_arg = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for cmp_function - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( uksort($array_arg, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing uksort() : usage variation *** - ---int 0-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---int 1-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---int 12345-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---int -12345-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---float 10.5-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---float -10.5-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---float .5-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---empty array-- - -Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d -NULL - ---int indexed array-- - -Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d -NULL - ---associative array-- - -Warning: uksort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %suksort_variation2.php on line %d -NULL - ---nested arrays-- - -Warning: uksort() expects parameter 2 to be a valid callback, array must have exactly two members in %suksort_variation2.php on line %d -NULL - ---uppercase NULL-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---lowercase null-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---lowercase true-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---lowercase false-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---uppercase TRUE-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---uppercase FALSE-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---empty string DQ-- - -Warning: uksort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %suksort_variation2.php on line %d -NULL - ---empty string SQ-- - -Warning: uksort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %suksort_variation2.php on line %d -NULL - ---instance of classWithToString-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---undefined var-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL - ---unset var-- - -Warning: uksort() expects parameter 2 to be a valid callback, no array or string given in %suksort_variation2.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/usort_variation1.phpt b/ext/standard/tests/array/usort_variation1.phpt deleted file mode 100644 index 14d740dd86..0000000000 --- a/ext/standard/tests/array/usort_variation1.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test usort() function : usage variations - Pass different data types as $array_arg arg ---FILE-- -<?php -/* Prototype : bool usort(array $array_arg, string $cmp_function) - * Description: Sort an array by values using a user-defined comparison function - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $array_arg argument to usort() to test behaviour - */ - -echo "*** Testing usort() : usage variations ***\n"; - -// Initialise function arguments not being substituted -function cmp_function($value1, $value2) -{ - if($value1 == $value2) { - return 0; - } - else if($value1 > $value2) { - return 1; - } - else { - return -1; - } -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $array_arg argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of usort() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( usort($input, 'cmp_function') ); - $iterator++; -}; - -//closing resource -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing usort() : usage variations *** - --- Iteration 1 -- - -Warning: usort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: usort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: usort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: usort() expects parameter 1 to be array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: usort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: usort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: usort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: usort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: usort() expects parameter 1 to be array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: usort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: usort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: usort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: usort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: usort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: usort() expects parameter 1 to be array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: usort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: usort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- -bool(true) - --- Iteration 19 -- - -Warning: usort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: usort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: usort() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: usort() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: usort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: usort() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: usort() expects parameter 1 to be array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/usort_variation2.phpt b/ext/standard/tests/array/usort_variation2.phpt deleted file mode 100644 index 9e31b2fcbf..0000000000 --- a/ext/standard/tests/array/usort_variation2.phpt +++ /dev/null @@ -1,242 +0,0 @@ ---TEST-- -Test usort() function : usage variations - Pass different data types as $cmp_function arg ---FILE-- -<?php -/* Prototype : bool usort(array $array_arg, string $cmp_function) - * Description: Sort an array by values using a user-defined comparison function - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $cmp_function argument to usort() to test behaviour - */ - -echo "*** Testing usort() : usage variation ***\n"; - -// Class definition for object variable -class MyClass -{ - public function __toString() - { - return 'object'; - } -} - -$array_arg = array(0 => 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5); - -// Get an unset variable -$unset_var = 10; -unset ($unset_var); - -// Get resource variable -$fp = fopen(__FILE__,'r'); - -// different values for $cmp_function -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // string data - "string", - 'string', - - // object data -/*25*/ new MyClass(), - - // resource data - $fp, - - // undefined data - @$undefined_var, - - // unset data -/*28*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of usort() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( usort($array_arg, $input) ); - $iterator++; -}; - -//closing resource -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing usort() : usage variation *** - --- Iteration 1 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - --- Iteration 11 -- - -Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - --- Iteration 12 -- - -Warning: usort() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - --- Iteration 13 -- - -Warning: usort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL - --- Iteration 14 -- - -Warning: usort() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL - --- Iteration 15 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: usort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL - --- Iteration 22 -- - -Warning: usort() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL - --- Iteration 23 -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d -NULL - --- Iteration 24 -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'string' not found or invalid function name in %s on line %d -NULL - --- Iteration 25 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 26 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 27 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL - --- Iteration 28 -- - -Warning: usort() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/assert/assert_error1.phpt b/ext/standard/tests/assert/assert_error1.phpt index 7c19c784d4..55879e8427 100644 --- a/ext/standard/tests/assert/assert_error1.phpt +++ b/ext/standard/tests/assert/assert_error1.phpt @@ -12,11 +12,6 @@ function f1() { echo "f1 called\n"; } -function handler($errno, $errstr) { - echo "in handler()\n\n"; - assert(E_RECOVERABLE_ERROR === $errno); - var_dump($errstr); -} //Wrong number of parameters for assert_options() assert_options(ASSERT_WARNING, 1); @@ -30,8 +25,6 @@ var_dump($rao=assert_options("F1", "f1")); $sa="0 != 0"; var_dump($r2 = assert($sa, "message", 1)); - -//Catch recoverable error with handler var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç')); --EXPECTF-- Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d diff --git a/ext/standard/tests/class_object/class_exists_variation_001.phpt b/ext/standard/tests/class_object/class_exists_variation_001.phpt deleted file mode 100644 index 561a77fa2c..0000000000 --- a/ext/standard/tests/class_object/class_exists_variation_001.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test class_exists() function : usage variations - unexpected types for argument 1 ---FILE-- -<?php -/* Prototype : proto bool class_exists(string classname [, bool autoload]) - * Description: Checks if the class exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; -}); - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing class_exists() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$autoload = true; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for classname - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( class_exists($value, $autoload) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing class_exists() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(67) -Error: 8 - Undefined variable: unset_var, %s(70) - -Arg value 0 -In autoload(0) -bool(false) - -Arg value 1 -In autoload(1) -bool(false) - -Arg value 12345 -In autoload(12345) -bool(false) - -Arg value -2345 -bool(false) - -Arg value 10.5 -bool(false) - -Arg value -10.5 -bool(false) - -Arg value 101234567000 -In autoload(101234567000) -bool(false) - -Arg value 1.07654321E-9 -bool(false) - -Arg value 0.5 -bool(false) -Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77) -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(1) -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(1) -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) -Error: 4096 - Object of class stdClass could not be converted to string, %s(76) - -Arg value -Error: 2 - class_exists() expects parameter 1 to be string, object given, %s(77) -NULL - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/class_object/class_exists_variation_002.phpt b/ext/standard/tests/class_object/class_exists_variation_002.phpt deleted file mode 100644 index 4b77d032ea..0000000000 --- a/ext/standard/tests/class_object/class_exists_variation_002.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test class_exists() function : usage variations - unexpected types for argument 2 ---FILE-- -<?php -/* Prototype : proto bool class_exists(string classname [, bool autoload]) - * Description: Checks if the class exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; -}); - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing class_exists() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$classname = 'string_val'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for autoload - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( class_exists($classname, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing class_exists() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(71) -Error: 8 - Undefined variable: unset_var, %s(74) - -Arg value 0 -bool(false) - -Arg value 1 -In autoload(string_val) -bool(false) - -Arg value 12345 -In autoload(string_val) -bool(false) - -Arg value -2345 -In autoload(string_val) -bool(false) - -Arg value 10.5 -In autoload(string_val) -bool(false) - -Arg value -10.5 -In autoload(string_val) -bool(false) - -Arg value 101234567000 -In autoload(string_val) -bool(false) - -Arg value 1.07654321E-9 -In autoload(string_val) -bool(false) - -Arg value 0.5 -In autoload(string_val) -bool(false) -Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - class_exists() expects parameter 2 to be bool, array given, %s(81) -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(string_val) -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(string_val) -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value string -In autoload(string_val) -bool(false) - -Arg value string -In autoload(string_val) -bool(false) -Error: 4096 - Object of class stdClass could not be converted to string, %s(80) - -Arg value -Error: 2 - class_exists() expects parameter 2 to be bool, object given, %s(81) -NULL - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/class_object/get_object_vars_variation_003.phpt b/ext/standard/tests/class_object/get_object_vars_variation_003.phpt deleted file mode 100644 index 10be39bb7f..0000000000 --- a/ext/standard/tests/class_object/get_object_vars_variation_003.phpt +++ /dev/null @@ -1,210 +0,0 @@ ---TEST-- -Test get_object_vars() function : usage variations - unexpected types for argument 1 ---FILE-- -<?php -/* Prototype : proto array get_object_vars(object obj) - * Description: Returns an array of object properties - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_object_vars() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for obj - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( get_object_vars($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing get_object_vars() : usage variations *** - -Notice: Undefined variable: undefined_var in %s on line 56 - -Notice: Undefined variable: unset_var in %s on line 59 - -Arg value 0 - -Warning: get_object_vars() expects parameter 1 to be object, int given in %s on line %d -NULL - -Arg value 1 - -Warning: get_object_vars() expects parameter 1 to be object, int given in %s on line %d -NULL - -Arg value 12345 - -Warning: get_object_vars() expects parameter 1 to be object, int given in %s on line %d -NULL - -Arg value -2345 - -Warning: get_object_vars() expects parameter 1 to be object, int given in %s on line %d -NULL - -Arg value 10.5 - -Warning: get_object_vars() expects parameter 1 to be object, float given in %s on line %d -NULL - -Arg value -10.5 - -Warning: get_object_vars() expects parameter 1 to be object, float given in %s on line %d -NULL - -Arg value 101234567000 - -Warning: get_object_vars() expects parameter 1 to be object, float given in %s on line %d -NULL - -Arg value 1.07654321E-9 - -Warning: get_object_vars() expects parameter 1 to be object, float given in %s on line %d -NULL - -Arg value 0.5 - -Warning: get_object_vars() expects parameter 1 to be object, float given in %s on line %d -NULL - -Arg value Array - -Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d -NULL - -Arg value Array - -Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d -NULL - -Arg value Array - -Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d -NULL - -Arg value Array - -Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d -NULL - -Arg value Array - -Warning: get_object_vars() expects parameter 1 to be object, array given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d -NULL - -Arg value 1 - -Warning: get_object_vars() expects parameter 1 to be object, bool given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, bool given in %s on line %d -NULL - -Arg value 1 - -Warning: get_object_vars() expects parameter 1 to be object, bool given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, bool given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d -NULL - -Arg value string - -Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d -NULL - -Arg value string - -Warning: get_object_vars() expects parameter 1 to be object, string given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d -NULL - -Arg value - -Warning: get_object_vars() expects parameter 1 to be object, null given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/class_object/interface_exists_variation1.phpt b/ext/standard/tests/class_object/interface_exists_variation1.phpt deleted file mode 100644 index 3aee5037a5..0000000000 --- a/ext/standard/tests/class_object/interface_exists_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test interface_exists() function : usage variation ---FILE-- -<?php -/* Prototype : bool interface_exists(string classname [, bool autoload]) - * Description: Checks if the class exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing interface_exists() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$autoload = true; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for classname - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( interface_exists($value, $autoload) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing interface_exists() : usage variation *** - ---int 0-- -bool(false) - ---int 1-- -bool(false) - ---int 12345-- -bool(false) - ---int -12345-- -bool(false) - ---float 10.5-- -bool(false) - ---float -10.5-- -bool(false) - ---float 12.3456789000e10-- -bool(false) - ---float -12.3456789000e10-- -bool(false) - ---float .5-- -bool(false) - ---empty array-- - -Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d -NULL - ---int indexed array-- - -Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d -NULL - ---associative array-- - -Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d -NULL - ---nested arrays-- - -Warning: interface_exists() expects parameter 1 to be string, array given in %sinterface_exists_variation1.php on line %d -NULL - ---uppercase NULL-- -bool(false) - ---lowercase null-- -bool(false) - ---lowercase true-- -bool(false) - ---lowercase false-- -bool(false) - ---uppercase TRUE-- -bool(false) - ---uppercase FALSE-- -bool(false) - ---empty string DQ-- -bool(false) - ---empty string SQ-- -bool(false) - ---instance of classWithToString-- -bool(false) - ---instance of classWithoutToString-- - -Warning: interface_exists() expects parameter 1 to be string, object given in %sinterface_exists_variation1.php on line %d -NULL - ---undefined var-- -bool(false) - ---unset var-- -bool(false) -===DONE=== diff --git a/ext/standard/tests/class_object/interface_exists_variation2.phpt b/ext/standard/tests/class_object/interface_exists_variation2.phpt deleted file mode 100644 index 1f9a0af422..0000000000 --- a/ext/standard/tests/class_object/interface_exists_variation2.phpt +++ /dev/null @@ -1,204 +0,0 @@ ---TEST-- -Test interface_exists() function : usage variation ---FILE-- -<?php -/* Prototype : bool interface_exists(string classname [, bool autoload]) - * Description: Checks if the class exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing interface_exists() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$classname = 'aBogusInterfaceName'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for autoload - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( interface_exists($classname, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing interface_exists() : usage variation *** - ---int 0-- -bool(false) - ---int 1-- -bool(false) - ---int 12345-- -bool(false) - ---int -12345-- -bool(false) - ---float 10.5-- -bool(false) - ---float -10.5-- -bool(false) - ---float 12.3456789000e10-- -bool(false) - ---float -12.3456789000e10-- -bool(false) - ---float .5-- -bool(false) - ---empty array-- - -Warning: interface_exists() expects parameter 2 to be bool, array given in %sinterface_exists_variation2.php on line %d -NULL - ---int indexed array-- - -Warning: interface_exists() expects parameter 2 to be bool, array given in %sinterface_exists_variation2.php on line %d -NULL - ---associative array-- - -Warning: interface_exists() expects parameter 2 to be bool, array given in %sinterface_exists_variation2.php on line %d -NULL - ---nested arrays-- - -Warning: interface_exists() expects parameter 2 to be bool, array given in %sinterface_exists_variation2.php on line %d -NULL - ---uppercase NULL-- -bool(false) - ---lowercase null-- -bool(false) - ---lowercase true-- -bool(false) - ---lowercase false-- -bool(false) - ---uppercase TRUE-- -bool(false) - ---uppercase FALSE-- -bool(false) - ---empty string DQ-- -bool(false) - ---empty string SQ-- -bool(false) - ---string DQ-- -bool(false) - ---string SQ-- -bool(false) - ---mixed case string-- -bool(false) - ---heredoc-- -bool(false) - ---instance of classWithToString-- - -Warning: interface_exists() expects parameter 2 to be bool, object given in %sinterface_exists_variation2.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: interface_exists() expects parameter 2 to be bool, object given in %sinterface_exists_variation2.php on line %d -NULL - ---undefined var-- -bool(false) - ---unset var-- -bool(false) -===DONE=== diff --git a/ext/standard/tests/class_object/is_a_variation_002.phpt b/ext/standard/tests/class_object/is_a_variation_002.phpt deleted file mode 100644 index 615a45ba33..0000000000 --- a/ext/standard/tests/class_object/is_a_variation_002.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test is_a() function : usage variations - wrong type for arg 2 ---FILE-- -<?php -/* Prototype : proto bool is_a(object object, string class_name) - * Description: Returns true if the object is of this class or has this class as one of its parents - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -class C { - function __toString() { - return "C Instance"; - } -} - -echo "*** Testing is_a() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$object = new stdclass(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new C, - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for class_name - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( is_a($object, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing is_a() : usage variations *** - -Notice: Undefined variable: undefined_var in %s on line 64 - -Notice: Undefined variable: unset_var in %s on line 67 - -Arg value 0 -bool(false) - -Arg value 1 -bool(false) - -Arg value 12345 -bool(false) - -Arg value -2345 -bool(false) - -Arg value 10.5 -bool(false) - -Arg value -10.5 -bool(false) - -Arg value 101234567000 -bool(false) - -Arg value 1.07654321E-9 -bool(false) - -Arg value 0.5 -bool(false) - -Arg value Array - -Warning: is_a() expects parameter 2 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: is_a() expects parameter 2 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: is_a() expects parameter 2 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: is_a() expects parameter 2 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: is_a() expects parameter 2 to be string, array given in %s on line %d -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -bool(false) - -Arg value -bool(false) - -Arg value 1 -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value C Instance -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt deleted file mode 100644 index a7ebab59c5..0000000000 --- a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt +++ /dev/null @@ -1,176 +0,0 @@ ---TEST-- -Test is_subclass_of() function : usage variations - unexpected type for arg 2 ---FILE-- -<?php -/* Prototype : proto bool is_subclass_of(object object, string class_name) - * Description: Returns true if the object has this class as one of its parents - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; -}); - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing is_subclass_of() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$object = new stdclass(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for class_name - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( is_subclass_of($object, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing is_subclass_of() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(67) -Error: 8 - Undefined variable: unset_var, %s(70) - -Arg value 0 -bool(false) - -Arg value 1 -bool(false) - -Arg value 12345 -bool(false) - -Arg value -2345 -bool(false) - -Arg value 10.5 -bool(false) - -Arg value -10.5 -bool(false) - -Arg value 101234567000 -bool(false) - -Arg value 1.07654321E-9 -bool(false) - -Arg value 0.5 -bool(false) -Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) - -Arg value Array -Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) - -Arg value Array -Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) - -Arg value Array -Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) - -Arg value Array -Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %sis_subclass_of_variation_002.php(%d) - -Arg value Array -Error: 2 - is_subclass_of() expects parameter 2 to be string, array given, %s(%d) -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -bool(false) - -Arg value -bool(false) - -Arg value 1 -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) -Error: 4096 - Object of class stdClass could not be converted to string, %s(%d) - -Arg value -Error: 2 - is_subclass_of() expects parameter 2 to be string, object given, %s(%d) -NULL - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/class_object/method_exists_variation_002.phpt b/ext/standard/tests/class_object/method_exists_variation_002.phpt deleted file mode 100644 index ad97d49df7..0000000000 --- a/ext/standard/tests/class_object/method_exists_variation_002.phpt +++ /dev/null @@ -1,176 +0,0 @@ ---TEST-- -Test method_exists() function : usage variations - unexpected type for arg 2 ---FILE-- -<?php -/* Prototype : proto bool method_exists(object object, string method) - * Description: Checks if the class method exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -spl_autoload_register(function ($className) { - echo "In autoload($className)\n"; -}); - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing method_exists() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$object = new stdclass(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for method - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( method_exists($object, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing method_exists() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(67) -Error: 8 - Undefined variable: unset_var, %s(70) - -Arg value 0 -bool(false) - -Arg value 1 -bool(false) - -Arg value 12345 -bool(false) - -Arg value -2345 -bool(false) - -Arg value 10.5 -bool(false) - -Arg value -10.5 -bool(false) - -Arg value 101234567000 -bool(false) - -Arg value 1.07654321E-9 -bool(false) - -Arg value 0.5 -bool(false) -Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %smethod_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - method_exists() expects parameter 2 to be string, array given, %s(77) -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -bool(false) - -Arg value -bool(false) - -Arg value 1 -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) -Error: 4096 - Object of class stdClass could not be converted to string, %s(76) - -Arg value -Error: 2 - method_exists() expects parameter 2 to be string, object given, %s(77) -NULL - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/class_object/trait_exists_variation_001.phpt b/ext/standard/tests/class_object/trait_exists_variation_001.phpt deleted file mode 100644 index b51126c1ed..0000000000 --- a/ext/standard/tests/class_object/trait_exists_variation_001.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test trait_exists() function : usage variations - unexpected types for argument 1 ---FILE-- -<?php -/* Prototype : proto bool trait_exists(string traitname [, bool autoload]) - * Description: Checks if the trait exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -spl_autoload_register(function ($traitName) { - echo "In autoload($traitName)\n"; -}); - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing trait_exists() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$autoload = true; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for traitname - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( trait_exists($value, $autoload) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing trait_exists() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(67) -Error: 8 - Undefined variable: unset_var, %s(70) - -Arg value 0 -In autoload(0) -bool(false) - -Arg value 1 -In autoload(1) -bool(false) - -Arg value 12345 -In autoload(12345) -bool(false) - -Arg value -2345 -bool(false) - -Arg value 10.5 -bool(false) - -Arg value -10.5 -bool(false) - -Arg value 101234567000 -In autoload(101234567000) -bool(false) - -Arg value 1.07654321E-9 -bool(false) - -Arg value 0.5 -bool(false) -Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_001.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 1 to be string, array given, %s(77) -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(1) -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(1) -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) -Error: 4096 - Object of class stdClass could not be converted to string, %s(76) - -Arg value -Error: 2 - trait_exists() expects parameter 1 to be string, object given, %s(77) -NULL - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/class_object/trait_exists_variation_002.phpt b/ext/standard/tests/class_object/trait_exists_variation_002.phpt deleted file mode 100644 index a4a4a209ec..0000000000 --- a/ext/standard/tests/class_object/trait_exists_variation_002.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test trait_exists() function : usage variations - unexpected types for argument 2 ---FILE-- -<?php -/* Prototype : proto bool trait_exists(string traitname [, bool autoload]) - * Description: Checks if the trait exists - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -spl_autoload_register(function ($traitName) { - echo "In autoload($traitName)\n"; -}); - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing trait_exists() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$traitname = 'string_val'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for autoload - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( trait_exists($traitname, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing trait_exists() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(71) -Error: 8 - Undefined variable: unset_var, %s(74) - -Arg value 0 -bool(false) - -Arg value 1 -In autoload(string_val) -bool(false) - -Arg value 12345 -In autoload(string_val) -bool(false) - -Arg value -2345 -In autoload(string_val) -bool(false) - -Arg value 10.5 -In autoload(string_val) -bool(false) - -Arg value -10.5 -In autoload(string_val) -bool(false) - -Arg value 101234567000 -In autoload(string_val) -bool(false) - -Arg value 1.07654321E-9 -In autoload(string_val) -bool(false) - -Arg value 0.5 -In autoload(string_val) -bool(false) -Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 2 to be bool, array given, %s(81) -NULL -Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d) - -Arg value Array -Error: 2 - trait_exists() expects parameter 2 to be bool, array given, %s(81) -NULL - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(string_val) -bool(false) - -Arg value -bool(false) - -Arg value 1 -In autoload(string_val) -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value -bool(false) - -Arg value string -In autoload(string_val) -bool(false) - -Arg value string -In autoload(string_val) -bool(false) -Error: 4096 - Object of class stdClass could not be converted to string, %s(80) - -Arg value -Error: 2 - trait_exists() expects parameter 2 to be bool, object given, %s(81) -NULL - -Arg value -bool(false) - -Arg value -bool(false) -Done diff --git a/ext/standard/tests/dir/opendir_basic.phpt b/ext/standard/tests/dir/opendir_basic.phpt index 373d25c470..fc5af44e66 100644 --- a/ext/standard/tests/dir/opendir_basic.phpt +++ b/ext/standard/tests/dir/opendir_basic.phpt @@ -13,7 +13,8 @@ Test opendir() function : basic functionality echo "*** Testing opendir() : basic functionality ***\n"; -$base_dir_path = dirname(__FILE__); +$base_dir_path = __DIR__ . '/opendir_basic'; +@mkdir($base_dir_path); $level_one_dir_name = "level_one"; $level_one_dir_path = "$base_dir_path/$level_one_dir_name"; @@ -42,9 +43,10 @@ var_dump($dh2); ===DONE=== --CLEAN-- <?php -$file_path = dirname(__FILE__); -rmdir("$file_path/level_one/level_two"); -rmdir("$file_path/level_one"); +$base_dir_path = __DIR__ . '/opendir_basic'; +rmdir("$base_dir_path/level_one/level_two"); +rmdir("$base_dir_path/level_one"); +rmdir($base_dir_path); ?> --EXPECTF-- *** Testing opendir() : basic functionality *** diff --git a/ext/standard/tests/dir/opendir_variation4.phpt b/ext/standard/tests/dir/opendir_variation4.phpt index 3a42c8d9c1..ea72c8b627 100644 --- a/ext/standard/tests/dir/opendir_variation4.phpt +++ b/ext/standard/tests/dir/opendir_variation4.phpt @@ -13,7 +13,8 @@ Test opendir() function : usage variations - different relative paths echo "*** Testing opendir() : usage variation ***\n"; -$base_dir_path = dirname(__FILE__); +$base_dir_path = __DIR__ . '/opendir_variation4'; +@mkdir($base_dir_path); $level_one_dir_name = "level_one"; $level_one_dir_path = "$base_dir_path/$level_one_dir_name"; @@ -72,9 +73,10 @@ function clean_dh($dh){ ===DONE=== --CLEAN-- <?php -$file_path = dirname(__FILE__); -rmdir("$file_path/level_one/level_two"); -rmdir("$file_path/level_one"); +$base_dir_path = __DIR__ . '/opendir_variation4'; +rmdir("$base_dir_path/level_one/level_two"); +rmdir("$base_dir_path/level_one"); +rmdir($base_dir_path); ?> --EXPECTF-- *** Testing opendir() : usage variation *** diff --git a/ext/standard/tests/dir/scandir_variation4.phpt b/ext/standard/tests/dir/scandir_variation4.phpt index ffffcd5069..2b7e6b6dbe 100644 --- a/ext/standard/tests/dir/scandir_variation4.phpt +++ b/ext/standard/tests/dir/scandir_variation4.phpt @@ -16,7 +16,8 @@ echo "*** Testing scandir() : usage variations ***\n"; // include for create_files/delete_files functions include (dirname(__FILE__) . '/../file/file.inc'); -$base_dir_path = dirname(__FILE__); +$base_dir_path = __DIR__ . '/scandir_variation4'; +@mkdir($base_dir_path); $level_one_dir_path = "$base_dir_path/level_one"; $level_two_dir_path = "$level_one_dir_path/level_two"; @@ -61,9 +62,10 @@ var_dump(scandir('../../level_one')); ===DONE=== --CLEAN-- <?php -$dir_path = dirname(__FILE__); -rmdir("$dir_path/level_one/level_two"); -rmdir("$dir_path/level_one"); +$base_dir_path = __DIR__ . '/scandir_variation4'; +rmdir("$base_dir_path/level_one/level_two"); +rmdir("$base_dir_path/level_one"); +rmdir($base_dir_path); ?> --EXPECT-- *** Testing scandir() : usage variations *** diff --git a/ext/standard/tests/file/basename_variation3.phpt b/ext/standard/tests/file/basename_variation3.phpt deleted file mode 100644 index 684e538d76..0000000000 --- a/ext/standard/tests/file/basename_variation3.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test basename() function : first parameter type variations ---FILE-- -<?php -/* Prototype : string basename(string path [, string suffix]) - * Description: Returns the filename component of the path - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing basename() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for path - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( basename($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing basename() : usage variation *** - ---int 0-- -string(1) "0" - ---int 1-- -string(1) "1" - ---int 12345-- -string(5) "12345" - ---int -12345-- -string(5) "-2345" - ---float 10.5-- -string(4) "10.5" - ---float -10.5-- -string(5) "-10.5" - ---float 12.3456789000e10-- -string(12) "123456789000" - ---float -12.3456789000e10-- -string(13) "-123456789000" - ---float .5-- -string(3) "0.5" - ---empty array-- -Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - basename() expects parameter 1 to be string, array given, %s(%d) -NULL - ---uppercase NULL-- -string(0) "" - ---lowercase null-- -string(0) "" - ---lowercase true-- -string(1) "1" - ---lowercase false-- -string(0) "" - ---uppercase TRUE-- -string(1) "1" - ---uppercase FALSE-- -string(0) "" - ---empty string DQ-- -string(0) "" - ---empty string SQ-- -string(0) "" - ---instance of classWithToString-- -string(14) "Class A object" - ---instance of classWithoutToString-- -Error: 2 - basename() expects parameter 1 to be string, object given, %s(%d) -NULL - ---undefined var-- -string(0) "" - ---unset var-- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/file/basename_variation4.phpt b/ext/standard/tests/file/basename_variation4.phpt deleted file mode 100644 index 2bb94870df..0000000000 --- a/ext/standard/tests/file/basename_variation4.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test basename() function : second parameter type variation ---FILE-- -<?php -/* Prototype : string basename(string path [, string suffix]) - * Description: Returns the filename component of the path - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing basename() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted -$path = 'path'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for suffix - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( basename($path, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing basename() : usage variation *** - ---int 0-- -string(4) "path" - ---int 1-- -string(4) "path" - ---int 12345-- -string(4) "path" - ---int -12345-- -string(4) "path" - ---float 10.5-- -string(4) "path" - ---float -10.5-- -string(4) "path" - ---float 12.3456789000e10-- -string(4) "path" - ---float -12.3456789000e10-- -string(4) "path" - ---float .5-- -string(4) "path" - ---empty array-- -Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - basename() expects parameter 2 to be string, array given, %s(%d) -NULL - ---uppercase NULL-- -string(4) "path" - ---lowercase null-- -string(4) "path" - ---lowercase true-- -string(4) "path" - ---lowercase false-- -string(4) "path" - ---uppercase TRUE-- -string(4) "path" - ---uppercase FALSE-- -string(4) "path" - ---empty string DQ-- -string(4) "path" - ---empty string SQ-- -string(4) "path" - ---instance of classWithToString-- -string(4) "path" - ---instance of classWithoutToString-- -Error: 2 - basename() expects parameter 2 to be string, object given, %s(%d) -NULL - ---undefined var-- -string(4) "path" - ---unset var-- -string(4) "path" -===DONE=== diff --git a/ext/standard/tests/file/bug27508.phpt b/ext/standard/tests/file/bug27508.phpt index e342a17348..82cafd735d 100644 --- a/ext/standard/tests/file/bug27508.phpt +++ b/ext/standard/tests/file/bug27508.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #27508 (userspace wrappers have bogus eof indicator) --FILE-- -<?php # vim:ft=php +<?php class FileStream { public $fp; diff --git a/ext/standard/tests/file/bug43353-win32.phpt b/ext/standard/tests/file/bug43353-win32.phpt deleted file mode 100644 index 76605d97a8..0000000000 --- a/ext/standard/tests/file/bug43353-win32.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #43353 wrong detection of 'data' wrapper ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Run only on Windows"); -?> ---INI-- -allow_url_fopen=1 ---FILE-- -<?php - -var_dump(is_dir('file:///datafoo:test')); -var_dump(is_dir('datafoo:test')); -var_dump(file_get_contents('data:text/plain,foo')); -var_dump(file_get_contents('datafoo:text/plain,foo')); - -?> ---EXPECTF-- -bool(false) -bool(false) -string(3) "foo" - -Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s -bool(false) diff --git a/ext/standard/tests/file/bug43353.phpt b/ext/standard/tests/file/bug43353.phpt index 87d0650006..d9576f24e2 100644 --- a/ext/standard/tests/file/bug43353.phpt +++ b/ext/standard/tests/file/bug43353.phpt @@ -1,10 +1,5 @@ --TEST-- Bug #43353 wrong detection of 'data' wrapper ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip on Windows"); -?> --INI-- allow_url_fopen=1 --FILE-- diff --git a/ext/standard/tests/file/bug44805.phpt b/ext/standard/tests/file/bug44805.phpt index 8e13c38629..c9a2918e9c 100644 --- a/ext/standard/tests/file/bug44805.phpt +++ b/ext/standard/tests/file/bug44805.phpt @@ -1,11 +1,5 @@ --TEST-- Bug#44806 (rename() function is not portable to Windows) ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only for Windows'); -} -?> --FILE-- <?php $dirname = dirname(__FILE__); diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt index 150333aa62..ce9f3b4099 100644 --- a/ext/standard/tests/file/bug60120.phpt +++ b/ext/standard/tests/file/bug60120.phpt @@ -2,9 +2,6 @@ Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048) --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip only for Windows'); -} $php = getenv('TEST_PHP_EXECUTABLE'); if (!$php) { die("skip No php executable defined\n"); diff --git a/ext/standard/tests/file/bug65272.phpt b/ext/standard/tests/file/bug65272.phpt index c6c6aa136e..81a1e48979 100644 --- a/ext/standard/tests/file/bug65272.phpt +++ b/ext/standard/tests/file/bug65272.phpt @@ -1,9 +1,5 @@ --TEST-- Bug #65272: flock() correctly sets wouldblock out param in windows ---SKIPIF-- -<?php -if (stripos(PHP_OS, 'win') !== 0) die("skip windows required"); -?> --FILE-- <?php diff --git a/ext/standard/tests/file/chmod_variation3.phpt b/ext/standard/tests/file/chmod_variation3.phpt deleted file mode 100644 index bc6f0dc860..0000000000 --- a/ext/standard/tests/file/chmod_variation3.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test chmod() function : first parameter variation ---FILE-- -<?php -/* Prototype : bool chmod(string filename, int mode) - * Description: Change file mode - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing chmod() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$mode = 0777; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for filename - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( chmod($value, $mode) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing chmod() : usage variation *** - ---int 0-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---int 1-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---float .5-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---empty array-- -Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - chmod() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---uppercase NULL-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---lowercase null-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---lowercase true-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - chmod(): No such file or directory, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - chmod() expects parameter 1 to be a valid path, object given, %s(%d) -NULL - ---undefined var-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) - ---unset var-- -Error: 2 - chmod(): %s, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/chmod_variation4.phpt b/ext/standard/tests/file/chmod_variation4.phpt deleted file mode 100644 index e0da9f66ee..0000000000 --- a/ext/standard/tests/file/chmod_variation4.phpt +++ /dev/null @@ -1,202 +0,0 @@ ---TEST-- -Test chmod() function : second parameter variation ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : bool chmod(string filename, int mode) - * Description: Change file mode - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing chmod() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted -$filename = __FILE__ . ".tmp"; -$fd = fopen($filename, "w+"); -fclose($fd); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for mode - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( chmod($filename, $value) ); -}; - -chmod($filename, 0777); -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing chmod() : usage variation *** - ---float 10.5-- -bool(true) - ---float -10.5-- -bool(true) - ---float 12.3456789000e10-- -bool(true) - ---float -12.3456789000e10-- -bool(true) - ---float .5-- -bool(true) - ---empty array-- -Error: 2 - chmod() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - chmod() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - chmod() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - chmod() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -bool(true) - ---lowercase false-- -bool(true) - ---uppercase TRUE-- -bool(true) - ---uppercase FALSE-- -bool(true) - ---empty string DQ-- -Error: 2 - chmod() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - chmod() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - chmod() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - chmod() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - chmod() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - chmod() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - chmod() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - chmod() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -bool(true) - ---unset var-- -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/dirname_variation1.phpt b/ext/standard/tests/file/dirname_variation1.phpt deleted file mode 100644 index 5e97982a9a..0000000000 --- a/ext/standard/tests/file/dirname_variation1.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test dirname() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : string dirname(string path) - * Description: Returns the directory name component of the path - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing dirname() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for path - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( dirname($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing dirname() : usage variation *** - ---int 0-- -string(1) "." - ---int 1-- -string(1) "." - ---int 12345-- -string(1) "." - ---int -12345-- -string(1) "." - ---float 10.5-- -string(1) "." - ---float -10.5-- -string(1) "." - ---float 12.3456789000e10-- -string(1) "." - ---float -12.3456789000e10-- -string(1) "." - ---float .5-- -string(1) "." - ---empty array-- -Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) -NULL - ---uppercase NULL-- -string(0) "" - ---lowercase null-- -string(0) "" - ---lowercase true-- -string(1) "." - ---lowercase false-- -string(0) "" - ---uppercase TRUE-- -string(1) "." - ---uppercase FALSE-- -string(0) "" - ---empty string DQ-- -string(0) "" - ---empty string SQ-- -string(0) "" - ---instance of classWithToString-- -string(1) "." - ---instance of classWithoutToString-- -Error: 2 - dirname() expects parameter 1 to be string, object given, %s(%d) -NULL - ---undefined var-- -string(0) "" - ---unset var-- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/file/fgetcsv_variation32.phpt b/ext/standard/tests/file/fgetcsv_variation32.phpt new file mode 100644 index 0000000000..eac1046c44 --- /dev/null +++ b/ext/standard/tests/file/fgetcsv_variation32.phpt @@ -0,0 +1,32 @@ +--TEST-- +fgetcsv() with empty $escape +--FILE-- +<?php +$contents = <<<EOS +"cell1","cell2\\","cell3","cell4" +"\\\\\\line1 +line2\\\\\\" +EOS; +$stream = fopen('php://memory', 'w+'); +fwrite($stream, $contents); +rewind($stream); +while (($data = fgetcsv($stream, 0, ',', '"', '')) !== false) { + print_r($data); +} +fclose($stream); +?> +===DONE=== +--EXPECT-- +Array +( + [0] => cell1 + [1] => cell2\ + [2] => cell3 + [3] => cell4 +) +Array +( + [0] => \\\line1 +line2\\\ +) +===DONE=== diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index a0b62bffc7..eda2b32c78 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -218,7 +218,7 @@ function change_file_perms($file_path, If imporper $content type is specified, file is created as empty $size = size of the fill in terms of kilobyte, i.e size of the file. if $flag is specified as "byte", then then given size is taken in bytes - $flag = specifiy if size has to be treated as no of total bytes or + $flag = specify if size has to be treated as no of total bytes or multiple of KB. "kilobytes" = take size in terms of multiple of KB "byte" = take size in terms of bytes diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt index 1437b8a8a0..45c376b913 100644 --- a/ext/standard/tests/file/file_get_contents_error001.phpt +++ b/ext/standard/tests/file/file_get_contents_error001.phpt @@ -8,11 +8,10 @@ display_errors=false --SKIPIF-- <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); - if (getenv("SKIP_ONLINE_TESTS")) die("skip online test"); ?> --FILE-- <?php - var_dump(file_get_contents("http://checkip.dyndns.com",null,null,8000,1)); + var_dump(file_get_contents("php://stdin",null,null,8000,1)); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/file/file_get_contents_variation3.phpt b/ext/standard/tests/file/file_get_contents_variation3.phpt deleted file mode 100644 index 9e8de27f3f..0000000000 --- a/ext/standard/tests/file/file_get_contents_variation3.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test file_get_contents() function : usage variation - different type for use_include_path ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) - * Description: Read the entire file into a string - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file_get_contents() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'FileGetContentsVar3.tmp'; -$absFile = dirname(__FILE__).'/'.$filename; -$h = fopen($absFile,"w"); -fwrite($h, "contents read"); -fclose($h); - - - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for use_include_path - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file_get_contents($absFile, $value) ); -}; - -unlink($absFile); - -?> -===DONE=== ---EXPECTF-- -*** Testing file_get_contents() : usage variation *** - ---int 0-- -string(13) "contents read" - ---int 1-- -string(13) "contents read" - ---int 12345-- -string(%d) "contents read" - ---int -12345-- -string(%d) "contents read" - ---float 10.5-- -string(%d) "contents read" - ---float -10.5-- -string(%d) "contents read" - ---float 12.3456789000e10-- -string(%d) "contents read" - ---float -12.3456789000e10-- -string(%d) "contents read" - ---float .5-- -string(%d) "contents read" - ---empty array-- -Error: 2 - file_get_contents() expects parameter 2 to be bool, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file_get_contents() expects parameter 2 to be bool, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file_get_contents() expects parameter 2 to be bool, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file_get_contents() expects parameter 2 to be bool, array given, %s(%d) -NULL - ---uppercase NULL-- -string(%d) "contents read" - ---lowercase null-- -string(%d) "contents read" - ---lowercase true-- -string(%d) "contents read" - ---lowercase false-- -string(%d) "contents read" - ---uppercase TRUE-- -string(%d) "contents read" - ---uppercase FALSE-- -string(%d) "contents read" - ---empty string DQ-- -string(%d) "contents read" - ---empty string SQ-- -string(%d) "contents read" - ---string DQ-- -string(%d) "contents read" - ---string SQ-- -string(%d) "contents read" - ---mixed case string-- -string(%d) "contents read" - ---heredoc-- -string(%d) "contents read" - ---instance of classWithToString-- -Error: 2 - file_get_contents() expects parameter 2 to be bool, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file_get_contents() expects parameter 2 to be bool, object given, %s(%d) -NULL - ---undefined var-- -string(%d) "contents read" - ---unset var-- -string(%d) "contents read" -===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation4.phpt b/ext/standard/tests/file/file_get_contents_variation4.phpt deleted file mode 100644 index 0ca7a6bf20..0000000000 --- a/ext/standard/tests/file/file_get_contents_variation4.phpt +++ /dev/null @@ -1,251 +0,0 @@ ---TEST-- -Test file_get_contents() function : usage variation - different types for context. ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) - * Description: Read the entire file into a string - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file_get_contents() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'FileGetContentsVar4.tmp'; -$absFile = dirname(__FILE__).'/'.$filename; -$h = fopen($absFile,"w"); -fwrite($h, "contents read"); -fclose($h); - -$fileRes = fopen(__FILE__,'r'); -$strContext = stream_context_create(); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - //non context resource - 'file resource' => $fileRes, - - //valid stream context - 'stream context' => $strContext, -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file_get_contents($absFile, false, $value) ); -}; - -unlink($absFile); -fclose($fileRes); - -?> -===DONE=== ---EXPECTF-- -*** Testing file_get_contents() : usage variation *** - ---int 0-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---int 1-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---int 12345-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---int -12345-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---float 10.5-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float -10.5-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float 12.3456789000e10-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float -12.3456789000e10-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float .5-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---empty array-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---uppercase NULL-- -string(%d) "contents read" - ---lowercase null-- -string(%d) "contents read" - ---lowercase true-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---lowercase false-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---uppercase TRUE-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---uppercase FALSE-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---empty string DQ-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file_get_contents() expects parameter 3 to be resource, object given, %s(%d) -NULL - ---undefined var-- -string(%d) "contents read" - ---unset var-- -string(%d) "contents read" - ---file resource-- -Error: 2 - file_get_contents(): supplied resource is not a valid Stream-Context resource, %s(%d) -string(%d) "contents read" - ---stream context-- -string(%d) "contents read" -===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt b/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt deleted file mode 100644 index 6cc2054589..0000000000 --- a/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test file_get_contents() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) - * Description: Read the entire file into a string - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file_get_contents() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'FileGetContentsVar5.tmp'; -$absFile = dirname(__FILE__).'/'.$filename; -$h = fopen($absFile,"w"); -fwrite($h, "contents read"); -fclose($h); - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - 'int -10' => -10, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float -22.5' => -22.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for offset - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file_get_contents($absFile, false, null, $value) ); -}; - -unlink($absFile); - -?> -===DONE=== ---EXPECTF-- -*** Testing file_get_contents() : usage variation *** - ---int 0-- -string(%d) "contents read" - ---int 1-- -string(%d) "ontents read" - ---int 12345-- -string(%d) "" - ---int -12345-- -Error: 2 - file_get_contents(): Failed to seek to position -12345 in the stream, %s(%d) -bool(false) - ---int -10-- -string(10) "tents read" - ---float 10.5-- -string(3) "ead" - ---float -10.5-- -string(10) "tents read" - ---float -22.5-- -Error: 2 - file_get_contents(): Failed to seek to position -22 in the stream, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - file_get_contents() expects parameter 4 to be int, float given, %s(%d) -NULL - ---float -12.3456789000e10-- -Error: 2 - file_get_contents() expects parameter 4 to be int, float given, %s(%d) -NULL - ---float .5-- -string(%d) "contents read" - ---empty array-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -string(%d) "contents read" - ---lowercase null-- -string(%d) "contents read" - ---lowercase true-- -string(12) "ontents read" - ---lowercase false-- -string(%d) "contents read" - ---uppercase TRUE-- -string(12) "ontents read" - ---uppercase FALSE-- -string(%d) "contents read" - ---empty string DQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - file_get_contents() expects parameter 4 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file_get_contents() expects parameter 4 to be int, object given, %s(%d) -NULL - ---undefined var-- -string(%d) "contents read" - ---unset var-- -string(%d) "contents read" -===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt b/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt deleted file mode 100644 index d0b74757d2..0000000000 --- a/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt +++ /dev/null @@ -1,235 +0,0 @@ ---TEST-- -Test file_get_contents() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) - * Description: Read the entire file into a string - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file_get_contents() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'FileGetContentsVar5.tmp'; -$absFile = dirname(__FILE__).'/'.$filename; -$h = fopen($absFile,"w"); -fwrite($h, "contents read"); -fclose($h); - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - 'int -10' => -10, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float -22.5' => -22.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for offset - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file_get_contents($absFile, false, null, $value) ); -}; - -unlink($absFile); - -?> -===DONE=== ---EXPECTF-- -*** Testing file_get_contents() : usage variation *** - ---int 0-- -string(%d) "contents read" - ---int 1-- -string(%d) "ontents read" - ---int 12345-- -string(%d) "" - ---int -12345-- -Error: 2 - file_get_contents(): Failed to seek to position -12345 in the stream, %s(%d) -bool(false) - ---int -10-- -string(10) "tents read" - ---float 10.5-- -string(3) "ead" - ---float -10.5-- -string(10) "tents read" - ---float -22.5-- -Error: 2 - file_get_contents(): Failed to seek to position -22 in the stream, %s(%d) -bool(false) - ---float 12.3456789000e10-- -string(%d) %s - ---float -12.3456789000e10-- -Error: 2 - file_get_contents(): Failed to seek to position -123456789000 in the stream, %s(%d) -bool(false) - ---float .5-- -string(%d) "contents read" - ---empty array-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file_get_contents() expects parameter 4 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -string(%d) "contents read" - ---lowercase null-- -string(%d) "contents read" - ---lowercase true-- -string(12) "ontents read" - ---lowercase false-- -string(%d) "contents read" - ---uppercase TRUE-- -string(12) "ontents read" - ---uppercase FALSE-- -string(%d) "contents read" - ---empty string DQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - file_get_contents() expects parameter 4 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - file_get_contents() expects parameter 4 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file_get_contents() expects parameter 4 to be int, object given, %s(%d) -NULL - ---undefined var-- -string(%d) "contents read" - ---unset var-- -string(%d) "contents read" -===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation6.phpt b/ext/standard/tests/file/file_get_contents_variation6.phpt deleted file mode 100644 index f30cac10d2..0000000000 --- a/ext/standard/tests/file/file_get_contents_variation6.phpt +++ /dev/null @@ -1,215 +0,0 @@ ---TEST-- -Test file_get_contents() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) - * Description: Read the entire file into a string - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file_get_contents() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'FileGetContentsVar5.tmp'; -$absFile = dirname(__FILE__).'/'.$filename; -$h = fopen($absFile,"w"); -fwrite($h, "contents read"); -fclose($h); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for maxlen - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file_get_contents($absFile, false, null, 0, $value) ); -}; - -unlink($absFile); - -?> -===DONE=== ---EXPECTF-- -*** Testing file_get_contents() : usage variation *** - ---int 0-- -string(%d) "" - ---int 1-- -string(%d) "c" - ---int 12345-- -string(%d) "contents read" - ---int -12345-- -Error: 2 - file_get_contents(): length must be greater than or equal to zero, %s(%d) -bool(false) - ---float 10.5-- -string(%d) "contents r" - ---float -10.5-- -Error: 2 - file_get_contents(): length must be greater than or equal to zero, %s(%d) -bool(false) - ---float .5-- -string(%d) "" - ---empty array-- -Error: 2 - file_get_contents() expects parameter 5 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file_get_contents() expects parameter 5 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file_get_contents() expects parameter 5 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file_get_contents() expects parameter 5 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -string(%d) "" - ---lowercase null-- -string(%d) "" - ---lowercase true-- -string(%d) "c" - ---lowercase false-- -string(%d) "" - ---uppercase TRUE-- -string(%d) "c" - ---uppercase FALSE-- -string(%d) "" - ---empty string DQ-- -Error: 2 - file_get_contents() expects parameter 5 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - file_get_contents() expects parameter 5 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - file_get_contents() expects parameter 5 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - file_get_contents() expects parameter 5 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - file_get_contents() expects parameter 5 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - file_get_contents() expects parameter 5 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - file_get_contents() expects parameter 5 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file_get_contents() expects parameter 5 to be int, object given, %s(%d) -NULL - ---undefined var-- -string(%d) "" - ---unset var-- -string(%d) "" -===DONE=== diff --git a/ext/standard/tests/file/file_variation2.phpt b/ext/standard/tests/file/file_variation2.phpt deleted file mode 100644 index 9c3ad0e546..0000000000 --- a/ext/standard/tests/file/file_variation2.phpt +++ /dev/null @@ -1,210 +0,0 @@ ---TEST-- -Test file() function : first parameter variation ---FILE-- -<?php -/* Prototype : array file(string filename [, int flags[, resource context]]) - * Description: Read entire file into an array - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted -$flags = 0; -$context = stream_context_create(); - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for filename - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file($value, $flags, $context) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing file() : usage variation *** - ---int 0-- -Error: 2 - file(0): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---int 1-- -Error: 2 - file(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - file(12345): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - file(-2345): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - file(10.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - file(-10.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - file(123456789000): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - file(-123456789000): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float .5-- -Error: 2 - file(0.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---empty array-- -Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file() expects parameter 1 to be a valid path, array given, %s(%d) -NULL - ---uppercase NULL-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---lowercase null-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---lowercase true-- -Error: 2 - file(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - file(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - file(Class A object): failed to open stream: %s, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - file() expects parameter 1 to be a valid path, object given, %s(%d) -NULL - ---undefined var-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) - ---unset var-- -Error: 2 - file(): Filename cannot be empty, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/file_variation3.phpt b/ext/standard/tests/file/file_variation3.phpt deleted file mode 100644 index 014adec6d8..0000000000 --- a/ext/standard/tests/file/file_variation3.phpt +++ /dev/null @@ -1,296 +0,0 @@ ---TEST-- -Test file() function : second parameter variation ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : array file(string filename [, int flags[, resource context]]) - * Description: Read entire file into an array - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted -$filename = __FILE__ . ".tmp"; -$fd = fopen($filename, "w+"); -fwrite($fd, "Line 1\nLine 2\nLine 3"); -fclose($fd); - -$context = stream_context_create(); - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for flags - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file($filename, $value, $context) ); -}; - -unlink(__FILE__ . ".tmp"); - -?> -===DONE=== ---EXPECTF-- -*** Testing file() : usage variation *** - ---float 10.5-- -array(3) { - [0]=> - string(6) "Line 1" - [1]=> - string(6) "Line 2" - [2]=> - string(6) "Line 3" -} - ---float -10.5-- -Error: 2 - file(): '-10' flag is not supported, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - file(): '%i' flag is not supported, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - file(): '%i' flag is not supported, %s(%d) -bool(false) - ---float .5-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---empty array-- -Error: 2 - file() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---lowercase null-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---lowercase true-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---lowercase false-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---uppercase TRUE-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---uppercase FALSE-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---empty string DQ-- -Error: 2 - file() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - file() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - file() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - file() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - file() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - file() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - file() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---unset var-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} -===DONE=== diff --git a/ext/standard/tests/file/file_variation4.phpt b/ext/standard/tests/file/file_variation4.phpt deleted file mode 100644 index 103c2b0af6..0000000000 --- a/ext/standard/tests/file/file_variation4.phpt +++ /dev/null @@ -1,291 +0,0 @@ ---TEST-- -Test file() function : third parameter variation ---FILE-- -<?php -/* Prototype : array file(string filename [, int flags[, resource context]]) - * Description: Read entire file into an array - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing file() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted -$filename = __FILE__ . ".tmp"; -$fd = fopen($filename, "w+"); -fwrite($fd, "Line 1\nLine 2\nLine 3"); -fclose($fd); - -$flags = 0; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// create a file stream resource -$tmp_filename = __FILE__ . ".tmp2"; -$file_stream_resource = fopen($tmp_filename, "w+"); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // file stream resource - 'file stream resource' => $file_stream_resource, -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( file($filename, $flags, $value) ); -}; - -fclose($file_stream_resource); -unlink($tmp_filename); -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing file() : usage variation *** - ---int 0-- -Error: 2 - file() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---int 1-- -Error: 2 - file() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---int 12345-- -Error: 2 - file() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---int -12345-- -Error: 2 - file() expects parameter 3 to be resource, int given, %s(%d) -NULL - ---float 10.5-- -Error: 2 - file() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float -10.5-- -Error: 2 - file() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float 12.3456789000e10-- -Error: 2 - file() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float -12.3456789000e10-- -Error: 2 - file() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---float .5-- -Error: 2 - file() expects parameter 3 to be resource, float given, %s(%d) -NULL - ---empty array-- -Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - file() expects parameter 3 to be resource, array given, %s(%d) -NULL - ---uppercase NULL-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---lowercase null-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---lowercase true-- -Error: 2 - file() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---lowercase false-- -Error: 2 - file() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---uppercase TRUE-- -Error: 2 - file() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---uppercase FALSE-- -Error: 2 - file() expects parameter 3 to be resource, bool given, %s(%d) -NULL - ---empty string DQ-- -Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - file() expects parameter 3 to be resource, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - file() expects parameter 3 to be resource, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - file() expects parameter 3 to be resource, object given, %s(%d) -NULL - ---undefined var-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---unset var-- -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} - ---file stream resource-- -Error: 2 - file(): supplied resource is not a valid Stream-Context resource, %s(%d) -array(3) { - [0]=> - string(7) "Line 1 -" - [1]=> - string(7) "Line 2 -" - [2]=> - string(6) "Line 3" -} -===DONE=== diff --git a/ext/standard/tests/file/fnmatch_maxpathlen.phpt b/ext/standard/tests/file/fnmatch_maxpathlen.phpt new file mode 100644 index 0000000000..849e7710bb --- /dev/null +++ b/ext/standard/tests/file/fnmatch_maxpathlen.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test fnmatch() function : warning filename or pattern exceeds maxpathlen +--SKIPIF-- +<?php +if (!function_exists('fnmatch')) die('skip fnmatch() function is not available'); +?> +--FILE-- +<?php +$longstring = str_pad('blah', PHP_MAXPATHLEN); +var_dump(fnmatch('blah', $longstring)); +var_dump(fnmatch($longstring, 'blah')); +?> +--EXPECTF-- +Warning: fnmatch(): Filename exceeds the maximum allowed length of %d characters in %s on line %d +bool(false) + +Warning: fnmatch(): Pattern exceeds the maximum allowed length of %d characters in %s on line %d +bool(false) diff --git a/ext/standard/tests/file/fopen_variation3.phpt b/ext/standard/tests/file/fopen_variation3.phpt deleted file mode 100644 index fb00b243fc..0000000000 --- a/ext/standard/tests/file/fopen_variation3.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fopen() function : usage variation different datatypes for use_include_path ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) - * Description: Open a file or a URL and return a file pointer - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing fopen() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = __FILE__; -$mode = 'r'; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for use_include_path - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $h = fopen($filename, $mode, $value); - if ($h !== false) { - echo "ok\n"; - fclose($h); - } - else { - var_dump($h); - } -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing fopen() : usage variation *** - ---int 0-- -ok - ---int 1-- -ok - ---int 12345-- -ok - ---int -12345-- -ok - ---float 10.5-- -ok - ---float -10.5-- -ok - ---float 12.3456789000e10-- -ok - ---float -12.3456789000e10-- -ok - ---float .5-- -ok - ---empty array-- -Error: 2 - fopen() expects parameter 3 to be bool, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - fopen() expects parameter 3 to be bool, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - fopen() expects parameter 3 to be bool, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - fopen() expects parameter 3 to be bool, array given, %s(%d) -bool(false) - ---uppercase NULL-- -ok - ---lowercase null-- -ok - ---lowercase true-- -ok - ---lowercase false-- -ok - ---uppercase TRUE-- -ok - ---uppercase FALSE-- -ok - ---empty string DQ-- -ok - ---empty string SQ-- -ok - ---string DQ-- -ok - ---string SQ-- -ok - ---mixed case string-- -ok - ---heredoc-- -ok - ---instance of classWithToString-- -Error: 2 - fopen() expects parameter 3 to be bool, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - fopen() expects parameter 3 to be bool, object given, %s(%d) -bool(false) - ---undefined var-- -ok - ---unset var-- -ok -===DONE=== diff --git a/ext/standard/tests/file/fopen_variation4.phpt b/ext/standard/tests/file/fopen_variation4.phpt deleted file mode 100644 index 15f9e60c5a..0000000000 --- a/ext/standard/tests/file/fopen_variation4.phpt +++ /dev/null @@ -1,247 +0,0 @@ ---TEST-- -Test fopen() function : usage variation different datatypes for stream context ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) - * Description: Open a file or a URL and return a file pointer - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing fopen() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = __FILE__; -$mode = 'r'; -$use_include_path = false; -$fileresource = fopen($filename, $mode); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - //file resource - 'file resource' => $fileresource -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $h = fopen($filename, $mode, false, $value); - if ($h !== false) { - echo "ok\n"; - fclose($h); - } - else { - var_dump($h); - } -}; - -fclose($fileresource); - -?> -===DONE=== ---EXPECTF-- -*** Testing fopen() : usage variation *** - ---int 0-- -Error: 2 - fopen() expects parameter 4 to be resource, int given, %s(%d) -bool(false) - ---int 1-- -Error: 2 - fopen() expects parameter 4 to be resource, int given, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - fopen() expects parameter 4 to be resource, int given, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - fopen() expects parameter 4 to be resource, int given, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - fopen() expects parameter 4 to be resource, float given, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - fopen() expects parameter 4 to be resource, float given, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - fopen() expects parameter 4 to be resource, float given, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - fopen() expects parameter 4 to be resource, float given, %s(%d) -bool(false) - ---float .5-- -Error: 2 - fopen() expects parameter 4 to be resource, float given, %s(%d) -bool(false) - ---empty array-- -Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) -bool(false) - ---uppercase NULL-- -ok - ---lowercase null-- -ok - ---lowercase true-- -Error: 2 - fopen() expects parameter 4 to be resource, bool given, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - fopen() expects parameter 4 to be resource, bool given, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - fopen() expects parameter 4 to be resource, bool given, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - fopen() expects parameter 4 to be resource, bool given, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) -bool(false) - ---string DQ-- -Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) -bool(false) - ---string SQ-- -Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) -bool(false) - ---mixed case string-- -Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) -bool(false) - ---heredoc-- -Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - fopen() expects parameter 4 to be resource, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - fopen() expects parameter 4 to be resource, object given, %s(%d) -bool(false) - ---undefined var-- -ok - ---unset var-- -ok - ---file resource-- -Error: 2 - fopen(): supplied resource is not a valid Stream-Context resource, %s(%d) -ok -===DONE=== diff --git a/ext/standard/tests/file/fopencookie.phpt b/ext/standard/tests/file/fopencookie.phpt index 79922e31e1..a332d378ca 100644 --- a/ext/standard/tests/file/fopencookie.phpt +++ b/ext/standard/tests/file/fopencookie.phpt @@ -2,7 +2,6 @@ fopencookie detected and working (or cast mechanism works) --FILE-- <?php -# vim600:syn=php: /* This test verifies that the casting mechanism is working correctly. * On systems with fopencookie, a FILE* is created around the user diff --git a/ext/standard/tests/file/fpassthru_variation1.phpt b/ext/standard/tests/file/fpassthru_variation1.phpt deleted file mode 100644 index 2df9b1ce20..0000000000 --- a/ext/standard/tests/file/fpassthru_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test fpassthru() function : usage variations - different parameter types ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : proto int fpassthru(resource fp) - * Description: Output all remaining data from a file pointer - * Source code: ext/standard/file.c - * Alias to functions: gzpassthru - */ - -echo "*** Testing fpassthru() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -class testClass { - public function __toString() { - return "testClass"; - } -} - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new testClass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for fp - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( fpassthru($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing fpassthru() : usage variations *** - -Arg value 0 - -Warning: fpassthru() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Arg value 1 - -Warning: fpassthru() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Arg value 12345 - -Warning: fpassthru() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Arg value -2345 - -Warning: fpassthru() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Arg value 10.5 - -Warning: fpassthru() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Arg value -10.5 - -Warning: fpassthru() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Arg value 101234567000 - -Warning: fpassthru() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Arg value 1.07654321E-9 - -Warning: fpassthru() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Arg value 0.5 - -Warning: fpassthru() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Arg value Array - -Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Arg value Array - -Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Arg value Array - -Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Arg value Array - -Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Arg value Array - -Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Arg value 1 - -Warning: fpassthru() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Arg value 1 - -Warning: fpassthru() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Arg value string - -Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Arg value string - -Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Arg value testClass - -Warning: fpassthru() expects parameter 1 to be resource, object given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Arg value - -Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fputcsv_variation15.phpt b/ext/standard/tests/file/fputcsv_variation15.phpt index dc4a9e2dbd..dc4a9e2dbd 100755..100644 --- a/ext/standard/tests/file/fputcsv_variation15.phpt +++ b/ext/standard/tests/file/fputcsv_variation15.phpt diff --git a/ext/standard/tests/file/fputcsv_variation16.phpt b/ext/standard/tests/file/fputcsv_variation16.phpt new file mode 100644 index 0000000000..1bae60da20 --- /dev/null +++ b/ext/standard/tests/file/fputcsv_variation16.phpt @@ -0,0 +1,21 @@ +--TEST-- +fputcsv() with empty $escape +--FILE-- +<?php +$data = array( + ['\\'], + ['\\"'] +); +$stream = fopen('php://memory', 'w+'); +foreach ($data as $record) { + fputcsv($stream, $record, ',', '"', ''); +} +rewind($stream); +echo stream_get_contents($stream); +fclose($stream); +?> +===DONE=== +--EXPECT-- +\ +"\""" +===DONE=== diff --git a/ext/standard/tests/file/fseek_variation1.phpt b/ext/standard/tests/file/fseek_variation1.phpt deleted file mode 100644 index 0736d232c8..0000000000 --- a/ext/standard/tests/file/fseek_variation1.phpt +++ /dev/null @@ -1,197 +0,0 @@ ---TEST-- -Test fseek() function : usage variations - different types for offset ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : proto int fseek(resource fp, int offset [, int whence]) - * Description: Seek on a file pointer - * Source code: ext/standard/file.c - * Alias to functions: gzseek - */ - -echo "*** Testing fseek() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); - -// Initialise function arguments not being substituted (if any) - -$fp = fopen(__FILE__, 'r'); -$whence = SEEK_SET; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -class testClass { - public function __toString() { - return "testClass"; - } -} - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new testClass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for offset - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( fseek($fp, $value, $whence) ); - var_dump( ftell($fp)); -}; -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing fseek() : usage variations *** - -Arg value 10.5 -int(0) -int(10) - -Arg value -10.5 -int(-1) -int(10) - -Arg value 1.07654321E-9 -int(0) -int(0) - -Arg value 0.5 -int(0) -int(0) - -Arg value Array - -Warning: fseek() expects parameter 2 to be int, array given in %s on line %d -bool(false) -int(0) - -Arg value Array - -Warning: fseek() expects parameter 2 to be int, array given in %s on line %d -bool(false) -int(0) - -Arg value Array - -Warning: fseek() expects parameter 2 to be int, array given in %s on line %d -bool(false) -int(0) - -Arg value Array - -Warning: fseek() expects parameter 2 to be int, array given in %s on line %d -bool(false) -int(0) - -Arg value Array - -Warning: fseek() expects parameter 2 to be int, array given in %s on line %d -bool(false) -int(0) - -Arg value -int(0) -int(0) - -Arg value -int(0) -int(0) - -Arg value 1 -int(0) -int(1) - -Arg value -int(0) -int(0) - -Arg value 1 -int(0) -int(1) - -Arg value -int(0) -int(0) - -Arg value - -Warning: fseek() expects parameter 2 to be int, string given in %s on line %d -bool(false) -int(0) - -Arg value - -Warning: fseek() expects parameter 2 to be int, string given in %s on line %d -bool(false) -int(0) - -Arg value string - -Warning: fseek() expects parameter 2 to be int, string given in %s on line %d -bool(false) -int(0) - -Arg value string - -Warning: fseek() expects parameter 2 to be int, string given in %s on line %d -bool(false) -int(0) - -Arg value testClass - -Warning: fseek() expects parameter 2 to be int, object given in %s on line %d -bool(false) -int(0) - -Arg value -int(0) -int(0) - -Arg value -int(0) -int(0) -Done diff --git a/ext/standard/tests/file/fseek_variation2.phpt b/ext/standard/tests/file/fseek_variation2.phpt deleted file mode 100644 index 38f9561394..0000000000 --- a/ext/standard/tests/file/fseek_variation2.phpt +++ /dev/null @@ -1,160 +0,0 @@ ---TEST-- -Test fseek() function : usage variations - different types for whence ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : proto int fseek(resource fp, int offset [, int whence]) - * Description: Seek on a file pointer - * Source code: ext/standard/file.c - * Alias to functions: gzseek - */ - -echo "*** Testing fseek() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); -$fp = fopen(__FILE__, 'r'); -$offset = 3; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // outside of whence range - -100, - 100, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for whence - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( fseek($fp, $offset, $value) ); - var_dump( ftell($fp)); -}; - -fclose($fp); -echo "Done"; -?> ---EXPECTF-- -*** Testing fseek() : usage variations *** - -Arg value -100 -int(-1) -int(0) - -Arg value 100 -int(-1) -int(0) - -Arg value 10.5 -int(-1) -int(0) - -Arg value -10.5 -int(-1) -int(0) - -Arg value 101234567000 -int(-1) -int(0) - -Arg value 1.07654321E-9 -int(0) -int(3) - -Arg value 0.5 -int(0) -int(3) - -Arg value -int(0) -int(3) - -Arg value -int(0) -int(3) - -Arg value 1 -int(0) -int(6) - -Arg value -int(0) -int(3) - -Arg value 1 -int(0) -int(6) - -Arg value -int(0) -int(3) - -Arg value - -Warning: fseek() expects parameter 3 to be int, string given in %s on line %d -bool(false) -int(3) - -Arg value - -Warning: fseek() expects parameter 3 to be int, string given in %s on line %d -bool(false) -int(3) - -Arg value string - -Warning: fseek() expects parameter 3 to be int, string given in %s on line %d -bool(false) -int(3) - -Arg value string - -Warning: fseek() expects parameter 3 to be int, string given in %s on line %d -bool(false) -int(3) - -Arg value -int(0) -int(3) - -Arg value -int(0) -int(3) -Done diff --git a/ext/standard/tests/file/fstat_variation3.phpt b/ext/standard/tests/file/fstat_variation3.phpt deleted file mode 100644 index 829f5ba075..0000000000 --- a/ext/standard/tests/file/fstat_variation3.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test function fstat() by substituting argument 1 with emptyUnsetUndefNull values. ---FILE-- -<?php -$unset_var = 10; -unset($unset_var); - -$variation_array = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null, - ); - - -foreach ( $variation_array as $var ) { - var_dump(fstat( $var ) ); -} -?> -===DONE=== ---EXPECTF-- -Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: fstat() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fstat() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/fstat_variation6.phpt b/ext/standard/tests/file/fstat_variation6.phpt deleted file mode 100644 index c720c6f25a..0000000000 --- a/ext/standard/tests/file/fstat_variation6.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test function fstat() by substituting argument 1 with object values. ---FILE-- -<?php - - - - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - - - -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -$variation_array = array( - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - ); - - -foreach ( $variation_array as $var ) { - var_dump(fstat( $var ) ); -} -?> -===DONE=== ---EXPECTF-- -Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d) -bool(false) -Error: 2 - fstat() expects parameter 1 to be resource, object given, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/fwrite_variation5.phpt b/ext/standard/tests/file/fwrite_variation5.phpt deleted file mode 100644 index ff1214c527..0000000000 --- a/ext/standard/tests/file/fwrite_variation5.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test fwrite() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : int fwrite(resource fp, string str [, int length]) - * Description: Binary-safe file write - * Source code: ext/standard/file.c - * Alias to functions: bzwrite fputs gzwrite - */ - -echo "*** Testing fwrite() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -$filename = __DIR__ . '/fwriteVar5.tmp'; - - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for str - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $fp = fopen($filename,'w'); - fwrite($fp, $value); - fclose($fp); - readfile($filename); -}; -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing fwrite() : usage variation *** - ---int 0-- -0 ---int 1-- -1 ---int 12345-- -12345 ---int -12345-- --2345 ---float 10.5-- -10.5 ---float -10.5-- --10.5 ---float 12.3456789000e10-- -123456789000 ---float -12.3456789000e10-- --123456789000 ---float .5-- -0.5 ---empty array-- -Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) - ---int indexed array-- -Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) - ---associative array-- -Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) - ---nested arrays-- -Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) - ---uppercase NULL-- - ---lowercase null-- - ---lowercase true-- -1 ---lowercase false-- - ---uppercase TRUE-- -1 ---uppercase FALSE-- - ---empty string DQ-- - ---empty string SQ-- - ---instance of classWithToString-- -Class A object ---instance of classWithoutToString-- -Error: 2 - fwrite() expects parameter 2 to be string, object given, %s(%d) - ---undefined var-- - ---unset var-- -===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation1-win32.phpt b/ext/standard/tests/file/mkdir_variation1-win32.phpt deleted file mode 100644 index cee03858cb..0000000000 --- a/ext/standard/tests/file/mkdir_variation1-win32.phpt +++ /dev/null @@ -1,122 +0,0 @@ ---TEST-- -Test mkdir() function : usage variation: try invalid pathname ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Only valid for Windows"); -?> ---FILE-- -<?php -/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) - * Description: Create a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing mkdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase false' =>false, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // other - // php.net bug outputs message File Exists - 'single space' => ' ', -); - -// loop through each element of the array for pathname - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $res = mkdir($value); - if ($res == true) { - echo "directory created\n"; - rmdir($value); - } -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing mkdir() : usage variation *** - ---uppercase NULL-- -Error: 2 - mkdir(): %s, %s(%d) - ---lowercase null-- -Error: 2 - mkdir(): %s, %s(%d) - ---lowercase false-- -Error: 2 - mkdir(): %s, %s(%d) - ---uppercase FALSE-- -Error: 2 - mkdir(): %s, %s(%d) - ---empty string DQ-- -Error: 2 - mkdir(): %s, %s(%d) - ---empty string SQ-- -Error: 2 - mkdir(): %s, %s(%d) - ---undefined var-- -Error: 2 - mkdir(): %s, %s(%d) - ---unset var-- -Error: 2 - mkdir(): %s, %s(%d) - ---single space-- -Error: 2 - mkdir(): %s, %s(%d) -===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation1.phpt b/ext/standard/tests/file/mkdir_variation1.phpt deleted file mode 100644 index c77c66b531..0000000000 --- a/ext/standard/tests/file/mkdir_variation1.phpt +++ /dev/null @@ -1,121 +0,0 @@ ---TEST-- -Test mkdir() function : usage variation: try invalid pathname ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Not valid for Windows"); -?> ---FILE-- -<?php -/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) - * Description: Create a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing mkdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase false' =>false, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // other - 'single space' => ' ', -); - -// loop through each element of the array for pathname - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $res = mkdir($value); - if ($res == true) { - echo "directory created\n"; - rmdir($value); - } -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing mkdir() : usage variation *** - ---uppercase NULL-- -Error: 2 - mkdir(): %s, %s(%d) - ---lowercase null-- -Error: 2 - mkdir(): %s, %s(%d) - ---lowercase false-- -Error: 2 - mkdir(): %s, %s(%d) - ---uppercase FALSE-- -Error: 2 - mkdir(): %s, %s(%d) - ---empty string DQ-- -Error: 2 - mkdir(): %s, %s(%d) - ---empty string SQ-- -Error: 2 - mkdir(): %s, %s(%d) - ---undefined var-- -Error: 2 - mkdir(): %s, %s(%d) - ---unset var-- -Error: 2 - mkdir(): %s, %s(%d) - ---single space-- -directory created -===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation2.phpt b/ext/standard/tests/file/mkdir_variation2.phpt deleted file mode 100644 index 51a1c39c17..0000000000 --- a/ext/standard/tests/file/mkdir_variation2.phpt +++ /dev/null @@ -1,191 +0,0 @@ ---TEST-- -Test mkdir() function : usage variation: different types for mode ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) - * Description: Create a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing mkdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$pathname = 'mkdirVar2.tmp'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for mode - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $h = mkdir($pathname, $value); - if ($h === true) { - echo "Directory created\n"; - rmdir($pathname); - } -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing mkdir() : usage variation *** - ---float 10.5-- -Directory created - ---float -10.5-- -Directory created - ---float 12.3456789000e10-- -Directory created - ---float -12.3456789000e10-- -Directory created - ---float .5-- -Directory created - ---empty array-- -Error: 2 - mkdir() expects parameter 2 to be int, array given, %s(%d) - ---int indexed array-- -Error: 2 - mkdir() expects parameter 2 to be int, array given, %s(%d) - ---associative array-- -Error: 2 - mkdir() expects parameter 2 to be int, array given, %s(%d) - ---nested arrays-- -Error: 2 - mkdir() expects parameter 2 to be int, array given, %s(%d) - ---uppercase NULL-- -Directory created - ---lowercase null-- -Directory created - ---lowercase true-- -Directory created - ---lowercase false-- -Directory created - ---uppercase TRUE-- -Directory created - ---uppercase FALSE-- -Directory created - ---empty string DQ-- -Error: 2 - mkdir() expects parameter 2 to be int, string given, %s(%d) - ---empty string SQ-- -Error: 2 - mkdir() expects parameter 2 to be int, string given, %s(%d) - ---string DQ-- -Error: 2 - mkdir() expects parameter 2 to be int, string given, %s(%d) - ---string SQ-- -Error: 2 - mkdir() expects parameter 2 to be int, string given, %s(%d) - ---mixed case string-- -Error: 2 - mkdir() expects parameter 2 to be int, string given, %s(%d) - ---heredoc-- -Error: 2 - mkdir() expects parameter 2 to be int, string given, %s(%d) - ---instance of classWithToString-- -Error: 2 - mkdir() expects parameter 2 to be int, object given, %s(%d) - ---instance of classWithoutToString-- -Error: 2 - mkdir() expects parameter 2 to be int, object given, %s(%d) - ---undefined var-- -Directory created - ---unset var-- -Directory created -===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation3.phpt b/ext/standard/tests/file/mkdir_variation3.phpt deleted file mode 100644 index 4c037b6bca..0000000000 --- a/ext/standard/tests/file/mkdir_variation3.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test mkdir() function : usage variation: different types for recursive ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) - * Description: Create a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing mkdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$pathname = 'mkdirVar3.tmp'; -$mode = 0777; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for recursive - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $h = mkdir($pathname, $mode, $value); - if ($h === true) { - echo "Directory created\n"; - rmdir($pathname); - } -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing mkdir() : usage variation *** - ---int 0-- -Directory created - ---int 1-- -Directory created - ---int 12345-- -Directory created - ---int -12345-- -Directory created - ---float 10.5-- -Directory created - ---float -10.5-- -Directory created - ---float 12.3456789000e10-- -Directory created - ---float -12.3456789000e10-- -Directory created - ---float .5-- -Directory created - ---empty array-- -Error: 2 - mkdir() expects parameter 3 to be bool, array given, %s(%d) - ---int indexed array-- -Error: 2 - mkdir() expects parameter 3 to be bool, array given, %s(%d) - ---associative array-- -Error: 2 - mkdir() expects parameter 3 to be bool, array given, %s(%d) - ---nested arrays-- -Error: 2 - mkdir() expects parameter 3 to be bool, array given, %s(%d) - ---uppercase NULL-- -Directory created - ---lowercase null-- -Directory created - ---lowercase true-- -Directory created - ---lowercase false-- -Directory created - ---uppercase TRUE-- -Directory created - ---uppercase FALSE-- -Directory created - ---empty string DQ-- -Directory created - ---empty string SQ-- -Directory created - ---string DQ-- -Directory created - ---string SQ-- -Directory created - ---mixed case string-- -Directory created - ---heredoc-- -Directory created - ---instance of classWithToString-- -Error: 2 - mkdir() expects parameter 3 to be bool, object given, %s(%d) - ---instance of classWithoutToString-- -Error: 2 - mkdir() expects parameter 3 to be bool, object given, %s(%d) - ---undefined var-- -Directory created - ---unset var-- -Directory created -===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation4.phpt b/ext/standard/tests/file/mkdir_variation4.phpt deleted file mode 100644 index a31ae722c6..0000000000 --- a/ext/standard/tests/file/mkdir_variation4.phpt +++ /dev/null @@ -1,220 +0,0 @@ ---TEST-- -Test mkdir() function : usage variation: different types for context ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]]) - * Description: Create a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing mkdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$pathname = 'mkdirVar4.tmp'; -$mode = 0777; -$recursive = false; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -$fileRes = fopen(__FILE__,'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // non stream context resource - 'file resource' => $fileRes, -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $h = mkdir($pathname, $mode, $recursive, $value); - if ($h === true) { - echo "Directory created\n"; - rmdir($pathname); - } -}; - -fclose($fileRes); - -?> -===DONE=== ---EXPECTF-- -*** Testing mkdir() : usage variation *** - ---int 0-- -Error: 2 - mkdir() expects parameter 4 to be resource, int given, %s(%d) - ---int 1-- -Error: 2 - mkdir() expects parameter 4 to be resource, int given, %s(%d) - ---int 12345-- -Error: 2 - mkdir() expects parameter 4 to be resource, int given, %s(%d) - ---int -12345-- -Error: 2 - mkdir() expects parameter 4 to be resource, int given, %s(%d) - ---float 10.5-- -Error: 2 - mkdir() expects parameter 4 to be resource, float given, %s(%d) - ---float -10.5-- -Error: 2 - mkdir() expects parameter 4 to be resource, float given, %s(%d) - ---float 12.3456789000e10-- -Error: 2 - mkdir() expects parameter 4 to be resource, float given, %s(%d) - ---float -12.3456789000e10-- -Error: 2 - mkdir() expects parameter 4 to be resource, float given, %s(%d) - ---float .5-- -Error: 2 - mkdir() expects parameter 4 to be resource, float given, %s(%d) - ---empty array-- -Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) - ---int indexed array-- -Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) - ---associative array-- -Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) - ---nested arrays-- -Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) - ---uppercase NULL-- -Directory created - ---lowercase null-- -Directory created - ---lowercase true-- -Error: 2 - mkdir() expects parameter 4 to be resource, bool given, %s(%d) - ---lowercase false-- -Error: 2 - mkdir() expects parameter 4 to be resource, bool given, %s(%d) - ---uppercase TRUE-- -Error: 2 - mkdir() expects parameter 4 to be resource, bool given, %s(%d) - ---uppercase FALSE-- -Error: 2 - mkdir() expects parameter 4 to be resource, bool given, %s(%d) - ---empty string DQ-- -Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) - ---empty string SQ-- -Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) - ---string DQ-- -Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) - ---string SQ-- -Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) - ---mixed case string-- -Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) - ---heredoc-- -Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) - ---instance of classWithToString-- -Error: 2 - mkdir() expects parameter 4 to be resource, object given, %s(%d) - ---instance of classWithoutToString-- -Error: 2 - mkdir() expects parameter 4 to be resource, object given, %s(%d) - ---undefined var-- -Directory created - ---unset var-- -Directory created - ---file resource-- -Error: 2 - mkdir(): supplied resource is not a valid Stream-Context resource, %s(%d) -Directory created -===DONE=== diff --git a/ext/standard/tests/file/parse_ini_file.phpt b/ext/standard/tests/file/parse_ini_file.phpt index 1a30d45616..d66f179acc 100644 --- a/ext/standard/tests/file/parse_ini_file.phpt +++ b/ext/standard/tests/file/parse_ini_file.phpt @@ -71,7 +71,7 @@ Non_alpha12 = \ ;Non_alpha17 = ~ ;Non_alpha18 = ! ;Non_alpha19 = $ -;Non_alpha20 = () +;Non_alpha20 = () Non_alpha1_quotes = ";" Non_alpha2_quotes = "+" diff --git a/ext/standard/tests/file/parse_ini_file_variation4.phpt b/ext/standard/tests/file/parse_ini_file_variation4.phpt deleted file mode 100644 index 15acc9c3c5..0000000000 --- a/ext/standard/tests/file/parse_ini_file_variation4.phpt +++ /dev/null @@ -1,210 +0,0 @@ ---TEST-- -Test parse_ini_file() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : array parse_ini_file(string filename [, bool process_sections]) - * Description: Parse configuration file - * Source code: ext/standard/basic_functions.c - * Alias to functions: - */ - -echo "*** Testing parse_ini_file() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$process_sections = false; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for filename - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( parse_ini_file($value, $process_sections) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing parse_ini_file() : usage variation *** - ---int 0-- -Error: 2 - parse_ini_file(0): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---int 1-- -Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - parse_ini_file(12345): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - parse_ini_file(-2345): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - parse_ini_file(10.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - parse_ini_file(-10.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - parse_ini_file(123456789000): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - parse_ini_file(-123456789000): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---float .5-- -Error: 2 - parse_ini_file(0.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---empty array-- -Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, array given, %s(%d) -bool(false) - ---uppercase NULL-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---lowercase null-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---lowercase true-- -Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - parse_ini_file(Class A object): failed to open stream: No such file or directory, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - parse_ini_file() expects parameter 1 to be a valid path, object given, %s(%d) -bool(false) - ---undefined var-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) - ---unset var-- -Error: 2 - parse_ini_file(): Filename cannot be empty!, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/parse_ini_file_variation5.phpt b/ext/standard/tests/file/parse_ini_file_variation5.phpt deleted file mode 100644 index 4cfc2a661f..0000000000 --- a/ext/standard/tests/file/parse_ini_file_variation5.phpt +++ /dev/null @@ -1,253 +0,0 @@ ---TEST-- -Test parse_ini_file() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : array parse_ini_file(string filename [, bool process_sections]) - * Description: Parse configuration file - * Source code: ext/standard/basic_functions.c - * Alias to functions: - */ - -echo "*** Testing parse_ini_file() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = __FILE__."ParseIniFileVar5.ini"; -$contents = "a=test"; -@unlink($filename); -file_put_contents($filename, $contents); - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for process_sections - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( parse_ini_file($filename, $value) ); -}; - -unlink($filename); -?> -===DONE=== ---EXPECTF-- -*** Testing parse_ini_file() : usage variation *** - ---int 0-- -array(1) { - ["a"]=> - string(4) "test" -} - ---int 1-- -array(1) { - ["a"]=> - string(4) "test" -} - ---int 12345-- -array(1) { - ["a"]=> - string(4) "test" -} - ---int -12345-- -array(1) { - ["a"]=> - string(4) "test" -} - ---float 10.5-- -array(1) { - ["a"]=> - string(4) "test" -} - ---float -10.5-- -array(1) { - ["a"]=> - string(4) "test" -} - ---float 12.3456789000e10-- -array(1) { - ["a"]=> - string(4) "test" -} - ---float -12.3456789000e10-- -array(1) { - ["a"]=> - string(4) "test" -} - ---float .5-- -array(1) { - ["a"]=> - string(4) "test" -} - ---empty array-- -Error: 2 - parse_ini_file() expects parameter 2 to be bool, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - parse_ini_file() expects parameter 2 to be bool, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - parse_ini_file() expects parameter 2 to be bool, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - parse_ini_file() expects parameter 2 to be bool, array given, %s(%d) -bool(false) - ---uppercase NULL-- -array(1) { - ["a"]=> - string(4) "test" -} - ---lowercase null-- -array(1) { - ["a"]=> - string(4) "test" -} - ---empty string DQ-- -array(1) { - ["a"]=> - string(4) "test" -} - ---empty string SQ-- -array(1) { - ["a"]=> - string(4) "test" -} - ---string DQ-- -array(1) { - ["a"]=> - string(4) "test" -} - ---string SQ-- -array(1) { - ["a"]=> - string(4) "test" -} - ---mixed case string-- -array(1) { - ["a"]=> - string(4) "test" -} - ---heredoc-- -array(1) { - ["a"]=> - string(4) "test" -} - ---instance of classWithToString-- -Error: 2 - parse_ini_file() expects parameter 2 to be bool, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - parse_ini_file() expects parameter 2 to be bool, object given, %s(%d) -bool(false) - ---undefined var-- -array(1) { - ["a"]=> - string(4) "test" -} - ---unset var-- -array(1) { - ["a"]=> - string(4) "test" -} -===DONE=== diff --git a/ext/standard/tests/file/pathinfo_variation1.phpt b/ext/standard/tests/file/pathinfo_variation1.phpt deleted file mode 100644 index 36d9bab5ae..0000000000 --- a/ext/standard/tests/file/pathinfo_variation1.phpt +++ /dev/null @@ -1,190 +0,0 @@ ---TEST-- -Test pathinfo() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : array pathinfo(string path[, int options]) - * Description: Returns information about a certain string - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing pathinfo() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$options = PATHINFO_DIRNAME; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for path - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( pathinfo($value, $options) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing pathinfo() : usage variation *** - ---int 0-- -string(1) "." - ---int 1-- -string(1) "." - ---int 12345-- -string(1) "." - ---int -12345-- -string(1) "." - ---float 10.5-- -string(1) "." - ---float -10.5-- -string(1) "." - ---float 12.3456789000e10-- -string(1) "." - ---float -12.3456789000e10-- -string(1) "." - ---float .5-- -string(1) "." - ---empty array-- -Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) -NULL - ---uppercase NULL-- -string(0) "" - ---lowercase null-- -string(0) "" - ---lowercase true-- -string(1) "." - ---lowercase false-- -string(0) "" - ---uppercase TRUE-- -string(1) "." - ---uppercase FALSE-- -string(0) "" - ---empty string DQ-- -string(0) "" - ---empty string SQ-- -string(0) "" - ---instance of classWithToString-- -string(1) "." - ---instance of classWithoutToString-- -Error: 2 - pathinfo() expects parameter 1 to be string, object given, %s(%d) -NULL - ---undefined var-- -string(0) "" - ---unset var-- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/file/pathinfo_variation2.phpt b/ext/standard/tests/file/pathinfo_variation2.phpt deleted file mode 100644 index a39543b18f..0000000000 --- a/ext/standard/tests/file/pathinfo_variation2.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test pathinfo() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : array pathinfo(string path[, int options]) - * Description: Returns information about a certain string - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing pathinfo() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$path = '/usr/include/arpa/inet.h'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for options - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( pathinfo($path, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing pathinfo() : usage variation *** - ---float 10.5-- -string(6) "inet.h" - ---float -10.5-- -string(6) "inet.h" - ---float 12.3456789000e10-- -string(%d) %s - ---float -12.3456789000e10-- -string(%d) %s - ---float .5-- -string(%d) %s - ---empty array-- -Error: 2 - pathinfo() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - pathinfo() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - pathinfo() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - pathinfo() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -string(0) "" - ---lowercase null-- -string(0) "" - ---lowercase true-- -string(17) "/usr/include/arpa" - ---lowercase false-- -string(0) "" - ---uppercase TRUE-- -string(17) "/usr/include/arpa" - ---uppercase FALSE-- -string(0) "" - ---empty string DQ-- -Error: 2 - pathinfo() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - pathinfo() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - pathinfo() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - pathinfo() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - pathinfo() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - pathinfo() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - pathinfo() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - pathinfo() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -string(0) "" - ---unset var-- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/file/pclose_variation1.phpt b/ext/standard/tests/file/pclose_variation1.phpt deleted file mode 100644 index 7c22389646..0000000000 --- a/ext/standard/tests/file/pclose_variation1.phpt +++ /dev/null @@ -1,231 +0,0 @@ ---TEST-- -Test pclose() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : int pclose(resource fp) - * Description: Close a file pointer opened by popen() - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing pclose() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for fp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( pclose($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing pclose() : usage variation *** - ---int 0-- -Error: 2 - pclose() expects parameter 1 to be resource, int given, %s(%d) -bool(false) - ---int 1-- -Error: 2 - pclose() expects parameter 1 to be resource, int given, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - pclose() expects parameter 1 to be resource, int given, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - pclose() expects parameter 1 to be resource, int given, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - pclose() expects parameter 1 to be resource, float given, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - pclose() expects parameter 1 to be resource, float given, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - pclose() expects parameter 1 to be resource, float given, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - pclose() expects parameter 1 to be resource, float given, %s(%d) -bool(false) - ---float .5-- -Error: 2 - pclose() expects parameter 1 to be resource, float given, %s(%d) -bool(false) - ---empty array-- -Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) -bool(false) - ---uppercase NULL-- -Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) -bool(false) - ---lowercase null-- -Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) -bool(false) - ---lowercase true-- -Error: 2 - pclose() expects parameter 1 to be resource, bool given, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - pclose() expects parameter 1 to be resource, bool given, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - pclose() expects parameter 1 to be resource, bool given, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - pclose() expects parameter 1 to be resource, bool given, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) -bool(false) - ---string DQ-- -Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) -bool(false) - ---string SQ-- -Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) -bool(false) - ---mixed case string-- -Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) -bool(false) - ---heredoc-- -Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - pclose() expects parameter 1 to be resource, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - pclose() expects parameter 1 to be resource, object given, %s(%d) -bool(false) - ---undefined var-- -Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) -bool(false) - ---unset var-- -Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt b/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt deleted file mode 100644 index f786021231..0000000000 --- a/ext/standard/tests/file/popen_pclose_error-win32-debug.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Test popen() and pclose function: error conditions ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) != 'WIN' && PHP_DEBUG) die("skip Valid only on Windows"); -if(!PHP_DEBUG) die("skip Not Valid for release builds"); - -ob_start();phpinfo(INFO_GENERAL);$inf=ob_get_contents(); ob_end_clean(); -if (!(strpos($inf, 'MSVC9') || strpos($inf, 'MSVC8'))) die("skip Not Valid for build done with VC < 8"); -?> ---FILE-- -<?php -/* - * Prototype: resource popen ( string command, string mode ) - * Description: Opens process file pointer. - - * Prototype: int pclose ( resource handle ); - * Description: Closes process file pointer. - */ -$file_path = dirname(__FILE__); -echo "*** Testing for error conditions ***\n"; -var_dump( popen() ); // Zero Arguments -var_dump( popen("abc.txt") ); // Single Argument -var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument -var_dump( pclose() ); -$file_handle = fopen($file_path."/popen.tmp", "w"); -var_dump( pclose($file_handle, $file_handle) ); -pclose($file_handle); -var_dump( pclose(1) ); -echo "\n--- Done ---"; -?> ---CLEAN-- -<?php -$file_path = dirname(__FILE__); -unlink($file_path."/popen.tmp"); -?> ---EXPECTF-- -*** Testing for error conditions *** - -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: Invalid parameter detected in CRT function '_fdopen' (%s:%d) in %s on line %d - -Warning: popen(abc.txt,rw): Invalid argument in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - ---- Done ---'abc.txt' is not recognized as an internal or external command, -operable program or batch file. diff --git a/ext/standard/tests/file/popen_pclose_error-win32.phpt b/ext/standard/tests/file/popen_pclose_error-win32.phpt deleted file mode 100644 index 0b29f9eefb..0000000000 --- a/ext/standard/tests/file/popen_pclose_error-win32.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -Test popen() and pclose function: error conditions ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') die("skip Valid only on Windows"); -if (PHP_DEBUG) die("skip Not Valid for debug builds"); -?> ---FILE-- -<?php -/* - * Prototype: resource popen ( string command, string mode ) - * Description: Opens process file pointer. - - * Prototype: int pclose ( resource handle ); - * Description: Closes process file pointer. - */ -$file_path = dirname(__FILE__); -echo "*** Testing for error conditions ***" . PHP_EOL; -var_dump( popen() ); // Zero Arguments -var_dump( popen("abc.txt") ); // Single Argument -var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument -var_dump( pclose() ); -$file_handle = fopen($file_path."/popen.tmp", "w"); -var_dump( pclose($file_handle, $file_handle) ); -pclose($file_handle); -var_dump( pclose(1) ); -echo PHP_EOL . PHP_EOL . "--- Done ---"; -?> ---CLEAN-- -<?php -$file_path = dirname(__FILE__); -unlink($file_path."/popen.tmp"); -?> ---EXPECTF-- -*** Testing for error conditions *** - -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: popen(abc.txt,rw): Invalid argument in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - - ---- Done ---'abc.txt' is not recognized as an internal or external command, -operable program or batch file. diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt index 280e93427a..93ed5d946e 100644 --- a/ext/standard/tests/file/popen_pclose_error.phpt +++ b/ext/standard/tests/file/popen_pclose_error.phpt @@ -2,8 +2,8 @@ Test popen() and pclose function: error conditions --SKIPIF-- <?php -if(substr(PHP_OS, 0, 3) == 'WIN' || strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') - die("skip Not Valid for Windows & Sun Solaris"); +if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') + die("skip Not Valid for Sun Solaris"); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/readfile_variation4.phpt b/ext/standard/tests/file/readfile_variation4.phpt deleted file mode 100644 index 99ee79e40b..0000000000 --- a/ext/standard/tests/file/readfile_variation4.phpt +++ /dev/null @@ -1,251 +0,0 @@ ---TEST-- -Test readfile() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]]) - * Description: Output a file or a URL - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing readfile() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'readFileVar4.tmp'; -$use_include_path = false; -$h = fopen($filename,'wb'); -fwrite($h, "testing readfile"); -fclose($h); - - -$fileRes = fopen(__FILE__, 'r'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // file resource - 'file resource' => $fileRes, -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $h = readfile($filename, $use_include_path, $value); - if ($h == false) { - echo "file not read\n"; - } - else { - echo "\n"; - } -}; - -unlink($filename); -fclose($fileRes); - -?> -===DONE=== ---EXPECTF-- -*** Testing readfile() : usage variation *** - ---int 0-- -Error: 2 - readfile() expects parameter 3 to be resource, int given, %s(%d) -file not read - ---int 1-- -Error: 2 - readfile() expects parameter 3 to be resource, int given, %s(%d) -file not read - ---int 12345-- -Error: 2 - readfile() expects parameter 3 to be resource, int given, %s(%d) -file not read - ---int -12345-- -Error: 2 - readfile() expects parameter 3 to be resource, int given, %s(%d) -file not read - ---float 10.5-- -Error: 2 - readfile() expects parameter 3 to be resource, float given, %s(%d) -file not read - ---float -10.5-- -Error: 2 - readfile() expects parameter 3 to be resource, float given, %s(%d) -file not read - ---float 12.3456789000e10-- -Error: 2 - readfile() expects parameter 3 to be resource, float given, %s(%d) -file not read - ---float -12.3456789000e10-- -Error: 2 - readfile() expects parameter 3 to be resource, float given, %s(%d) -file not read - ---float .5-- -Error: 2 - readfile() expects parameter 3 to be resource, float given, %s(%d) -file not read - ---empty array-- -Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) -file not read - ---int indexed array-- -Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) -file not read - ---associative array-- -Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) -file not read - ---nested arrays-- -Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) -file not read - ---uppercase NULL-- -testing readfile - ---lowercase null-- -testing readfile - ---lowercase true-- -Error: 2 - readfile() expects parameter 3 to be resource, bool given, %s(%d) -file not read - ---lowercase false-- -Error: 2 - readfile() expects parameter 3 to be resource, bool given, %s(%d) -file not read - ---uppercase TRUE-- -Error: 2 - readfile() expects parameter 3 to be resource, bool given, %s(%d) -file not read - ---uppercase FALSE-- -Error: 2 - readfile() expects parameter 3 to be resource, bool given, %s(%d) -file not read - ---empty string DQ-- -Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) -file not read - ---empty string SQ-- -Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) -file not read - ---string DQ-- -Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) -file not read - ---string SQ-- -Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) -file not read - ---mixed case string-- -Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) -file not read - ---heredoc-- -Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) -file not read - ---instance of classWithToString-- -Error: 2 - readfile() expects parameter 3 to be resource, object given, %s(%d) -file not read - ---instance of classWithoutToString-- -Error: 2 - readfile() expects parameter 3 to be resource, object given, %s(%d) -file not read - ---undefined var-- -testing readfile - ---unset var-- -testing readfile - ---file resource-- -Error: 2 - readfile(): supplied resource is not a valid Stream-Context resource, %s(%d) -testing readfile -===DONE=== diff --git a/ext/standard/tests/file/readfile_variation5.phpt b/ext/standard/tests/file/readfile_variation5.phpt deleted file mode 100644 index bc9c064055..0000000000 --- a/ext/standard/tests/file/readfile_variation5.phpt +++ /dev/null @@ -1,221 +0,0 @@ ---TEST-- -Test readfile() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]]) - * Description: Output a file or a URL - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing readfile() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'readFileVar5.tmp'; -$use_include_path = false; -$h = fopen($filename,'wb'); -fwrite($h, "testing readfile"); -fclose($h); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for use_include_path - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - $res = readfile($filename, $value); - if ($res == false) { - echo "File not read\n"; - } - else { - echo "\n"; - } -}; - -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing readfile() : usage variation *** - ---int 0-- -testing readfile - ---int 1-- -testing readfile - ---int 12345-- -testing readfile - ---int -12345-- -testing readfile - ---float 10.5-- -testing readfile - ---float -10.5-- -testing readfile - ---float 12.3456789000e10-- -testing readfile - ---float -12.3456789000e10-- -testing readfile - ---float .5-- -testing readfile - ---empty array-- -Error: 2 - readfile() expects parameter 2 to be bool, array given, %s(%d) -File not read - ---int indexed array-- -Error: 2 - readfile() expects parameter 2 to be bool, array given, %s(%d) -File not read - ---associative array-- -Error: 2 - readfile() expects parameter 2 to be bool, array given, %s(%d) -File not read - ---nested arrays-- -Error: 2 - readfile() expects parameter 2 to be bool, array given, %s(%d) -File not read - ---uppercase NULL-- -testing readfile - ---lowercase null-- -testing readfile - ---lowercase true-- -testing readfile - ---lowercase false-- -testing readfile - ---uppercase TRUE-- -testing readfile - ---uppercase FALSE-- -testing readfile - ---empty string DQ-- -testing readfile - ---empty string SQ-- -testing readfile - ---string DQ-- -testing readfile - ---string SQ-- -testing readfile - ---mixed case string-- -testing readfile - ---heredoc-- -testing readfile - ---instance of classWithToString-- -Error: 2 - readfile() expects parameter 2 to be bool, object given, %s(%d) -File not read - ---instance of classWithoutToString-- -Error: 2 - readfile() expects parameter 2 to be bool, object given, %s(%d) -File not read - ---undefined var-- -testing readfile - ---unset var-- -testing readfile -===DONE=== diff --git a/ext/standard/tests/file/rename_variation10.phpt b/ext/standard/tests/file/rename_variation10.phpt deleted file mode 100644 index 8ee59168b1..0000000000 --- a/ext/standard/tests/file/rename_variation10.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test rename() function : usage variation - different types for context ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : bool rename(string old_name, string new_name[, resource context]) - * Description: Rename a file - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing rename() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$old_name = __FILE__.'.tmp'; -$new_name = __FILE__.'.renamed'; - -//file resource -$fileRes = fopen(__FILE__, 'r'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // file resource - 'file resource' => $fileRes, -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - touch($old_name); - $res = rename($old_name, $new_name, $value); - var_dump($res); - if ($res == true) { - unlink($new_name); - } - else { - unlink($old_name); - } -}; - -fclose($fileRes); - -?> -===DONE=== ---EXPECTF-- -*** Testing rename() : usage variation *** - ---int 0-- -Error: 2 - rename() expects parameter 3 to be resource, int given, %s(%d) -bool(false) - ---int 1-- -Error: 2 - rename() expects parameter 3 to be resource, int given, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - rename() expects parameter 3 to be resource, int given, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - rename() expects parameter 3 to be resource, int given, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - rename() expects parameter 3 to be resource, float given, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - rename() expects parameter 3 to be resource, float given, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - rename() expects parameter 3 to be resource, float given, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - rename() expects parameter 3 to be resource, float given, %s(%d) -bool(false) - ---float .5-- -Error: 2 - rename() expects parameter 3 to be resource, float given, %s(%d) -bool(false) - ---empty array-- -Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) -bool(false) - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -Error: 2 - rename() expects parameter 3 to be resource, bool given, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - rename() expects parameter 3 to be resource, bool given, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - rename() expects parameter 3 to be resource, bool given, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - rename() expects parameter 3 to be resource, bool given, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) -bool(false) - ---string DQ-- -Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) -bool(false) - ---string SQ-- -Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) -bool(false) - ---mixed case string-- -Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) -bool(false) - ---heredoc-- -Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - rename() expects parameter 3 to be resource, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - rename() expects parameter 3 to be resource, object given, %s(%d) -bool(false) - ---undefined var-- -bool(true) - ---unset var-- -bool(true) - ---file resource-- -Error: 2 - rename(): supplied resource is not a valid Stream-Context resource, %s(%d) -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt Binary files differindex 894cfb2614..6319d4ad61 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt diff --git a/ext/standard/tests/file/rename_variation7-win32.phpt b/ext/standard/tests/file/rename_variation7-win32.phpt index a9643b4491..845728627b 100644 --- a/ext/standard/tests/file/rename_variation7-win32.phpt +++ b/ext/standard/tests/file/rename_variation7-win32.phpt @@ -26,7 +26,7 @@ var_dump(readlink($tmp_link2)); echo "Done\n"; ?> --EXPECTF-- -Warning: symlink(): Could not fetch file information(error 2) in %srename_variation7-win32.php on line %d +Warning: symlink(): No such file or directory in %srename_variation7-win32.php on line %d Warning: readlink(): readlink failed to read the symbolic link (%srename_variation7-win32.php.tmp.link), error 2) in %srename_variation7-win32.php on line %d bool(false) diff --git a/ext/standard/tests/file/rmdir_variation1-win32.phpt b/ext/standard/tests/file/rmdir_variation1-win32.phpt deleted file mode 100644 index 5a958631d9..0000000000 --- a/ext/standard/tests/file/rmdir_variation1-win32.phpt +++ /dev/null @@ -1,127 +0,0 @@ ---TEST-- -Test rmdir() function : usage variation - invalid filenames ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Only valid for Windows"); -?> ---FILE-- -<?php -/* Prototype : bool rmdir(string dirname[, resource context]) - * Description: Remove a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing rmdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase false' =>false, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // other - // php outputs Permission Denied, p8 outputs no suck file or dir - 'single space' => ' ', -); - -// loop through each element of the array for dirname - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( rmdir($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing rmdir() : usage variation *** - ---uppercase NULL-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---lowercase null-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---undefined var-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---unset var-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---single space-- -Error: 2 - rmdir( ): %s, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/rmdir_variation1.phpt b/ext/standard/tests/file/rmdir_variation1.phpt deleted file mode 100644 index 0556266efa..0000000000 --- a/ext/standard/tests/file/rmdir_variation1.phpt +++ /dev/null @@ -1,127 +0,0 @@ ---TEST-- -Test rmdir() function : usage variation - invalid file names ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Not valid for Windows"); -?> ---FILE-- -<?php -/* Prototype : bool rmdir(string dirname[, resource context]) - * Description: Remove a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing rmdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase false' =>false, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // other - 'single space' => ' ', -); - -// loop through each element of the array for dirname - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump(rmdir($value)); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing rmdir() : usage variation *** - ---uppercase NULL-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---lowercase null-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---undefined var-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---unset var-- -Error: 2 - rmdir(): %s, %s(%d) -bool(false) - ---single space-- -Error: 2 - rmdir( ): %s, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/file/rmdir_variation2.phpt b/ext/standard/tests/file/rmdir_variation2.phpt deleted file mode 100644 index 7555200344..0000000000 --- a/ext/standard/tests/file/rmdir_variation2.phpt +++ /dev/null @@ -1,240 +0,0 @@ ---TEST-- -Test rmdir() function : usage variation - different types for context ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : bool rmdir(string dirname[, resource context]) - * Description: Remove a directory - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing rmdir() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$dirname = 'rmdirVar2.tmp'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -$fileres = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // non stream context resource - $fileres, -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - @mkdir($dirname); - var_dump( rmdir($dirname, $value) ); -}; - -@rmdir($dirname); -fclose($fileres); -?> -===DONE=== ---EXPECTF-- -*** Testing rmdir() : usage variation *** - ---int 0-- -Error: 2 - rmdir() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---int 1-- -Error: 2 - rmdir() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - rmdir() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - rmdir() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - rmdir() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - rmdir() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - rmdir() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - rmdir() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float .5-- -Error: 2 - rmdir() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---empty array-- -Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -Error: 2 - rmdir() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - rmdir() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - rmdir() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - rmdir() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---string DQ-- -Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---string SQ-- -Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---mixed case string-- -Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---heredoc-- -Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - rmdir() expects parameter 2 to be resource, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - rmdir() expects parameter 2 to be resource, object given, %s(%d) -bool(false) - ---undefined var-- -bool(true) - ---unset var-- -bool(true) - ---0-- -Error: 2 - rmdir(): supplied resource is not a valid Stream-Context resource, %s(%d) -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/stat_basic-win32-mb.phpt b/ext/standard/tests/file/stat_basic-win32-mb.phpt index 1035091575..8ab15518b8 100644 --- a/ext/standard/tests/file/stat_basic-win32-mb.phpt +++ b/ext/standard/tests/file/stat_basic-win32-mb.phpt @@ -78,9 +78,9 @@ bool(true) -- comparing difference in dir stats before and after creating file in it -- array(26) { [0]=> - int(%d) + int(%i) [1]=> - int(0) + int(%d) [2]=> int(%d) [3]=> @@ -104,9 +104,9 @@ array(26) { [12]=> int(-1) ["dev"]=> - int(%d) + int(%i) ["ino"]=> - int(0) + int(%d) ["mode"]=> int(%d) ["nlink"]=> @@ -132,7 +132,7 @@ array(26) { } array(26) { [0]=> - int(%d) + int(%i) [1]=> int(%d) [2]=> @@ -158,7 +158,7 @@ array(26) { [12]=> int(-1) ["dev"]=> - int(%d) + int(%i) ["ino"]=> int(%d) ["mode"]=> diff --git a/ext/standard/tests/file/stat_basic-win32.phpt b/ext/standard/tests/file/stat_basic-win32.phpt index 4e783f35a2..14dbed311a 100644 --- a/ext/standard/tests/file/stat_basic-win32.phpt +++ b/ext/standard/tests/file/stat_basic-win32.phpt @@ -78,9 +78,9 @@ bool(true) -- comparing difference in dir stats before and after creating file in it -- array(26) { [0]=> - int(%d) + int(%i) [1]=> - int(0) + int(%d) [2]=> int(%d) [3]=> @@ -104,9 +104,9 @@ array(26) { [12]=> int(-1) ["dev"]=> - int(%d) + int(%i) ["ino"]=> - int(0) + int(%d) ["mode"]=> int(%d) ["nlink"]=> @@ -132,7 +132,7 @@ array(26) { } array(26) { [0]=> - int(%d) + int(%i) [1]=> int(%d) [2]=> @@ -158,7 +158,7 @@ array(26) { [12]=> int(-1) ["dev"]=> - int(%d) + int(%i) ["ino"]=> int(%d) ["mode"]=> diff --git a/ext/standard/tests/file/stat_variation7-win32.phpt b/ext/standard/tests/file/stat_variation7-win32.phpt index 8514d0c78b..2c8868b82d 100644 --- a/ext/standard/tests/file/stat_variation7-win32.phpt +++ b/ext/standard/tests/file/stat_variation7-win32.phpt @@ -76,7 +76,7 @@ rmdir("$file_path/stat_variation7a"); -- Testing stat() on filename stored inside an object -- array(26) { [0]=> - int(%d) + int(%i) [1]=> int(%d) [2]=> @@ -102,7 +102,7 @@ array(26) { [12]=> int(-%d) ["dev"]=> - int(%d) + int(%i) ["ino"]=> int(%d) ["mode"]=> @@ -130,7 +130,7 @@ array(26) { } array(26) { [0]=> - int(%d) + int(%i) [1]=> int(%d) [2]=> @@ -156,7 +156,7 @@ array(26) { [12]=> int(-%d) ["dev"]=> - int(%d) + int(%i) ["ino"]=> int(%d) ["mode"]=> @@ -186,7 +186,7 @@ array(26) { -- Testing stat() on directory name stored inside an object -- array(26) { [0]=> - int(%d) + int(%i) [1]=> int(%d) [2]=> @@ -212,7 +212,7 @@ array(26) { [12]=> int(-%d) ["dev"]=> - int(%d) + int(%i) ["ino"]=> int(%d) ["mode"]=> @@ -240,7 +240,7 @@ array(26) { } array(26) { [0]=> - int(%d) + int(%i) [1]=> int(%d) [2]=> @@ -266,7 +266,7 @@ array(26) { [12]=> int(-%d) ["dev"]=> - int(%d) + int(%i) ["ino"]=> int(%d) ["mode"]=> diff --git a/ext/standard/tests/file/stream_rfc2397_003.gif b/ext/standard/tests/file/stream_rfc2397_003.gif Binary files differindex 3dc4fc65f0..3dc4fc65f0 100755..100644 --- a/ext/standard/tests/file/stream_rfc2397_003.gif +++ b/ext/standard/tests/file/stream_rfc2397_003.gif diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt index d738373856..ddebad4f8c 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt @@ -5,9 +5,6 @@ Test symlink(), linkinfo(), link() and is_link() functions : usage variations - if ( substr(PHP_OS, 0, 3) == 'WIN' ) { die('skip no symlinks on Windows'); } -if ( substr(PHP_OS, 0, 3) == 'MAC' ) { - die('skip Not valid for MacOS'); -} // Skip if being run by root (files are always readable, writeable and executable) $filename = dirname(__FILE__)."/symlink_link_linkinfo_is_link6_check_root.tmp"; diff --git a/ext/standard/tests/file/touch_variation3-win32-mb.phpt b/ext/standard/tests/file/touch_variation3-win32-mb.phpt deleted file mode 100644 index cebf6f6c95..0000000000 --- a/ext/standard/tests/file/touch_variation3-win32-mb.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test touch() function : usage variation - different types for time ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only for Windows'); -} -?> ---FILE-- -<?php -/* Prototype : bool touch(string filename [, int time [, int atime]]) - * Description: Set modification time of file - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing touch() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'touchVar2_私はガラスを食べられます.tmp'; -$atime = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for time - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( touch($filename, $value, $atime) ); -}; - -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing touch() : usage variation *** - ---float 10.5-- -bool(true) - ---float 12.3456789000e10-- -bool(true) - ---float .5-- -bool(true) - ---empty array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -bool(true) - ---lowercase false-- -bool(true) - ---uppercase TRUE-- -bool(true) - ---uppercase FALSE-- -bool(true) - ---empty string DQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - touch() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - touch() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -bool(true) - ---unset var-- -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/touch_variation3-win32.phpt b/ext/standard/tests/file/touch_variation3-win32.phpt deleted file mode 100644 index a781ffae2f..0000000000 --- a/ext/standard/tests/file/touch_variation3-win32.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test touch() function : usage variation - different types for time ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only for Windows'); -} -?> ---FILE-- -<?php -/* Prototype : bool touch(string filename [, int time [, int atime]]) - * Description: Set modification time of file - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing touch() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'touchVar2.tmp'; -$atime = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for time - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( touch($filename, $value, $atime) ); -}; - -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing touch() : usage variation *** - ---float 10.5-- -bool(true) - ---float 12.3456789000e10-- -bool(true) - ---float .5-- -bool(true) - ---empty array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -bool(true) - ---lowercase false-- -bool(true) - ---uppercase TRUE-- -bool(true) - ---uppercase FALSE-- -bool(true) - ---empty string DQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - touch() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - touch() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -bool(true) - ---unset var-- -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/touch_variation3.phpt b/ext/standard/tests/file/touch_variation3.phpt deleted file mode 100644 index 5eb6ad315e..0000000000 --- a/ext/standard/tests/file/touch_variation3.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test touch() function : usage variation - different types for time ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not for Windows'); -} -?> ---FILE-- -<?php -/* Prototype : bool touch(string filename [, int time [, int atime]]) - * Description: Set modification time of file - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing touch() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'touchVar2.tmp'; -$atime = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for time - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( touch($filename, $value, $atime) ); -}; - -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing touch() : usage variation *** - ---float 10.5-- -bool(true) - ---float 12.3456789000e10-- -bool(true) - ---float .5-- -bool(true) - ---empty array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - touch() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -bool(true) - ---lowercase false-- -bool(true) - ---uppercase TRUE-- -bool(true) - ---uppercase FALSE-- -bool(true) - ---empty string DQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - touch() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - touch() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - touch() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -bool(true) - ---unset var-- -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/touch_variation4-win32.phpt b/ext/standard/tests/file/touch_variation4-win32.phpt deleted file mode 100644 index 62816e1ec6..0000000000 --- a/ext/standard/tests/file/touch_variation4-win32.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test touch() function : usage variation - different types for atime ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only for Windows'); -} -?> ---FILE-- -<?php -/* Prototype : bool touch(string filename [, int time [, int atime]]) - * Description: Set modification time of file - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing touch() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'touchVar3.tmp'; -$time = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for atime - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( touch($filename, $time, $value) ); -}; - -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing touch() : usage variation *** - ---float 10.5-- -bool(true) - ---float 12.3456789000e10-- -bool(true) - ---float .5-- -bool(true) - ---empty array-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -bool(true) - ---lowercase false-- -bool(true) - ---uppercase TRUE-- -bool(true) - ---uppercase FALSE-- -bool(true) - ---empty string DQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - touch() expects parameter 3 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - touch() expects parameter 3 to be int, object given, %s(%d) -NULL - ---undefined var-- -bool(true) - ---unset var-- -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/touch_variation4.phpt b/ext/standard/tests/file/touch_variation4.phpt deleted file mode 100644 index 190d0f4b1a..0000000000 --- a/ext/standard/tests/file/touch_variation4.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test touch() function : usage variation - different types for atime ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not for Windows'); -} -?> ---FILE-- -<?php -/* Prototype : bool touch(string filename [, int time [, int atime]]) - * Description: Set modification time of file - * Source code: ext/standard/filestat.c - * Alias to functions: - */ - -echo "*** Testing touch() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = 'touchVar3.tmp'; -$time = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for atime - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( touch($filename, $time, $value) ); -}; - -unlink($filename); - -?> -===DONE=== ---EXPECTF-- -*** Testing touch() : usage variation *** - ---float 10.5-- -bool(true) - ---float 12.3456789000e10-- -bool(true) - ---float .5-- -bool(true) - ---empty array-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - touch() expects parameter 3 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -bool(true) - ---lowercase false-- -bool(true) - ---uppercase TRUE-- -bool(true) - ---uppercase FALSE-- -bool(true) - ---empty string DQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - touch() expects parameter 3 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - touch() expects parameter 3 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - touch() expects parameter 3 to be int, object given, %s(%d) -NULL - ---undefined var-- -bool(true) - ---unset var-- -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/umask_variation3.phpt b/ext/standard/tests/file/umask_variation3.phpt deleted file mode 100644 index 68996ab692..0000000000 --- a/ext/standard/tests/file/umask_variation3.phpt +++ /dev/null @@ -1,237 +0,0 @@ ---TEST-- -Test umask() function : usage variation ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. only for Non Windows'); -} -?> ---FILE-- -<?php -/* Prototype : int umask([int mask]) - * Description: Return or change the umask - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing umask() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - //out of boundary integers - 'int -100' => -100, - 'int 99999' => 99999, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - //'float -12.3456789000e10' => -12.3456789000e10, different in p8 - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for mask - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - umask(0); - var_dump(umask($value)); - var_dump( umask() & 0777); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing umask() : usage variation *** - ---int -100-- -int(0) -int(412) - ---int 99999-- -int(0) -int(159) - ---float 10.5-- -int(0) -int(10) - ---float -10.5-- -int(0) -int(502) - ---float 12.3456789000e10-- -int(0) -int(%d) - ---float .5-- -int(0) -int(0) - ---empty array-- -Error: 2 - umask() expects parameter 1 to be int, array given, %s(%d) -bool(false) -int(63) - ---int indexed array-- -Error: 2 - umask() expects parameter 1 to be int, array given, %s(%d) -bool(false) -int(63) - ---associative array-- -Error: 2 - umask() expects parameter 1 to be int, array given, %s(%d) -bool(false) -int(63) - ---nested arrays-- -Error: 2 - umask() expects parameter 1 to be int, array given, %s(%d) -bool(false) -int(63) - ---uppercase NULL-- -int(0) -int(0) - ---lowercase null-- -int(0) -int(0) - ---lowercase true-- -int(0) -int(1) - ---lowercase false-- -int(0) -int(0) - ---uppercase TRUE-- -int(0) -int(1) - ---uppercase FALSE-- -int(0) -int(0) - ---empty string DQ-- -Error: 2 - umask() expects parameter 1 to be int, string given, %s(%d) -bool(false) -int(63) - ---empty string SQ-- -Error: 2 - umask() expects parameter 1 to be int, string given, %s(%d) -bool(false) -int(63) - ---string DQ-- -Error: 2 - umask() expects parameter 1 to be int, string given, %s(%d) -bool(false) -int(63) - ---string SQ-- -Error: 2 - umask() expects parameter 1 to be int, string given, %s(%d) -bool(false) -int(63) - ---mixed case string-- -Error: 2 - umask() expects parameter 1 to be int, string given, %s(%d) -bool(false) -int(63) - ---heredoc-- -Error: 2 - umask() expects parameter 1 to be int, string given, %s(%d) -bool(false) -int(63) - ---instance of classWithToString-- -Error: 2 - umask() expects parameter 1 to be int, object given, %s(%d) -bool(false) -int(63) - ---instance of classWithoutToString-- -Error: 2 - umask() expects parameter 1 to be int, object given, %s(%d) -bool(false) -int(63) - ---undefined var-- -int(0) -int(0) - ---unset var-- -int(0) -int(0) -===DONE=== diff --git a/ext/standard/tests/file/unlink_variation7.phpt b/ext/standard/tests/file/unlink_variation7.phpt deleted file mode 100644 index b4a6bd5a1f..0000000000 --- a/ext/standard/tests/file/unlink_variation7.phpt +++ /dev/null @@ -1,242 +0,0 @@ ---TEST-- -Test unlink() function : usage variation different types for context ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* Prototype : bool unlink(string filename[, context context]) - * Description: Delete a file - * Source code: ext/standard/file.c - * Alias to functions: - */ - -echo "*** Testing unlink() : usage variation different types for context ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$filename = __FILE__.'tmp'; -$fileRes = fopen(__FILE__, 'r'); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // file resource - 'file resource' => $fileRes -); - -// loop through each element of the array for context - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - touch($filename); // create if it doesn't exist - var_dump( unlink($filename, $value) ); -}; - -if (file_exists($filename)) { - unlink($filename); -} -fclose($fileRes); - -?> -===DONE=== ---EXPECTF-- -*** Testing unlink() : usage variation different types for context *** - ---int 0-- -Error: 2 - unlink() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---int 1-- -Error: 2 - unlink() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---int 12345-- -Error: 2 - unlink() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---int -12345-- -Error: 2 - unlink() expects parameter 2 to be resource, int given, %s(%d) -bool(false) - ---float 10.5-- -Error: 2 - unlink() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float -10.5-- -Error: 2 - unlink() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float 12.3456789000e10-- -Error: 2 - unlink() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float -12.3456789000e10-- -Error: 2 - unlink() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---float .5-- -Error: 2 - unlink() expects parameter 2 to be resource, float given, %s(%d) -bool(false) - ---empty array-- -Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---int indexed array-- -Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---associative array-- -Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---nested arrays-- -Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) -bool(false) - ---uppercase NULL-- -bool(true) - ---lowercase null-- -bool(true) - ---lowercase true-- -Error: 2 - unlink() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---lowercase false-- -Error: 2 - unlink() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---uppercase TRUE-- -Error: 2 - unlink() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---uppercase FALSE-- -Error: 2 - unlink() expects parameter 2 to be resource, bool given, %s(%d) -bool(false) - ---empty string DQ-- -Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---empty string SQ-- -Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---string DQ-- -Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---string SQ-- -Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---mixed case string-- -Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---heredoc-- -Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) -bool(false) - ---instance of classWithToString-- -Error: 2 - unlink() expects parameter 2 to be resource, object given, %s(%d) -bool(false) - ---instance of classWithoutToString-- -Error: 2 - unlink() expects parameter 2 to be resource, object given, %s(%d) -bool(false) - ---undefined var-- -bool(true) - ---unset var-- -bool(true) - ---file resource-- -Error: 2 - unlink(): supplied resource is not a valid Stream-Context resource, %s(%d) -bool(true) -===DONE=== diff --git a/ext/standard/tests/file/userfilters.phpt b/ext/standard/tests/file/userfilters.phpt index 73f87de613..40d1298fc4 100644 --- a/ext/standard/tests/file/userfilters.phpt +++ b/ext/standard/tests/file/userfilters.phpt @@ -2,7 +2,7 @@ stream userfilter test --FILE-- <?php -# vim600:syn=php: + class testfilter extends php_user_filter { function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt index 419ecc5122..790b74a0c3 100644 --- a/ext/standard/tests/file/userstreams.phpt +++ b/ext/standard/tests/file/userstreams.phpt @@ -2,7 +2,6 @@ User-space streams --FILE-- <?php -# vim600:syn=php: /* This is a fairly aggressive test that looks at * user streams and also gives the seek/gets/buffer diff --git a/ext/standard/tests/file/userwrapper.phpt b/ext/standard/tests/file/userwrapper.phpt index 3b512a6f36..dd4f0d3dd1 100644 --- a/ext/standard/tests/file/userwrapper.phpt +++ b/ext/standard/tests/file/userwrapper.phpt @@ -1,7 +1,7 @@ --TEST-- Userstream unlink, rename, mkdir, rmdir, and url_stat. --FILE-- -<?php # vim:ft=php: +<?php class test { function unlink($file) { print "Unlinking file: $file\n"; diff --git a/ext/standard/tests/file/windows_mb_path/CONFLICTS b/ext/standard/tests/file/windows_mb_path/CONFLICTS new file mode 100644 index 0000000000..692a324587 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/CONFLICTS @@ -0,0 +1,3 @@ +# These tests depend on the console codepage, which is shared across all parallel workers. +# Force these tests to run sequentially to make sure the codepage isn't change by another process. +all diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt index 5cc697c0fc..9dc7cf3cc4 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt @@ -24,9 +24,11 @@ for ($i = 0; $i < $how_many; $i++) { } $start = realpath(dirname(__FILE__)); +$newstart = false; if (strlen($start) <= 248) { // create the exact length $start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1); + $newstart = true; } var_dump($start); @@ -47,6 +49,9 @@ for ($i = 0; $i < $how_many; $i++) { $p0 = substr($p, 0, strlen($p) - $i*51); rmdir($p0); } +if ($newstart) { + rmdir($start); +} ?> ===DONE=== diff --git a/ext/standard/tests/filters/basic.phpt b/ext/standard/tests/filters/basic.phpt index 13a79e2cd1..c9162e5bef 100644 --- a/ext/standard/tests/filters/basic.phpt +++ b/ext/standard/tests/filters/basic.phpt @@ -2,7 +2,6 @@ basic stream filter tests --FILE-- <?php -# vim600:syn=php: $text = "Hello There!"; $filters = array("string.rot13", "string.toupper", "string.tolower"); diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt deleted file mode 100644 index 51a079ad53..0000000000 --- a/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test call_user_func_array() function : first parameter variation ---FILE-- -<?php -/* Prototype : mixed call_user_func_array(string function_name, array parameters) - * Description: Call a user function which is the first parameter with the arguments contained in array - * Source code: ext/standard/basic_functions.c - * Alias to functions: - */ - -echo "*** Testing call_user_func_array() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$parameters = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for function_name - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( call_user_func_array($value, $parameters) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing call_user_func_array() : usage variation *** - ---int 0-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---int 1-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---int 12345-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---int -12345-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---float 10.5-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---float -10.5-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---float 12.3456789000e10-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---float -12.3456789000e10-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---float .5-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---empty array-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d) -NULL - ---int indexed array-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d) -NULL - ---associative array-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object, %s(%d) -NULL - ---nested arrays-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d) -NULL - ---uppercase NULL-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---lowercase null-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---lowercase true-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---lowercase false-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---uppercase TRUE-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---uppercase FALSE-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---empty string DQ-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---undefined var-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL - ---unset var-- -Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d) -NULL -===DONE=== diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt deleted file mode 100644 index c8c8ce6604..0000000000 --- a/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt +++ /dev/null @@ -1,210 +0,0 @@ ---TEST-- -Test call_user_func_array() function : second parameter variation ---FILE-- -<?php -/* Prototype : mixed call_user_func_array(string function_name, array parameters) - * Description: Call a user function which is the first parameter with the arguments contained in array - * Source code: ext/standard/basic_functions.c - * Alias to functions: - */ - -echo "*** Testing call_user_func_array() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -function test_func() { -} -$function_name = 'test_func'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for parameters - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( call_user_func_array($function_name, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing call_user_func_array() : usage variation *** - ---int 0-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, int given, %s(%d) -NULL - ---int 1-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, int given, %s(%d) -NULL - ---int 12345-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, int given, %s(%d) -NULL - ---int -12345-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, int given, %s(%d) -NULL - ---float 10.5-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, float given, %s(%d) -NULL - ---float -10.5-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, float given, %s(%d) -NULL - ---float 12.3456789000e10-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, float given, %s(%d) -NULL - ---float -12.3456789000e10-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, float given, %s(%d) -NULL - ---float .5-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, float given, %s(%d) -NULL - ---uppercase NULL-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d) -NULL - ---lowercase null-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d) -NULL - ---lowercase true-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, bool given, %s(%d) -NULL - ---lowercase false-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, bool given, %s(%d) -NULL - ---uppercase TRUE-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, bool given, %s(%d) -NULL - ---uppercase FALSE-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, bool given, %s(%d) -NULL - ---empty string DQ-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, object given, %s(%d) -NULL - ---undefined var-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d) -NULL - ---unset var-- -Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d) -NULL -===DONE=== diff --git a/ext/standard/tests/general_functions/dl-check-enabled.phpt b/ext/standard/tests/general_functions/dl-check-enabled.phpt new file mode 100644 index 0000000000..7559b8d905 --- /dev/null +++ b/ext/standard/tests/general_functions/dl-check-enabled.phpt @@ -0,0 +1,22 @@ +--TEST-- +dl() returns false when disabled via INI settings ++--CREDITS-- +Tom Van Herreweghe <tom@theanalogguy.be> +User Group: PHP-WVL & PHPGent #PHPTestFest +--SKIPIF-- +<?php +$enabled_sapi = array('cgi-fcgi', 'cli', 'embed', 'fpm'); +if (!in_array(php_sapi_name(), $enabled_sapi)) { + die('skip dl() is not enabled for ' . php_sapi_name()); +} +?> +--INI-- +enable_dl=0 +--FILE-- +<?php +var_dump(dl('foo')); +?> +--EXPECTF-- + +Warning: dl(): Dynamically loaded extensions aren't enabled in %s on line %d +bool(false) diff --git a/ext/standard/tests/general_functions/dl-full-path-not-supported.phpt b/ext/standard/tests/general_functions/dl-full-path-not-supported.phpt new file mode 100644 index 0000000000..746162c7bf --- /dev/null +++ b/ext/standard/tests/general_functions/dl-full-path-not-supported.phpt @@ -0,0 +1,22 @@ +--TEST-- +dl() fails when trying to load full path to module +--CREDITS-- +Tom Van Herreweghe <tom@theanalogguy.be> +User Group: PHP-WVL & PHPGent #PHPTestFest +--SKIPIF-- +<?php +$enabled_sapi = array('cgi-fcgi', 'cli', 'embed', 'fpm'); +if (!in_array(php_sapi_name(), $enabled_sapi)) { + die('skip dl() is not enabled for ' . php_sapi_name()); +} +?> +--INI-- +enable_dl=1 +--FILE-- +<?php +var_dump(dl('/path/to/module')); +?> +--EXPECTF-- + +Warning: dl(): Temporary module name should contain only filename in %s on line %d +bool(false) diff --git a/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt b/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt deleted file mode 100644 index ac4568c621..0000000000 --- a/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test get_extension_funcs() function : error conditions ---FILE-- -<?php -/* Prototype : array get_extension_funcs ( string $module_name ) - * Description: Returns an array with the names of the functions of a module. - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $str -$inputs = array ( - - // integer values - 0, - 1, - 255, - 256, - PHP_INT_MAX, - -PHP_INT_MAX, - - // float values - 10.5, - -20.5, - 10.1234567e10, - - // array values - array(), - array(0), - array(1, 2), - - // boolean values - true, - false, - TRUE, - FALSE, - - // null values - NULL, - null, - - // objects - new sample(), - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop through with each element of the $inputs array to test get_extension_funcs() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( get_extension_funcs($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument *** --- Iteration 1 -- -bool(false) --- Iteration 2 -- -bool(false) --- Iteration 3 -- -bool(false) --- Iteration 4 -- -bool(false) --- Iteration 5 -- -bool(false) --- Iteration 6 -- -bool(false) --- Iteration 7 -- -bool(false) --- Iteration 8 -- -bool(false) --- Iteration 9 -- -bool(false) --- Iteration 10 -- - -Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -bool(false) --- Iteration 14 -- -bool(false) --- Iteration 15 -- -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -bool(false) --- Iteration 20 -- - -Warning: get_extension_funcs() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/getrusage_variation1.phpt b/ext/standard/tests/general_functions/getrusage_variation1.phpt deleted file mode 100644 index 0c072ed6e0..0000000000 --- a/ext/standard/tests/general_functions/getrusage_variation1.phpt +++ /dev/null @@ -1,142 +0,0 @@ ---TEST-- -Test getrusage() function : usage variation - diff data types as $who arg ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); -if (!function_exists("getrusage")) die("skip"); -?> ---FILE-- -<?php -/* Prototype : array getrusage ([ int $who ] ) - * Description: Gets the current resource usages - * Source code: ext/standard/microtime.c - * Alias to functions: - */ - - -/* - * Pass different data types as $who argument to test behaviour of getrusage() - */ - -echo "*** Testing getrusage() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - - -// unexpected values to be passed to $stream_id argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // string data -/*16*/ "0", - '1', - "1232456", - "1.23E4", - - // undefined data -/*20*/ @$undefined_var, - - // unset data -/*21*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of getrusage() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - $res = getrusage($input); - echo "User time used (microseconds) " . $res["ru_utime.tv_usec"] . "\n"; - $iterator++; -} -?> -===DONE=== ---EXPECTF-- -*** Testing getrusage() : usage variations *** - --- Iteration 1 -- -User time used (microseconds) %d - --- Iteration 2 -- -User time used (microseconds) %d - --- Iteration 3 -- -User time used (microseconds) %d - --- Iteration 4 -- -User time used (microseconds) %d - --- Iteration 5 -- -User time used (microseconds) %d - --- Iteration 6 -- -User time used (microseconds) %d - --- Iteration 7 -- -User time used (microseconds) %d - --- Iteration 8 -- -User time used (microseconds) %d - --- Iteration 9 -- -User time used (microseconds) %d - --- Iteration 10 -- -User time used (microseconds) %d - --- Iteration 11 -- -User time used (microseconds) %d - --- Iteration 12 -- -User time used (microseconds) %d - --- Iteration 13 -- -User time used (microseconds) %d - --- Iteration 14 -- -User time used (microseconds) %d - --- Iteration 15 -- -User time used (microseconds) %d - --- Iteration 16 -- -User time used (microseconds) %d - --- Iteration 17 -- -User time used (microseconds) %d - --- Iteration 18 -- -User time used (microseconds) %d - --- Iteration 19 -- -User time used (microseconds) %d - --- Iteration 20 -- -User time used (microseconds) %d - --- Iteration 21 -- -User time used (microseconds) %d -===DONE=== diff --git a/ext/standard/tests/general_functions/getservbyname_variation10.phpt b/ext/standard/tests/general_functions/getservbyname_variation10.phpt index 4779efdcaf..db1d47f3ef 100644 --- a/ext/standard/tests/general_functions/getservbyname_variation10.phpt +++ b/ext/standard/tests/general_functions/getservbyname_variation10.phpt @@ -1,11 +1,5 @@ --TEST-- Test function getservbyname() by substituting argument 2 with emptyUnsetUndefNull values. ---SKIPIF-- -<?php -if(PHP_OS == 'Darwin') { - die("skip.. Mac OS X is fine with NULLs in getservbyname"); -} -?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/getservbyname_variation9.phpt b/ext/standard/tests/general_functions/getservbyname_variation9.phpt index 720dbf0fbc..2719679b30 100644 --- a/ext/standard/tests/general_functions/getservbyname_variation9.phpt +++ b/ext/standard/tests/general_functions/getservbyname_variation9.phpt @@ -1,11 +1,5 @@ --TEST-- Test function getservbyname() by substituting argument 2 with boolean values. ---SKIPIF-- -<?php -if(PHP_OS == 'Darwin') { - die("skip.. Mac OS X is fine with NULLs in getservbyname"); -} -?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt index 99ab02a60d..d44c04e5dd 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt @@ -3,10 +3,11 @@ Test gettype() & settype() functions : usage variations --SKIPIF-- <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); -?> -if ( strtoupper( substr(PHP_OS, 0, 3) ) == 'MAC' ) { + +if (PHP_OS_FAMILY === 'Darwin') { die('skip Do not run on MacOS'); } +?> --INI-- precision=14 --FILE-- diff --git a/ext/standard/tests/general_functions/intval_variation2.phpt b/ext/standard/tests/general_functions/intval_variation2.phpt deleted file mode 100644 index 6a295308af..0000000000 --- a/ext/standard/tests/general_functions/intval_variation2.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test intval() function : usage variation ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int intval(mixed var [, int base]) - * Description: Get the integer value of a variable using the optional base for the conversion - * Source code: ext/standard/type.c - * Alias to functions: - */ - -echo "*** Testing intval() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) -$var = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for base - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( intval($var, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing intval() : usage variation *** - ---float 10.5-- -int(1) - ---float -10.5-- -int(1) - ---float 12.3456789000e10-- -Error: 2 - intval() expects parameter 2 to be int, float given, %s(%d) -NULL - ---float -12.3456789000e10-- -Error: 2 - intval() expects parameter 2 to be int, float given, %s(%d) -NULL - ---float .5-- -int(1) - ---empty array-- -Error: 2 - intval() expects parameter 2 to be int, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - intval() expects parameter 2 to be int, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - intval() expects parameter 2 to be int, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - intval() expects parameter 2 to be int, array given, %s(%d) -NULL - ---uppercase NULL-- -int(1) - ---lowercase null-- -int(1) - ---lowercase true-- -int(1) - ---lowercase false-- -int(1) - ---uppercase TRUE-- -int(1) - ---uppercase FALSE-- -int(1) - ---empty string DQ-- -Error: 2 - intval() expects parameter 2 to be int, string given, %s(%d) -NULL - ---empty string SQ-- -Error: 2 - intval() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string DQ-- -Error: 2 - intval() expects parameter 2 to be int, string given, %s(%d) -NULL - ---string SQ-- -Error: 2 - intval() expects parameter 2 to be int, string given, %s(%d) -NULL - ---mixed case string-- -Error: 2 - intval() expects parameter 2 to be int, string given, %s(%d) -NULL - ---heredoc-- -Error: 2 - intval() expects parameter 2 to be int, string given, %s(%d) -NULL - ---instance of classWithToString-- -Error: 2 - intval() expects parameter 2 to be int, object given, %s(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - intval() expects parameter 2 to be int, object given, %s(%d) -NULL - ---undefined var-- -int(1) - ---unset var-- -int(1) -===DONE=== diff --git a/ext/standard/tests/general_functions/parse_ini_string_001.phpt b/ext/standard/tests/general_functions/parse_ini_string_001.phpt index e435442b7a..1621fe9f16 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_001.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_001.phpt @@ -69,7 +69,7 @@ Non_alpha12 = \ ;Non_alpha17 = ~ ;Non_alpha18 = ! ;Non_alpha19 = $ -;Non_alpha20 = () +;Non_alpha20 = () Non_alpha1_quotes = ";" Non_alpha2_quotes = "+" diff --git a/ext/standard/tests/general_functions/php_uname_variation1.phpt b/ext/standard/tests/general_functions/php_uname_variation1.phpt deleted file mode 100644 index d5b86c7b5c..0000000000 --- a/ext/standard/tests/general_functions/php_uname_variation1.phpt +++ /dev/null @@ -1,112 +0,0 @@ ---TEST-- -Test php_uname() function - usage variations ---FILE-- -<?php -/* Prototype: string php_uname ([ string $mode ] ) - * Description: Returns information about the operating system PHP is running on -*/ - -echo "*** Testing php_uname() - usage variations\n"; -// Prevent notices about undefines variables -error_reporting(E_ALL & ~E_NOTICE); - -$unset_var = 10; -unset ($unset_var); - -class fooClass { - function __toString() { - return "m"; - } -} - -$values = array( - - // int data - "0" => 0, - "1" => 1, - "12345" => 12345, - "-2345" => -2345, - - // float data - "10.5" => 10.5, - "-10.5" => -10.5, - "10.1234567e10" => 10.1234567e10, - "10.7654321E-10" => 10.7654321E-10, - ".5" => .5, - - // null data - "NULL" => NULL, - "null" => null, - - // boolean data - "true" => true, - "false" => false, - "TRUE" => TRUE, - "FALSE" => FALSE, - - // empty data - "\"\"" => "", - "''" => '', - - // object data - "new fooClass()" => new fooClass(), - - // undefined data - "undefined var" => $undefined_var, - - // unset data - "unset var" => $unset_var, -); - -// loop through each element of the array for data - -foreach($values as $key => $value) { - echo "-- Iterator $key --\n"; - var_dump( php_uname($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing php_uname() - usage variations --- Iterator 0 -- -string(%d) "%s" --- Iterator 1 -- -string(%d) "%s" --- Iterator 12345 -- -string(%d) "%s" --- Iterator -2345 -- -string(%d) "%s" --- Iterator 10.5 -- -string(%d) "%s" --- Iterator -10.5 -- -string(%d) "%s" --- Iterator 10.1234567e10 -- -string(%d) "%s" --- Iterator 10.7654321E-10 -- -string(%d) "%s" --- Iterator .5 -- -string(%d) "%s" --- Iterator NULL -- -string(%d) "%s" --- Iterator null -- -string(%d) "%s" --- Iterator true -- -string(%d) "%s" --- Iterator false -- -string(%d) "%s" --- Iterator TRUE -- -string(%d) "%s" --- Iterator FALSE -- -string(%d) "%s" --- Iterator "" -- -string(%d) "%s" --- Iterator '' -- -string(%d) "%s" --- Iterator new fooClass() -- -string(%d) "%s" --- Iterator undefined var -- -string(%d) "%s" --- Iterator unset var -- -string(%d) "%s" -===DONE=== diff --git a/ext/standard/tests/general_functions/proc_nice_variation3.phpt b/ext/standard/tests/general_functions/proc_nice_variation3.phpt deleted file mode 100644 index c5626dd50f..0000000000 --- a/ext/standard/tests/general_functions/proc_nice_variation3.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -Test function proc_nice() by substituting argument 1 with emptyUnsetUndefNull values. ---CREDITS-- -Italian PHP TestFest 2009 Cesena 19-20-21 june -Fabio Fabbrucci (fabbrucci@grupporetina.com) -Michele Orselli (mo@ideato.it) -Simone Gentili (sensorario@gmail.com) ---SKIPIF-- -<?php -if(!function_exists('proc_nice')) die("skip. proc_nice not available "); -?> ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; - - - -$unset_var = 10; -unset($unset_var); - -$variation_array = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null, - ); - - -foreach ( $variation_array as $var ) { - var_dump(proc_nice( $var ) ); -} -?> ---EXPECTF-- -*** Test substituting argument 1 with emptyUnsetUndefNull values *** -bool(true) -bool(true) - -Warning: proc_nice() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: proc_nice() expects parameter 1 to be int, string given in %s on line %d -bool(false) -bool(true) -bool(true) diff --git a/ext/standard/tests/general_functions/proc_nice_variation6.phpt b/ext/standard/tests/general_functions/proc_nice_variation6.phpt deleted file mode 100644 index a3aff167ed..0000000000 --- a/ext/standard/tests/general_functions/proc_nice_variation6.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Test function proc_nice() by substituting argument 1 with object values. ---CREDITS-- -Italian PHP TestFest 2009 Cesena 19-20-21 june -Fabio Fabbrucci (fabbrucci@grupporetina.com) -Michele Orselli (mo@ideato.it) -Simone Gentili (sensorario@gmail.com) ---SKIPIF-- -<?php -if(!function_exists('proc_nice')) die("skip. proc_nice not available "); -?> ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with object values ***\n"; - - - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - - - -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -$variation_array = array( - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - ); - - -foreach ( $variation_array as $var ) { - var_dump(proc_nice( $var ) ); -} -?> ---EXPECTF-- -*** Test substituting argument 1 with object values *** -Error: 2 - proc_nice() expects parameter 1 to be int, object given, %s(%d) -bool(false) -Error: 2 - proc_nice() expects parameter 1 to be int, object given, %s(%d) -bool(false) diff --git a/ext/standard/tests/general_functions/proc_open-win32-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 981c4b22aa..69c3dd53e5 100644 --- a/ext/standard/tests/general_functions/proc_open-win32-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -1,8 +1,7 @@ --TEST-- proc_open with bypass_shell subprocess parameter passing --SKIPIF-- -<?php # vim:syn=php -if (substr(PHP_OS, 0, 3) != 'WIN') die("skip Valid only on Windows"); +<?php if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> diff --git a/ext/standard/tests/general_functions/proc_open-win32-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index f1a70a23e8..2b922917f3 100644 --- a/ext/standard/tests/general_functions/proc_open-win32-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -1,8 +1,7 @@ --TEST-- proc_open without bypass_shell subprocess parameter passing --SKIPIF-- -<?php # vim:syn=php -if (substr(PHP_OS, 0, 3) != 'WIN') die("skip Valid only on Windows"); +<?php if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt index ecf8d8ad79..4d0a21d165 100644 --- a/ext/standard/tests/general_functions/proc_open.phpt +++ b/ext/standard/tests/general_functions/proc_open.phpt @@ -1,7 +1,7 @@ --TEST-- proc_open --SKIPIF-- -<?php # vim:syn=php +<?php if (!is_executable("/bin/cat")) echo "skip"; if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> diff --git a/ext/standard/tests/general_functions/settype_typed_property.phpt b/ext/standard/tests/general_functions/settype_typed_property.phpt new file mode 100644 index 0000000000..a206a4ba41 --- /dev/null +++ b/ext/standard/tests/general_functions/settype_typed_property.phpt @@ -0,0 +1,28 @@ +--TEST-- +Using settype() on a typed property +--FILE-- +<?php + +class Test { + public int $x; +} + +$test = new Test; +$test->x = 42; +settype($test->x, 'string'); +// Same as $test->x = (string) $test->x. +// Leaves value unchanged due to coercion +var_dump($test->x); + +try { + settype($test->x, 'array'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +var_dump($test->x); + +?> +--EXPECT-- +int(42) +Cannot assign array to reference held by property Test::$x of type int +int(42) diff --git a/ext/standard/tests/http/CONFLICTS b/ext/standard/tests/http/CONFLICTS new file mode 100644 index 0000000000..254defddb5 --- /dev/null +++ b/ext/standard/tests/http/CONFLICTS @@ -0,0 +1 @@ +server diff --git a/ext/standard/tests/image/getimagesize_variation1.phpt b/ext/standard/tests/image/getimagesize_variation1.phpt deleted file mode 100644 index 3d3814414e..0000000000 --- a/ext/standard/tests/image/getimagesize_variation1.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test getimagesize() function : usage variations - unexpected type for arg 1 ---FILE-- -<?php -/* Prototype : proto array getimagesize(string imagefile [, array info]) - * Description: Get the size of an image as 4-element array - * Source code: ext/standard/image.c - * Alias to functions: - */ - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing getimagesize() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$info = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - "0" => 0, - "1" => 1, - "12345" => 12345, - "-2345" => -2345, - - // float data - "10.5" => 10.5, - "-10.5" => -10.5, - "10.1234567e5" => 10.1234567e10, - "10.7654321e-5" => 10.7654321E-5, - .5, - - // array data - "array()" => array(), - "array(0)" => array(0), - "array(1)" => array(1), - "array(1, 2)" => array(1, 2), - "array('color' => 'red', 'item' => 'pen')" => array('color' => 'red', 'item' => 'pen'), - - // null data - "NULL" => NULL, - "null" => null, - - // boolean data - "true" => true, - "false" => false, - "TRUE" => TRUE, - "FALSE" => FALSE, - - // empty data - "\"\"" => "", - "''" => '', - - // object data - "new stdclass()" => new stdclass(), - - // undefined data - "undefined_var" => $undefined_var, - - // unset data - "unset_var" => $unset_var, -); - -// loop through each element of the array for imagefile - -foreach($values as $key => $value) { - echo "\n-- Arg value: $key --\n"; - var_dump( getimagesize($value, $info) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing getimagesize() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(%d) -Error: 8 - Undefined variable: unset_var, %s(%d) - --- Arg value: 0 -- -Error: 2 - getimagesize(0): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: 1 -- -Error: 2 - getimagesize(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: 12345 -- -Error: 2 - getimagesize(12345): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: -2345 -- -Error: 2 - getimagesize(-2345): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: 10.5 -- -Error: 2 - getimagesize(10.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: -10.5 -- -Error: 2 - getimagesize(-10.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: 10.1234567e5 -- -Error: 2 - getimagesize(101234567000): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: 10.7654321e-5 -- -Error: 2 - getimagesize(0.000107654321): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: 12346 -- -Error: 2 - getimagesize(0.5): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: array() -- -Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value: array(0) -- -Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value: array(1) -- -Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value: array(1, 2) -- -Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value: array('color' => 'red', 'item' => 'pen') -- -Error: 2 - getimagesize() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value: NULL -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: null -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: true -- -Error: 2 - getimagesize(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: false -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: TRUE -- -Error: 2 - getimagesize(1): failed to open stream: No such file or directory, %s(%d) -bool(false) - --- Arg value: FALSE -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: "" -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: '' -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: new stdclass() -- -Error: 2 - getimagesize() expects parameter 1 to be string, object given, %s(%d) -NULL - --- Arg value: undefined_var -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) - --- Arg value: unset_var -- -Error: 2 - getimagesize(): Filename cannot be empty, %s(%d) -bool(false) -===DONE=== diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt deleted file mode 100644 index d6276cf559..0000000000 --- a/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt +++ /dev/null @@ -1,154 +0,0 @@ ---TEST-- -Test image_type_to_mime_type() function : usage variations - Pass different data types as imagetype ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : string image_type_to_mime_type(int imagetype) - * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype - * Source code: ext/standard/image.c - */ - -echo "*** Testing image_type_to_mime_type() : usage variations ***\n"; - -error_reporting(E_ALL ^ E_NOTICE); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -class MyClass -{ - function __toString() { - return "MyClass"; - } -} - -//array of values to iterate over -$values = array( - - // float data - 100.5, - -100.5, - 100.1234567e10, - 100.7654321E-10, - .5, - - // array data - array(), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, -); - -// loop through each element of the array for imagetype -$iterator = 1; -foreach($values as $value) { - echo "\n-- Iteration $iterator --\n"; - var_dump( image_type_to_mime_type($value) ); - $iterator++; -}; -?> -===DONE=== ---EXPECTF-- -*** Testing image_type_to_mime_type() : usage variations *** - --- Iteration 1 -- -string(24) "application/octet-stream" - --- Iteration 2 -- -string(24) "application/octet-stream" - --- Iteration 3 -- -string(24) "application/octet-stream" - --- Iteration 4 -- -string(24) "application/octet-stream" - --- Iteration 5 -- -string(24) "application/octet-stream" - --- Iteration 6 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, array given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, array given in %s on line %d -NULL - --- Iteration 8 -- -string(24) "application/octet-stream" - --- Iteration 9 -- -string(24) "application/octet-stream" - --- Iteration 10 -- -string(9) "image/gif" - --- Iteration 11 -- -string(24) "application/octet-stream" - --- Iteration 12 -- -string(9) "image/gif" - --- Iteration 13 -- -string(24) "application/octet-stream" - --- Iteration 14 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: image_type_to_mime_type() expects parameter 1 to be int, object given in %s on line %d -NULL - --- Iteration 19 -- -string(24) "application/octet-stream" - --- Iteration 20 -- -string(24) "application/octet-stream" -===DONE=== diff --git a/ext/standard/tests/image/iptcembed_003.phpt b/ext/standard/tests/image/iptcembed_003.phpt new file mode 100644 index 0000000000..74a2c1ed7d --- /dev/null +++ b/ext/standard/tests/image/iptcembed_003.phpt @@ -0,0 +1,12 @@ +--TEST-- +iptcembed() unable to open file +--CREDITS-- +Mark Niebergall <mbniebergall@gmail.com> +PHP TestFest 2017 - UPHPU +--FILE-- +<?php +var_dump(iptcembed(-1, __DIR__ . '/iptcembed/DOES_NOT_EXIST.ERR', -1)); +?> +--EXPECTF-- +Warning: iptcembed(): Unable to open %s in %s on line %d +bool(false) diff --git a/ext/standard/tests/image/test13pix.swf b/ext/standard/tests/image/test13pix.swf Binary files differindex 0d40cb743e..0d40cb743e 100755..100644 --- a/ext/standard/tests/image/test13pix.swf +++ b/ext/standard/tests/image/test13pix.swf diff --git a/ext/standard/tests/image/test4pix.swf b/ext/standard/tests/image/test4pix.swf Binary files differindex b1d41c6766..b1d41c6766 100755..100644 --- a/ext/standard/tests/image/test4pix.swf +++ b/ext/standard/tests/image/test4pix.swf diff --git a/ext/standard/tests/mail/bug66535.phpt b/ext/standard/tests/mail/bug66535.phpt index f0a5d5ea85..09dad37ad6 100644 --- a/ext/standard/tests/mail/bug66535.phpt +++ b/ext/standard/tests/mail/bug66535.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #66535: Extra newline if add_x_header and no additional headers are used --INI-- -sendmail_path=tee mailBasic.out >/dev/null +sendmail_path=tee mailBug66535.out >/dev/null mail.add_x_header = On --SKIPIF-- <?php @@ -23,7 +23,7 @@ $to = 'user@company.com'; $subject = 'Test Subject'; $message = 'A Message'; -$outFile = "mailBasic.out"; +$outFile = "mailBug66535.out"; @unlink($outFile); var_dump( mail($to, $subject, $message) ); diff --git a/ext/standard/tests/mail/bug69115.phpt b/ext/standard/tests/mail/bug69115.phpt index f81d32403e..98ece49769 100644 --- a/ext/standard/tests/mail/bug69115.phpt +++ b/ext/standard/tests/mail/bug69115.phpt @@ -1,11 +1,7 @@ --TEST-- Bug #69115 crash in mail (plus indirect pcre test) --SKIPIF-- -<?php -if( substr(PHP_OS, 0, 3) != 'WIN' ) { - die('skip...Windows only test'); -} -?> +<?php if (substr(PHP_OS, 0, 3) !== 'WIN') die('skip Windows only test, as in Unix builds it sends an email'); ?> --INI-- SMTP = smtp_port = diff --git a/ext/standard/tests/mail/bug69874.phpt b/ext/standard/tests/mail/bug69874.phpt index 14a4b452df..45cfd0d32f 100644 --- a/ext/standard/tests/mail/bug69874.phpt +++ b/ext/standard/tests/mail/bug69874.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #69874: Null addtional_headers does not send mail --INI-- -sendmail_path=tee mailBasic.out >/dev/null +sendmail_path=tee mailBug69874.out >/dev/null mail.add_x_header = Off --SKIPIF-- <?php @@ -23,7 +23,7 @@ $to = 'user@company.com'; $subject = 'Test Subject'; $message = 'A Message'; -$outFile = "mailBasic.out"; +$outFile = "mailBug69874.out"; @unlink($outFile); var_dump( mail($to, $subject, $message) ); diff --git a/ext/standard/tests/mail/bug69874_2.phpt b/ext/standard/tests/mail/bug69874_2.phpt index 53d991a26b..e35d1c367e 100644 --- a/ext/standard/tests/mail/bug69874_2.phpt +++ b/ext/standard/tests/mail/bug69874_2.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #69874: Null addtional_headers does not send mail --INI-- -sendmail_path=tee mailBasic.out >/dev/null +sendmail_path=tee mailBug69874_2.out >/dev/null mail.add_x_header = On --SKIPIF-- <?php @@ -23,7 +23,7 @@ $to = 'user@company.com'; $subject = 'Test Subject'; $message = 'A Message'; -$outFile = "mailBasic.out"; +$outFile = "mailBug69874_2.out"; @unlink($outFile); var_dump( mail($to, $subject, $message, '') ); diff --git a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt deleted file mode 100644 index 123195e5ec..0000000000 --- a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $delimiter argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $delimiter -$delimiters = array ( - - // integer values - 0, - 1, - 255, - 256, - PHP_INT_MAX, - -PHP_INT_MAX, - - // float values - 10.5, - -20.5, - 10.1234567e10, - - // array values - array(), - array(0), - array(1, 2), - - // boolean values - true, - false, - TRUE, - FALSE, - - // null values - NULL, - null, - - // objects - new sample(), - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop through with each element of the $delimiters array to test explode() function -$count = 1; -$string = "piece1 piece2 piece3 piece4 piece5 piece6"; -$limit = 5; -foreach($delimiters as $delimiter) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===Done=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'delimiter' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 2 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 3 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 4 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 5 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 6 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 7 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 8 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 9 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 10 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 14 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 15 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 16 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 19 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 20 -- - -Warning: explode() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) -===Done=== diff --git a/ext/standard/tests/mail/mail_basic6.phpt b/ext/standard/tests/mail/mail_basic6.phpt index 01d315ae06..f9eab07e61 100644 --- a/ext/standard/tests/mail/mail_basic6.phpt +++ b/ext/standard/tests/mail/mail_basic6.phpt @@ -1,7 +1,7 @@ --TEST-- Test mail() function : basic functionality --INI-- -sendmail_path=tee mailBasic.out >/dev/null +sendmail_path=tee mailBasic6.out >/dev/null mail.add_x_header = Off --SKIPIF-- <?php @@ -24,7 +24,7 @@ $to = 'user@example.com'; $subject = 'Test Subject'; $message = 'A Message'; $additional_headers = "HEAD1: a\r\nHEAD2: b\r\n"; -$outFile = "mailBasic.out"; +$outFile = "mailBasic6.out"; @unlink($outFile); echo "-- Valid Header --\n"; diff --git a/ext/standard/tests/mail/mail_basic7.phpt b/ext/standard/tests/mail/mail_basic7.phpt index 3b389d2c4e..0b2cdc2c4f 100644 --- a/ext/standard/tests/mail/mail_basic7.phpt +++ b/ext/standard/tests/mail/mail_basic7.phpt @@ -1,7 +1,7 @@ --TEST-- Test mail() function : array extra header basic functionality --INI-- -sendmail_path=tee mailBasic.out >/dev/null +sendmail_path=tee mailBasic7.out >/dev/null mail.add_x_header = Off --SKIPIF-- <?php @@ -35,7 +35,7 @@ $additional_headers = array( "bar\r\n\t fuga", ), ); -$outFile = "mailBasic.out"; +$outFile = "mailBasic7.out"; @unlink($outFile); echo "-- All Mail Content Parameters --\n"; @@ -62,7 +62,7 @@ $additional_headers = array( 'message-id' => array('foo7'), 'in-reply-to'=> array('foo8'), ); -$outFile = "mailBasic.out"; +$outFile = "mailBasic7.out"; @unlink($outFile); echo "-- All Mail Content Parameters --\n"; @@ -87,7 +87,7 @@ $additional_headers = array( 'foo6' => array(NULL), 'foo7' => array(new StdClass), ); -$outFile = "mailBasic.out"; +$outFile = "mailBasic7.out"; @unlink($outFile); echo "-- All Mail Content Parameters --\n"; @@ -115,7 +115,7 @@ $additional_headers = array( "foo9" => '%&$#!', "foo10" => "abc\0\tdef", ); -$outFile = "mailBasic.out"; +$outFile = "mailBasic7.out"; @unlink($outFile); echo "-- All Mail Content Parameters --\n"; diff --git a/ext/standard/tests/mail/mail_include.inc b/ext/standard/tests/mail/mail_include.inc index 2197a1f8c1..8d7a8a9a1c 100644 --- a/ext/standard/tests/mail/mail_include.inc +++ b/ext/standard/tests/mail/mail_include.inc @@ -132,7 +132,7 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s } /** - * Get the mailbox name from a mailbox decription, i.e strip off server details. + * Get the mailbox name from a mailbox description, i.e strip off server details. * * @param string mailbox complete mailbox name * @return mailbox name diff --git a/ext/standard/tests/mail/mail_skipif.inc b/ext/standard/tests/mail/mail_skipif.inc index 8da04b072a..fedcfbbe4e 100644 --- a/ext/standard/tests/mail/mail_skipif.inc +++ b/ext/standard/tests/mail/mail_skipif.inc @@ -16,7 +16,7 @@ $mailbox = '{localhost}'; $username = 'webmaster@example.com'; $password = 'p4ssw0rd'; $options = OP_HALFOPEN; // this should be enough to verify server present -$retries = 0; // dont retry connect on failure +$retries = 0; // don't retry connect on failure $mbox = imap_open($mailbox, $username, $password, $options, $retries); if (!$mbox) { diff --git a/ext/standard/tests/math/atan2_variation1.phpt b/ext/standard/tests/math/atan2_variation1.phpt deleted file mode 100644 index a2bc481ad2..0000000000 --- a/ext/standard/tests/math/atan2_variation1.phpt +++ /dev/null @@ -1,187 +0,0 @@ ---TEST-- -Test atan2() function : usage variations - different data types as $y arg ---INI-- -precision = 10 ---FILE-- -<?php -/* Prototype : float atan2 ( float $y , float $x ) - * Description: Arc tangent of two variables. - * Source code: ext/standard/math.c - */ - -echo "*** Testing atan2() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12, - -12, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 1.234567e2, - 1.234567E-2, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of atan2() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(atan2($input, 23)); - $iterator++; -}; - -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing atan2() : usage variations *** - --- Iteration 1 -- -float(0) - --- Iteration 2 -- -float(0.04345089539) - --- Iteration 3 -- -float(0.4808872802) - --- Iteration 4 -- -float(-0.4808872802) - --- Iteration 5 -- -float(1.570796316) - --- Iteration 6 -- -float(0.4282641529) - --- Iteration 7 -- -float(-0.4282641529) - --- Iteration 8 -- -float(1.386607742) - --- Iteration 9 -- -float(0.0005367682093) - --- Iteration 10 -- -float(0.02173570684) - --- Iteration 11 -- -float(0) - --- Iteration 12 -- -float(0) - --- Iteration 13 -- -float(0.04345089539) - --- Iteration 14 -- -float(0) - --- Iteration 15 -- -float(0.04345089539) - --- Iteration 16 -- -float(0) - --- Iteration 17 -- - -Warning: atan2() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: atan2() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: atan2() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: atan2() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: atan2() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: atan2() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: atan2() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(0) - --- Iteration 25 -- -float(0) - --- Iteration 26 -- - -Warning: atan2() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/atan2_variation2.phpt b/ext/standard/tests/math/atan2_variation2.phpt deleted file mode 100644 index 45c0215ea3..0000000000 --- a/ext/standard/tests/math/atan2_variation2.phpt +++ /dev/null @@ -1,186 +0,0 @@ ---TEST-- -Test atan2() function : usage variations - different data types as $x arg ---INI-- -precision = 10 ---FILE-- -<?php -/* Prototype : float atan2 ( float $y , float $x ) - * Description: Arc tangent of two variables. - * Source code: ext/standard/math.c - */ - -echo "*** Testing atan2() : basic functionality ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12, - -12, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 1.234567e2, - 1.234567E-2, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of atan2() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(atan2(23, $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing atan2() : basic functionality *** - --- Iteration 1 -- -float(1.570796327) - --- Iteration 2 -- -float(1.527345431) - --- Iteration 3 -- -float(1.089909047) - --- Iteration 4 -- -float(2.051683607) - --- Iteration 5 -- -float(1.071020961E-8) - --- Iteration 6 -- -float(1.142532174) - --- Iteration 7 -- -float(1.99906048) - --- Iteration 8 -- -float(0.1841885846) - --- Iteration 9 -- -float(1.570259559) - --- Iteration 10 -- -float(1.54906062) - --- Iteration 11 -- -float(1.570796327) - --- Iteration 12 -- -float(1.570796327) - --- Iteration 13 -- -float(1.527345431) - --- Iteration 14 -- -float(1.570796327) - --- Iteration 15 -- -float(1.527345431) - --- Iteration 16 -- -float(1.570796327) - --- Iteration 17 -- - -Warning: atan2() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: atan2() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: atan2() expects parameter 2 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: atan2() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: atan2() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: atan2() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: atan2() expects parameter 2 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(1.570796327) - --- Iteration 25 -- -float(1.570796327) - --- Iteration 26 -- - -Warning: atan2() expects parameter 2 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/base_convert_variation2.phpt b/ext/standard/tests/math/base_convert_variation2.phpt deleted file mode 100644 index 23e74c621d..0000000000 --- a/ext/standard/tests/math/base_convert_variation2.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test base_convert() function : usage variations - different data types as $frombase argument ---FILE-- -<?php -/* Prototype : string base_convert ( string $number , int $frombase , int $tobase ) - * Description: Convert a number between arbitrary bases. - * Source code: ext/standard/math.c - */ - -echo "*** Testing base_convert() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -$inputs = array( - // int data -/*1*/ 0, - 1, - -1, - -12, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 1.234567e2, - 1.234567E-2, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behaviour of base_convert() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(base_convert(25, $input, 8)); - $iterator++; -}; -?> -===Done=== ---EXPECTF-- -*** Testing base_convert() : usage variations *** - --- Iteration 1 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 2 -- - -Warning: base_convert(): Invalid `from base' (1) in %s on line %d -bool(false) - --- Iteration 3 -- - -Warning: base_convert(): Invalid `from base' (-1) in %s on line %d -bool(false) - --- Iteration 4 -- - -Warning: base_convert(): Invalid `from base' (-12) in %s on line %d -bool(false) - --- Iteration 5 -- - -Warning: base_convert(): Invalid `from base' (2147483647) in %s on line %d -bool(false) - --- Iteration 6 -- -string(2) "31" - --- Iteration 7 -- - -Warning: base_convert(): Invalid `from base' (-10) in %s on line %d -bool(false) - --- Iteration 8 -- - -Warning: base_convert(): Invalid `from base' (123) in %s on line %d -bool(false) - --- Iteration 9 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 10 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 12 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 13 -- - -Warning: base_convert(): Invalid `from base' (1) in %s on line %d -bool(false) - --- Iteration 14 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 15 -- - -Warning: base_convert(): Invalid `from base' (1) in %s on line %d -bool(false) - --- Iteration 16 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: base_convert() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: base_convert() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: base_convert() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: base_convert() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: base_convert() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: base_convert() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) - --- Iteration 24 -- - -Warning: base_convert(): Invalid `from base' (0) in %s on line %d -bool(false) -===Done=== diff --git a/ext/standard/tests/math/base_convert_variation3.phpt b/ext/standard/tests/math/base_convert_variation3.phpt deleted file mode 100644 index d4b96fb1f2..0000000000 --- a/ext/standard/tests/math/base_convert_variation3.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test base_convert() function : usage variations - different data types as $tobase argument ---FILE-- -<?php -/* Prototype : string base_convert ( string $number , int $frombase , int $tobase ) - * Description: Convert a number between arbitrary bases. - * Source code: ext/standard/math.c - */ - -echo "*** Testing base_convert() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -$inputs = array( - // int data -/*1*/ 0, - 1, - -1, - -12, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 1.234567e2, - 1.234567E-2, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behaviour of base_convert() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(base_convert(25, 10, $input)); - $iterator++; -}; -?> -===Done=== ---EXPECTF-- -*** Testing base_convert() : usage variations *** - --- Iteration 1 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 2 -- - -Warning: base_convert(): Invalid `to base' (1) in %s on line %d -bool(false) - --- Iteration 3 -- - -Warning: base_convert(): Invalid `to base' (-1) in %s on line %d -bool(false) - --- Iteration 4 -- - -Warning: base_convert(): Invalid `to base' (-12) in %s on line %d -bool(false) - --- Iteration 5 -- - -Warning: base_convert(): Invalid `to base' (2147483647) in %s on line %d -bool(false) - --- Iteration 6 -- -string(2) "25" - --- Iteration 7 -- - -Warning: base_convert(): Invalid `to base' (-10) in %s on line %d -bool(false) - --- Iteration 8 -- - -Warning: base_convert(): Invalid `to base' (123) in %s on line %d -bool(false) - --- Iteration 9 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 10 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 12 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 13 -- - -Warning: base_convert(): Invalid `to base' (1) in %s on line %d -bool(false) - --- Iteration 14 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 15 -- - -Warning: base_convert(): Invalid `to base' (1) in %s on line %d -bool(false) - --- Iteration 16 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: base_convert() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: base_convert() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: base_convert() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: base_convert() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: base_convert() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: base_convert() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) - --- Iteration 24 -- - -Warning: base_convert(): Invalid `to base' (0) in %s on line %d -bool(false) -===Done=== diff --git a/ext/standard/tests/math/bug21523.phpt b/ext/standard/tests/math/bug21523.phpt index 7589c401e3..20616b10b3 100644 --- a/ext/standard/tests/math/bug21523.phpt +++ b/ext/standard/tests/math/bug21523.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #21523 (number_format tries to allocate negative amount of memory) --FILE-- -<?php // vim600:syn=php +<?php set_time_limit(5); var_dump(number_format(-2000, 2768)); diff --git a/ext/standard/tests/math/bug24142.phpt b/ext/standard/tests/math/bug24142.phpt index 169932b49b..3696b6e790 100644 --- a/ext/standard/tests/math/bug24142.phpt +++ b/ext/standard/tests/math/bug24142.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #24142 (round() problems) --FILE-- -<?php // vim600:syn=php +<?php $v = 0.005; for ($i = 1; $i < 10; $i++) { echo "round({$v}, 2) -> ".round($v, 2)."\n"; diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt index 9e06267d22..275ed485c2 100644 --- a/ext/standard/tests/math/ceil_basic.phpt +++ b/ext/standard/tests/math/ceil_basic.phpt @@ -2,10 +2,6 @@ Test ceil() - basic function test for ceil() --INI-- precision=14 ---SKIPIF-- -if (strtolower(PHP_OS) == 'darwin') { - die('SKIP OSX does weird things with -0 so this test doesn't work there'); -} --FILE-- <?php /* Prototype : float ceil ( float $value ) diff --git a/ext/standard/tests/math/exp_variation1.phpt b/ext/standard/tests/math/exp_variation1.phpt deleted file mode 100644 index 5305b63660..0000000000 --- a/ext/standard/tests/math/exp_variation1.phpt +++ /dev/null @@ -1,187 +0,0 @@ ---TEST-- -Test exp() function : usage variations - different data types as $arg argument ---INI-- -precision=14 ---FILE-- -<?php -/* Prototype : float exp ( float $arg ) - * Description: Returns e raised to the power of arg. - * Source code: ext/standard/math.c - */ - -echo "*** Testing exp() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arg argument -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of exp() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(exp($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing exp() : usage variations *** - --- Iteration 1 -- -float(1) - --- Iteration 2 -- -float(2.718281828459) - --- Iteration 3 -- -float(INF) - --- Iteration 4 -- -float(0) - --- Iteration 5 -- -float(INF) - --- Iteration 6 -- -float(36315.502674247) - --- Iteration 7 -- -float(2.7536449349747E-5) - --- Iteration 8 -- -float(INF) - --- Iteration 9 -- -float(1.0000000012346) - --- Iteration 10 -- -float(1.6487212707001) - --- Iteration 11 -- -float(1) - --- Iteration 12 -- -float(1) - --- Iteration 13 -- -float(2.718281828459) - --- Iteration 14 -- -float(1) - --- Iteration 15 -- -float(2.718281828459) - --- Iteration 16 -- -float(1) - --- Iteration 17 -- - -Warning: exp() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: exp() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: exp() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: exp() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: exp() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: exp() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: exp() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(1) - --- Iteration 25 -- -float(1) - --- Iteration 26 -- - -Warning: exp() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/expm1_variation1.phpt b/ext/standard/tests/math/expm1_variation1.phpt deleted file mode 100644 index 6d93b6eab6..0000000000 --- a/ext/standard/tests/math/expm1_variation1.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test expm1() function : usage variations - different data types as $arg argument ---INI-- -precision=14 ---FILE-- -<?php - -/* Prototype : float expm1 ( float $arg ) - * Description: Returns exp(number) - 1, computed in a way that is accurate even - * when the value of number is close to zero. - * Source code: ext/standard/math.c - */ - -echo "*** Testing expm1() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arg argument -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789E4, - 12.3456789E-4, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "abcxyz", - 'abcxyz', - $heredoc, - - // array data - array(), - array(1,2,4), - - // object data -/*24*/ new classA(), - - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - - // resource variable -/*27*/ $fp -); - -// loop through each element of $inputs to check the behaviour of expm1() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(expm1($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing expm1() : usage variations *** - --- Iteration 1 -- -float(0) - --- Iteration 2 -- -float(1.718281828459) - --- Iteration 3 -- -float(INF) - --- Iteration 4 -- -float(-1) - --- Iteration 5 -- -float(36314.502674247) - --- Iteration 6 -- -float(-0.99997246355065) - --- Iteration 7 -- -float(INF) - --- Iteration 8 -- -float(0.0012353302826471) - --- Iteration 9 -- -float(0.64872127070013) - --- Iteration 10 -- -float(0) - --- Iteration 11 -- -float(0) - --- Iteration 12 -- -float(1.718281828459) - --- Iteration 13 -- -float(0) - --- Iteration 14 -- -float(1.718281828459) - --- Iteration 15 -- -float(0) - --- Iteration 16 -- - -Warning: expm1() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: expm1() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: expm1() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: expm1() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: expm1() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: expm1() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: expm1() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: expm1() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: expm1() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 25 -- -float(0) - --- Iteration 26 -- -float(0) - --- Iteration 27 -- - -Warning: expm1() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/floorceil.phpt b/ext/standard/tests/math/floorceil.phpt index 55395dba3d..f9594ce22c 100644 --- a/ext/standard/tests/math/floorceil.phpt +++ b/ext/standard/tests/math/floorceil.phpt @@ -41,4 +41,4 @@ float(0) float(1) float(1) float(1) -float(2) +float(2) diff --git a/ext/standard/tests/math/fmod_variation1.phpt b/ext/standard/tests/math/fmod_variation1.phpt deleted file mode 100644 index 345d74c431..0000000000 --- a/ext/standard/tests/math/fmod_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test fmod() function : usage variations - different data types as $x argument ---FILE-- -<?php -/* Prototype : float fmod ( float $x , float $y ) - * Description: Returns the floating point remainder (modulo) of the division of the arguments. - * Source code: ext/standard/math.c - */ - -echo "*** Testing fmod() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of fmod() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(fmod($input, 2)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing fmod() : usage variations *** - --- Iteration 1 -- -float(0) - --- Iteration 2 -- -float(1) - --- Iteration 3 -- -float(1) - --- Iteration 4 -- -float(-1) - --- Iteration 5 -- -float(1) - --- Iteration 6 -- -float(0.5) - --- Iteration 7 -- -float(-0.5) - --- Iteration 8 -- -float(0) - --- Iteration 9 -- -float(1.23456789E-9) - --- Iteration 10 -- -float(0.5) - --- Iteration 11 -- -float(0) - --- Iteration 12 -- -float(0) - --- Iteration 13 -- -float(1) - --- Iteration 14 -- -float(0) - --- Iteration 15 -- -float(1) - --- Iteration 16 -- -float(0) - --- Iteration 17 -- - -Warning: fmod() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: fmod() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: fmod() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: fmod() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: fmod() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: fmod() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: fmod() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(0) - --- Iteration 25 -- -float(0) - --- Iteration 26 -- - -Warning: fmod() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/fmod_variation2.phpt b/ext/standard/tests/math/fmod_variation2.phpt deleted file mode 100644 index 6c5fc82541..0000000000 --- a/ext/standard/tests/math/fmod_variation2.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test fmod() function : usage variations - different data types as $y argument ---FILE-- -<?php -/* Prototype : float fmod ( float $x , float $y ) - * Description: Returns the floating point remainder (modulo) of the division of the arguments. - * Source code: ext/standard/math.c - */ - -echo "*** Testing fmod() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of fmod() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(fmod(123456, $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing fmod() : usage variations *** - --- Iteration 1 -- -float(NAN) - --- Iteration 2 -- -float(0) - --- Iteration 3 -- -float(6) - --- Iteration 4 -- -float(1516) - --- Iteration 5 -- -float(123456) - --- Iteration 6 -- -float(7.5) - --- Iteration 7 -- -float(7.5) - --- Iteration 8 -- -float(123456) - --- Iteration 9 -- -float(2.3605615109341E-10) - --- Iteration 10 -- -float(0) - --- Iteration 11 -- -float(NAN) - --- Iteration 12 -- -float(NAN) - --- Iteration 13 -- -float(0) - --- Iteration 14 -- -float(NAN) - --- Iteration 15 -- -float(0) - --- Iteration 16 -- -float(NAN) - --- Iteration 17 -- - -Warning: fmod() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: fmod() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: fmod() expects parameter 2 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: fmod() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: fmod() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: fmod() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: fmod() expects parameter 2 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(NAN) - --- Iteration 25 -- -float(NAN) - --- Iteration 26 -- - -Warning: fmod() expects parameter 2 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/hypot_variation1.phpt b/ext/standard/tests/math/hypot_variation1.phpt deleted file mode 100644 index 0fdfa25375..0000000000 --- a/ext/standard/tests/math/hypot_variation1.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test hypot() function : usage variations - different data types as $x argument ---FILE-- -<?php -/* Prototype : float hypot ( float $x , float $y ) - * Description: Calculate the length of the hypotenuse of a right-angle triangle - * Source code: ext/standard/math.c - */ - -echo "*** Testing hypot() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arg argument -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of hypot() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(hypot($input, 5)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing hypot() : usage variations *** - --- Iteration 1 -- -float(5) - --- Iteration 2 -- -float(5.0990195135928) - --- Iteration 3 -- -float(12345.001012556) - --- Iteration 4 -- -float(2345.0053304843) - --- Iteration 5 -- -float(2147483647) - --- Iteration 6 -- -float(11.629703349613) - --- Iteration 7 -- -float(11.629703349613) - --- Iteration 8 -- -float(123456789000) - --- Iteration 9 -- -float(5) - --- Iteration 10 -- -float(5.0249378105604) - --- Iteration 11 -- -float(5) - --- Iteration 12 -- -float(5) - --- Iteration 13 -- -float(5.0990195135928) - --- Iteration 14 -- -float(5) - --- Iteration 15 -- -float(5.0990195135928) - --- Iteration 16 -- -float(5) - --- Iteration 17 -- - -Warning: hypot() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: hypot() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: hypot() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: hypot() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: hypot() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: hypot() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: hypot() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(5) - --- Iteration 25 -- -float(5) - --- Iteration 26 -- - -Warning: hypot() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/hypot_variation2.phpt b/ext/standard/tests/math/hypot_variation2.phpt deleted file mode 100644 index 3b48b23123..0000000000 --- a/ext/standard/tests/math/hypot_variation2.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test hypot() function : usage variations - different data types as $y argument ---FILE-- -<?php -/* Prototype : float hypot ( float $x , float $y ) - * Description: Calculate the length of the hypotenuse of a right-angle triangle - * Source code: ext/standard/math.c - */ - -echo "*** Testing hypot() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arg argument -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of hypot() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(hypot(3, $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing hypot() : usage variations *** - --- Iteration 1 -- -float(3) - --- Iteration 2 -- -float(3.1622776601684) - --- Iteration 3 -- -float(12345.00036452) - --- Iteration 4 -- -float(2345.0019189758) - --- Iteration 5 -- -float(2147483647) - --- Iteration 6 -- -float(10.920164833921) - --- Iteration 7 -- -float(10.920164833921) - --- Iteration 8 -- -float(123456789000) - --- Iteration 9 -- -float(3) - --- Iteration 10 -- -float(3.0413812651491) - --- Iteration 11 -- -float(3) - --- Iteration 12 -- -float(3) - --- Iteration 13 -- -float(3.1622776601684) - --- Iteration 14 -- -float(3) - --- Iteration 15 -- -float(3.1622776601684) - --- Iteration 16 -- -float(3) - --- Iteration 17 -- - -Warning: hypot() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: hypot() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: hypot() expects parameter 2 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: hypot() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: hypot() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: hypot() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: hypot() expects parameter 2 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(3) - --- Iteration 25 -- -float(3) - --- Iteration 26 -- - -Warning: hypot() expects parameter 2 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/is_finite_variation1.phpt b/ext/standard/tests/math/is_finite_variation1.phpt deleted file mode 100644 index 498d0b2717..0000000000 --- a/ext/standard/tests/math/is_finite_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test is_finite() function : usage variations - different data types as $val argument ---FILE-- -<?php -/* Prototype : bool is_finite ( float $val ) - * Description: Finds whether a value is a legal finite number. - * Source code: ext/standard/math.c - */ - -echo "*** Testing is_finite() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of is_finite() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(is_finite($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing is_finite() : usage variations *** - --- Iteration 1 -- -bool(true) - --- Iteration 2 -- -bool(true) - --- Iteration 3 -- -bool(true) - --- Iteration 4 -- -bool(true) - --- Iteration 5 -- -bool(true) - --- Iteration 6 -- -bool(true) - --- Iteration 7 -- -bool(true) - --- Iteration 8 -- -bool(true) - --- Iteration 9 -- -bool(true) - --- Iteration 10 -- -bool(true) - --- Iteration 11 -- -bool(true) - --- Iteration 12 -- -bool(true) - --- Iteration 13 -- -bool(true) - --- Iteration 14 -- -bool(true) - --- Iteration 15 -- -bool(true) - --- Iteration 16 -- -bool(true) - --- Iteration 17 -- - -Warning: is_finite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: is_finite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: is_finite() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: is_finite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: is_finite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: is_finite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: is_finite() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -bool(true) - --- Iteration 25 -- -bool(true) - --- Iteration 26 -- - -Warning: is_finite() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/is_infinite_variation1.phpt b/ext/standard/tests/math/is_infinite_variation1.phpt deleted file mode 100644 index 0f57209b98..0000000000 --- a/ext/standard/tests/math/is_infinite_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test is_infinite() function : usage variations - different data types as $val argument ---FILE-- -<?php -/* Prototype : bool is_finite ( float $val ) - * Description: Finds whether a value is infinite. - * Source code: ext/standard/math.c - */ - -echo "*** Testing is_infinite() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of is_infinite() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(is_infinite($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing is_infinite() : usage variations *** - --- Iteration 1 -- -bool(false) - --- Iteration 2 -- -bool(false) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -bool(false) - --- Iteration 6 -- -bool(false) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -bool(false) - --- Iteration 10 -- -bool(false) - --- Iteration 11 -- -bool(false) - --- Iteration 12 -- -bool(false) - --- Iteration 13 -- -bool(false) - --- Iteration 14 -- -bool(false) - --- Iteration 15 -- -bool(false) - --- Iteration 16 -- -bool(false) - --- Iteration 17 -- - -Warning: is_infinite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: is_infinite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: is_infinite() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: is_infinite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: is_infinite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: is_infinite() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: is_infinite() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -bool(false) - --- Iteration 25 -- -bool(false) - --- Iteration 26 -- - -Warning: is_infinite() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/is_nan_variation1.phpt b/ext/standard/tests/math/is_nan_variation1.phpt deleted file mode 100644 index 9cd24cfd91..0000000000 --- a/ext/standard/tests/math/is_nan_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test is_nan() function : usage variations - different data types as $val argument ---FILE-- -<?php -/* Prototype : bool is_nan ( float $val ) - * Description: Finds whether a value is not a number. - * Source code: ext/standard/math.c - */ - -echo "*** Testing is_nan() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of is_nan() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(is_nan($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing is_nan() : usage variations *** - --- Iteration 1 -- -bool(false) - --- Iteration 2 -- -bool(false) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -bool(false) - --- Iteration 6 -- -bool(false) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -bool(false) - --- Iteration 10 -- -bool(false) - --- Iteration 11 -- -bool(false) - --- Iteration 12 -- -bool(false) - --- Iteration 13 -- -bool(false) - --- Iteration 14 -- -bool(false) - --- Iteration 15 -- -bool(false) - --- Iteration 16 -- -bool(false) - --- Iteration 17 -- - -Warning: is_nan() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: is_nan() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: is_nan() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: is_nan() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: is_nan() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: is_nan() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: is_nan() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -bool(false) - --- Iteration 25 -- -bool(false) - --- Iteration 26 -- - -Warning: is_nan() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/log1p_variation1.phpt b/ext/standard/tests/math/log1p_variation1.phpt deleted file mode 100644 index 2065fb9fba..0000000000 --- a/ext/standard/tests/math/log1p_variation1.phpt +++ /dev/null @@ -1,191 +0,0 @@ ---TEST-- -Test log1p() function : usage variations - different data types as $arg argument ---INI-- -precision=14 ---FILE-- -<?php -/* Prototype : float log1p ( float $arg ) - * Description: Returns log(1 + number), computed in a way that is accurate even - * when the value of number is close to zero - * Source code: ext/standard/math.c - */ - -echo "*** Testing log1p() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - -2147483648, - - // float data -/*7*/ 10.5, - -10.5, - 12.3456789E4, - 12.3456789E-4, - .5, - - // null data -/*12*/ NULL, - null, - - // boolean data -/*14*/ true, - false, - TRUE, - FALSE, - - // empty data -/*18*/ "", - '', - array(), - - // string data -/*21*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*24*/ new classA(), - - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - - // resource variable -/*27*/ $fp -); - -// loop through each element of $inputs to check the behaviour of log1p() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(log1p($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing log1p() : usage variations *** - --- Iteration 1 -- -float(0) - --- Iteration 2 -- -float(0.69314718055995) - --- Iteration 3 -- -float(9.4210874029538) - --- Iteration 4 -- -float(NAN) - --- Iteration 5 -- -float(21.487562597358) - --- Iteration 6 -- -float(NAN) - --- Iteration 7 -- -float(2.4423470353692) - --- Iteration 8 -- -float(NAN) - --- Iteration 9 -- -float(11.723654587153) - --- Iteration 10 -- -float(0.0012338064377078) - --- Iteration 11 -- -float(0.40546510810816) - --- Iteration 12 -- -float(0) - --- Iteration 13 -- -float(0) - --- Iteration 14 -- -float(0.69314718055995) - --- Iteration 15 -- -float(0) - --- Iteration 16 -- -float(0.69314718055995) - --- Iteration 17 -- -float(0) - --- Iteration 18 -- - -Warning: log1p() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: log1p() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: log1p() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: log1p() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: log1p() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: log1p() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: log1p() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 25 -- -float(0) - --- Iteration 26 -- -float(0) - --- Iteration 27 -- - -Warning: log1p() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/log_variation1.phpt b/ext/standard/tests/math/log_variation1.phpt deleted file mode 100644 index 06954d4173..0000000000 --- a/ext/standard/tests/math/log_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test log() function : usage variations - different data types as $arg argument ---FILE-- -<?php -/* Prototype : float log ( float $arg [, float $base ] ) - * Description: Natural logarithm. - * Source code: ext/standard/math.c - */ - -echo "*** Testing log() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of log() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(log($input, 10)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing log() : usage variations *** - --- Iteration 1 -- -float(-INF) - --- Iteration 2 -- -float(0) - --- Iteration 3 -- -float(4.091491094268) - --- Iteration 4 -- -float(NAN) - --- Iteration 5 -- -float(9.3319298653812) - --- Iteration 6 -- -float(1.0211892990699) - --- Iteration 7 -- -float(NAN) - --- Iteration 8 -- -float(11.091514977169) - --- Iteration 9 -- -float(-8.9084850228307) - --- Iteration 10 -- -float(-0.30102999566398) - --- Iteration 11 -- -float(-INF) - --- Iteration 12 -- -float(-INF) - --- Iteration 13 -- -float(0) - --- Iteration 14 -- -float(-INF) - --- Iteration 15 -- -float(0) - --- Iteration 16 -- -float(-INF) - --- Iteration 17 -- - -Warning: log() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: log() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: log() expects parameter 1 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: log() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: log() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: log() expects parameter 1 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: log() expects parameter 1 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- -float(-INF) - --- Iteration 25 -- -float(-INF) - --- Iteration 26 -- - -Warning: log() expects parameter 1 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/log_variation2.phpt b/ext/standard/tests/math/log_variation2.phpt deleted file mode 100644 index 4e4612fdc0..0000000000 --- a/ext/standard/tests/math/log_variation2.phpt +++ /dev/null @@ -1,202 +0,0 @@ ---TEST-- -Test log() function : usage variations - different data types as $base argument ---FILE-- -<?php -/* Prototype : float log ( float $arg [, float $base ] ) - * Description: Natural logarithm. - * Source code: ext/standard/math.c - */ - -echo "*** Testing log() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of log() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(log(3.14, $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing log() : usage variations *** - --- Iteration 1 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 2 -- -float(NAN) - --- Iteration 3 -- -float(0.12145441273706) - --- Iteration 4 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 5 -- -float(0.053250469650086) - --- Iteration 6 -- -float(0.48661854224853) - --- Iteration 7 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 8 -- -float(0.044802684673473) - --- Iteration 9 -- -float(-0.055781611216686) - --- Iteration 10 -- -float(-1.6507645591169) - --- Iteration 11 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 12 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 13 -- -float(NAN) - --- Iteration 14 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 15 -- -float(NAN) - --- Iteration 16 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: log() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: log() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: log() expects parameter 2 to be float, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: log() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: log() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: log() expects parameter 2 to be float, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: log() expects parameter 2 to be float, object given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 25 -- - -Warning: log(): base must be greater than 0 in %s on line %d -bool(false) - --- Iteration 26 -- - -Warning: log() expects parameter 2 to be float, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/mt_rand_variation1.phpt b/ext/standard/tests/math/mt_rand_variation1.phpt deleted file mode 100644 index d4f976b98a..0000000000 --- a/ext/standard/tests/math/mt_rand_variation1.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test rand() function : usage variations - different data types as $min argument ---FILE-- -<?php -/* Prototype : int mt_rand ([ int $min , int $max ] ) - * Description: Generate a better random value. - * Source code: ext/standard/rand.c - */ - -echo "*** Testing mt_rand() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000E8, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of mt_rand() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(mt_rand($input, mt_getrandmax())); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing mt_rand() : usage variations *** - --- Iteration 1 -- -int(%i) - --- Iteration 2 -- -int(%i) - --- Iteration 3 -- -int(%i) - --- Iteration 4 -- -int(%i) - --- Iteration 5 -- -int(%i) - --- Iteration 6 -- -int(%i) - --- Iteration 7 -- -int(%i) - --- Iteration 8 -- -int(%i) - --- Iteration 9 -- -int(%i) - --- Iteration 10 -- -int(%i) - --- Iteration 11 -- -int(%i) - --- Iteration 12 -- -int(%i) - --- Iteration 13 -- -int(%i) - --- Iteration 14 -- -int(%i) - --- Iteration 15 -- -int(%i) - --- Iteration 16 -- -int(%i) - --- Iteration 17 -- - -Warning: mt_rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: mt_rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: mt_rand() expects parameter 1 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: mt_rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: mt_rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: mt_rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: mt_rand() expects parameter 1 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -int(%i) - --- Iteration 25 -- -int(%i) - --- Iteration 26 -- - -Warning: mt_rand() expects parameter 1 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/mt_rand_variation2.phpt b/ext/standard/tests/math/mt_rand_variation2.phpt deleted file mode 100644 index 5a5b191b1c..0000000000 --- a/ext/standard/tests/math/mt_rand_variation2.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test mt_rand() function : usage variations - different data types as $max argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int mt_rand ([ int $min , int $max ] ) - * Description: Generate a better random value. - * Source code: ext/standard/rand.c - */ - -echo "*** Testing mt_rand) : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of mt_rand() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(mt_rand(-1 * mt_getrandmax(), $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing mt_rand) : usage variations *** - --- Iteration 1 -- -int(%i) - --- Iteration 2 -- -int(%i) - --- Iteration 3 -- -int(%i) - --- Iteration 4 -- -int(%i) - --- Iteration 5 -- -int(%i) - --- Iteration 6 -- -int(%i) - --- Iteration 7 -- -int(%i) - --- Iteration 8 -- - -Warning: mt_rand() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 9 -- -int(%i) - --- Iteration 10 -- -int(%i) - --- Iteration 11 -- -int(%i) - --- Iteration 12 -- -int(%i) - --- Iteration 13 -- -int(%i) - --- Iteration 14 -- -int(%i) - --- Iteration 15 -- -int(%i) - --- Iteration 16 -- -int(%i) - --- Iteration 17 -- - -Warning: mt_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: mt_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: mt_rand() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: mt_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: mt_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: mt_rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: mt_rand() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -int(%i) - --- Iteration 25 -- -int(%i) - --- Iteration 26 -- - -Warning: mt_rand() expects parameter 2 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/mt_srand_variation1.phpt b/ext/standard/tests/math/mt_srand_variation1.phpt deleted file mode 100644 index 2856446e19..0000000000 --- a/ext/standard/tests/math/mt_srand_variation1.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test mt_srand() function : usage variations - different data types as $seed argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : void mt_srand ([ int $seed ] ) - * Description: Seed the better random number generator. - * Source code: ext/standard/rand.c - */ - -echo "*** Testing mt_srand() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of mt_srand() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(mt_srand($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing mt_srand() : usage variations *** - --- Iteration 1 -- -NULL - --- Iteration 2 -- -NULL - --- Iteration 3 -- -NULL - --- Iteration 4 -- -NULL - --- Iteration 5 -- -NULL - --- Iteration 6 -- -NULL - --- Iteration 7 -- -NULL - --- Iteration 8 -- - -Warning: mt_srand() expects parameter 1 to be int, float given in %s on line %d -NULL - --- Iteration 9 -- -NULL - --- Iteration 10 -- -NULL - --- Iteration 11 -- -NULL - --- Iteration 12 -- -NULL - --- Iteration 13 -- -NULL - --- Iteration 14 -- -NULL - --- Iteration 15 -- -NULL - --- Iteration 16 -- -NULL - --- Iteration 17 -- - -Warning: mt_srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: mt_srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: mt_srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: mt_srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: mt_srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: mt_srand() expects parameter 1 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -NULL - --- Iteration 25 -- -NULL - --- Iteration 26 -- - -Warning: mt_srand() expects parameter 1 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/rand_variation1.phpt b/ext/standard/tests/math/rand_variation1.phpt deleted file mode 100644 index d77d48e6a4..0000000000 --- a/ext/standard/tests/math/rand_variation1.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test rand() function : usage variations - different data types as $min argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int rand ([ int $min , int $max ] ) - * Description: Generate a random integer. - * Source code: ext/standard/rand.c - */ - -echo "*** Testing rand() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of rand() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(rand($input, 100)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing rand() : usage variations *** - --- Iteration 1 -- -int(%i) - --- Iteration 2 -- -int(%i) - --- Iteration 3 -- -int(%i) - --- Iteration 4 -- -int(%i) - --- Iteration 5 -- -int(%i) - --- Iteration 6 -- -int(%i) - --- Iteration 7 -- -int(%i) - --- Iteration 8 -- - -Warning: rand() expects parameter 1 to be int, float given in %s on line %d -NULL - --- Iteration 9 -- -int(%i) - --- Iteration 10 -- -int(%i) - --- Iteration 11 -- -int(%i) - --- Iteration 12 -- -int(%i) - --- Iteration 13 -- -int(%i) - --- Iteration 14 -- -int(%i) - --- Iteration 15 -- -int(%i) - --- Iteration 16 -- -int(%i) - --- Iteration 17 -- - -Warning: rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: rand() expects parameter 1 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: rand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: rand() expects parameter 1 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -int(%i) - --- Iteration 25 -- -int(%i) - --- Iteration 26 -- - -Warning: rand() expects parameter 1 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/rand_variation2.phpt b/ext/standard/tests/math/rand_variation2.phpt deleted file mode 100644 index 1aee6af2c7..0000000000 --- a/ext/standard/tests/math/rand_variation2.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test rand() function : usage variations - different data types as $max argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int rand ([ int $min , int $max ] ) - * Description: Generate a random integer. - * Source code: ext/standard/rand.c - */ - -echo "*** Testing rand) : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of rand() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(rand(100, $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing rand) : usage variations *** - --- Iteration 1 -- -int(%i) - --- Iteration 2 -- -int(%i) - --- Iteration 3 -- -int(%i) - --- Iteration 4 -- -int(%i) - --- Iteration 5 -- -int(%i) - --- Iteration 6 -- -int(%i) - --- Iteration 7 -- -int(%i) - --- Iteration 8 -- - -Warning: rand() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 9 -- -int(%i) - --- Iteration 10 -- -int(%i) - --- Iteration 11 -- -int(%i) - --- Iteration 12 -- -int(%i) - --- Iteration 13 -- -int(%i) - --- Iteration 14 -- -int(%i) - --- Iteration 15 -- -int(%i) - --- Iteration 16 -- -int(%i) - --- Iteration 17 -- - -Warning: rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: rand() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: rand() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: rand() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -int(%i) - --- Iteration 25 -- -int(%i) - --- Iteration 26 -- - -Warning: rand() expects parameter 2 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/round_variation2.phpt b/ext/standard/tests/math/round_variation2.phpt deleted file mode 100644 index e0358da735..0000000000 --- a/ext/standard/tests/math/round_variation2.phpt +++ /dev/null @@ -1,187 +0,0 @@ ---TEST-- -Test round() function : usage variations - different data types as $precision argument ---INI-- -precision=14 ---FILE-- -<?php -/* Prototype : float round ( float $val [, int $precision ] ) - * Description: Returns the rounded value of val to specified precision (number of digits - * after the decimal point) - * Source code: ext/standard/math.c - */ - -echo "*** Testing round() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e5, - 12.3456789000E-5, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of round() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(round(123.4456789, $input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing round() : usage variations *** - --- Iteration 1 -- -float(123) - --- Iteration 2 -- -float(123.4) - --- Iteration 3 -- -float(123.4456789) - --- Iteration 4 -- -float(0) - --- Iteration 5 -- -float(123.4456789) - --- Iteration 6 -- -float(123.4456789) - --- Iteration 7 -- -float(0) - --- Iteration 8 -- -float(123.4456789) - --- Iteration 9 -- -float(123) - --- Iteration 10 -- -float(123) - --- Iteration 11 -- -float(123) - --- Iteration 12 -- -float(123) - --- Iteration 13 -- -float(123.4) - --- Iteration 14 -- -float(123) - --- Iteration 15 -- -float(123.4) - --- Iteration 16 -- -float(123) - --- Iteration 17 -- - -Warning: round() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: round() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: round() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: round() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: round() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: round() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: round() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -float(123) - --- Iteration 25 -- -float(123) - --- Iteration 26 -- - -Warning: round() expects parameter 2 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/math/srand_variation1.phpt b/ext/standard/tests/math/srand_variation1.phpt deleted file mode 100644 index 8e5a1cc5e8..0000000000 --- a/ext/standard/tests/math/srand_variation1.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test srand() function : usage variations - different data types as $seed argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : void srand ([ int $seed ] ) - * Description: Seed the random number generator. - * Source code: ext/standard/rand.c - */ - -echo "*** Testing srand() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a class -class classA -{ -} - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - 2147483647, - - // float data -/*6*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*11*/ NULL, - null, - - // boolean data -/*13*/ true, - false, - TRUE, - FALSE, - - // empty data -/*17*/ "", - '', - array(), - - // string data -/*20*/ "abcxyz", - 'abcxyz', - $heredoc, - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp -); - -// loop through each element of $inputs to check the behaviour of srand() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(srand($input)); - $iterator++; -}; -fclose($fp); -?> -===Done=== ---EXPECTF-- -*** Testing srand() : usage variations *** - --- Iteration 1 -- -NULL - --- Iteration 2 -- -NULL - --- Iteration 3 -- -NULL - --- Iteration 4 -- -NULL - --- Iteration 5 -- -NULL - --- Iteration 6 -- -NULL - --- Iteration 7 -- -NULL - --- Iteration 8 -- - -Warning: srand() expects parameter 1 to be int, float given in %s on line %d -NULL - --- Iteration 9 -- -NULL - --- Iteration 10 -- -NULL - --- Iteration 11 -- -NULL - --- Iteration 12 -- -NULL - --- Iteration 13 -- -NULL - --- Iteration 14 -- -NULL - --- Iteration 15 -- -NULL - --- Iteration 16 -- -NULL - --- Iteration 17 -- - -Warning: srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: srand() expects parameter 1 to be int, array given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: srand() expects parameter 1 to be int, string given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: srand() expects parameter 1 to be int, object given in %s on line %d -NULL - --- Iteration 24 -- -NULL - --- Iteration 25 -- -NULL - --- Iteration 26 -- - -Warning: srand() expects parameter 1 to be int, resource given in %s on line %d -NULL -===Done=== diff --git a/ext/standard/tests/misc/time_nanosleep_error3.phpt b/ext/standard/tests/misc/time_nanosleep_error3.phpt index d10ef922d0..a419e82d0c 100644 --- a/ext/standard/tests/misc/time_nanosleep_error3.phpt +++ b/ext/standard/tests/misc/time_nanosleep_error3.phpt @@ -2,7 +2,6 @@ time_nanosleep — Delay for a number of seconds and nanoseconds --SKIPIF-- <?php -if (strpos(strtoupper(PHP_OS), 'WIN') !== false) die("skip Test is not valid for Windows"); if (!function_exists('time_nanosleep')) die("skip"); ?> --CREDITS-- diff --git a/ext/standard/tests/network/bug20134.phpt b/ext/standard/tests/network/bug20134.phpt index e311f892f7..8d97f5f6e8 100644 --- a/ext/standard/tests/network/bug20134.phpt +++ b/ext/standard/tests/network/bug20134.phpt @@ -2,7 +2,7 @@ Bug #20134 (UDP reads from invalid ports) --FILE-- <?php -# vim600:syn=php: + $fp = fsockopen("udp://localhost", 65534, $errno, $errstr); if (!$fp) { /* UDP will never cause a connection error, as it is diff --git a/ext/standard/tests/network/gethostbyname_basic001.phpt b/ext/standard/tests/network/gethostbyname_basic001.phpt index 9171e226aa..e917b59920 100644 --- a/ext/standard/tests/network/gethostbyname_basic001.phpt +++ b/ext/standard/tests/network/gethostbyname_basic001.phpt @@ -5,7 +5,6 @@ gethostbyname() function - basic type return test --SKIPIF-- <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); -if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection"); ?> --FILE-- <?php diff --git a/ext/standard/tests/network/gethostbyname_error006.phpt b/ext/standard/tests/network/gethostbyname_error006.phpt index 8a199f6286..46247a113d 100644 --- a/ext/standard/tests/network/gethostbyname_error006.phpt +++ b/ext/standard/tests/network/gethostbyname_error006.phpt @@ -6,5 +6,5 @@ gethostbyname() function - basic invalid parameter test <?php var_dump(gethostbyname(".toto.toto.toto")); ?> ---EXPECTF-- +--EXPECT-- string(15) ".toto.toto.toto" diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt index 062c2094c8..55323688de 100644 --- a/ext/standard/tests/network/inet_ipv6.phpt +++ b/ext/standard/tests/network/inet_ipv6.phpt @@ -33,7 +33,7 @@ foreach ($a as $address) { echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(3) "::1" string(3) "::2" string(4) "::35" diff --git a/ext/standard/tests/network/ip2long_variation1.phpt b/ext/standard/tests/network/ip2long_variation1.phpt deleted file mode 100644 index fa7410930f..0000000000 --- a/ext/standard/tests/network/ip2long_variation1.phpt +++ /dev/null @@ -1,199 +0,0 @@ ---TEST-- -Test ip2long() function : usage variation 1 ---FILE-- -<?php -/* Prototype : int ip2long(string ip_address) - * Description: Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address - * Source code: ext/standard/basic_functions.c - * Alias to functions: - */ - -echo "*** Testing ip2long() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$res = fopen(__FILE__,'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $res, -); - -// loop through each element of the array for ip_address - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( ip2long($value) ); -}; - -fclose($res); - -?> -===DONE=== ---EXPECTF-- -*** Testing ip2long() : usage variation *** - ---int 0-- -bool(false) - ---int 1-- -bool(false) - ---int 12345-- -bool(false) - ---int -12345-- -bool(false) - ---float 10.5-- -bool(false) - ---float -10.5-- -bool(false) - ---float 12.3456789000e10-- -bool(false) - ---float -12.3456789000e10-- -bool(false) - ---float .5-- -bool(false) - ---empty array-- -Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d) -NULL - ---int indexed array-- -Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d) -NULL - ---associative array-- -Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d) -NULL - ---nested arrays-- -Error: 2 - ip2long() expects parameter 1 to be string, array given, %s(%d) -NULL - ---uppercase NULL-- -bool(false) - ---lowercase null-- -bool(false) - ---lowercase true-- -bool(false) - ---lowercase false-- -bool(false) - ---uppercase TRUE-- -bool(false) - ---uppercase FALSE-- -bool(false) - ---empty string DQ-- -bool(false) - ---empty string SQ-- -bool(false) - ---instance of classWithToString-- -bool(false) - ---instance of classWithoutToString-- -Error: 2 - ip2long() expects parameter 1 to be string, object given, %s(%d) -NULL - ---undefined var-- -bool(false) - ---unset var-- -bool(false) - ---resource-- -Error: 2 - ip2long() expects parameter 1 to be string, resource given, %s(%d) -NULL -===DONE=== diff --git a/ext/standard/tests/network/long2ip_variation1.phpt b/ext/standard/tests/network/long2ip_variation1.phpt deleted file mode 100644 index 93efc098b5..0000000000 --- a/ext/standard/tests/network/long2ip_variation1.phpt +++ /dev/null @@ -1,203 +0,0 @@ ---TEST-- -Test long2ip() function : usage variation ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip don't run on Windows"); -?> ---FILE-- -<?php -/* Prototype : string long2ip(int proper_address) - * Description: Converts an (IPv4) Internet network address into a string in Internet standard dotted format - * Source code: ext/standard/basic_functions.c - * Alias to functions: - */ - -echo "*** Testing long2ip() : usage variation ***\n"; - -// Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$res = fopen(__FILE__,'r'); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $res, -); - -// loop through each element of the array for proper_address - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( long2ip($value) ); -}; - -fclose($res); - -?> -===DONE=== ---EXPECTF-- -*** Testing long2ip() : usage variation *** - ---float 10.5-- -string(8) "0.0.0.10" - ---float -10.5-- -string(15) "255.255.255.246" - ---float .5-- -string(7) "0.0.0.0" - ---empty array-- -Error: 2 - long2ip() expects parameter 1 to be int, array given, %slong2ip_variation1.php(%d) -NULL - ---int indexed array-- -Error: 2 - long2ip() expects parameter 1 to be int, array given, %slong2ip_variation1.php(%d) -NULL - ---associative array-- -Error: 2 - long2ip() expects parameter 1 to be int, array given, %slong2ip_variation1.php(%d) -NULL - ---nested arrays-- -Error: 2 - long2ip() expects parameter 1 to be int, array given, %slong2ip_variation1.php(%d) -NULL - ---uppercase NULL-- -string(7) "0.0.0.0" - ---lowercase null-- -string(7) "0.0.0.0" - ---lowercase true-- -string(7) "0.0.0.1" - ---lowercase false-- -string(7) "0.0.0.0" - ---uppercase TRUE-- -string(7) "0.0.0.1" - ---uppercase FALSE-- -string(7) "0.0.0.0" - ---empty string DQ-- -Error: 2 - long2ip() expects parameter 1 to be int, string given, %slong2ip_variation1.php(%d) -NULL - ---empty string SQ-- -Error: 2 - long2ip() expects parameter 1 to be int, string given, %slong2ip_variation1.php(%d) -NULL - ---string DQ-- -Error: 2 - long2ip() expects parameter 1 to be int, string given, %slong2ip_variation1.php(%d) -NULL - ---string SQ-- -Error: 2 - long2ip() expects parameter 1 to be int, string given, %slong2ip_variation1.php(%d) -NULL - ---mixed case string-- -Error: 2 - long2ip() expects parameter 1 to be int, string given, %slong2ip_variation1.php(%d) -NULL - ---heredoc-- -Error: 2 - long2ip() expects parameter 1 to be int, string given, %slong2ip_variation1.php(%d) -NULL - ---instance of classWithToString-- -Error: 2 - long2ip() expects parameter 1 to be int, object given, %slong2ip_variation1.php(%d) -NULL - ---instance of classWithoutToString-- -Error: 2 - long2ip() expects parameter 1 to be int, object given, %slong2ip_variation1.php(%d) -NULL - ---undefined var-- -string(7) "0.0.0.0" - ---unset var-- -string(7) "0.0.0.0" - ---resource-- -Error: 2 - long2ip() expects parameter 1 to be int, resource given, %slong2ip_variation1.php(%d) -NULL -===DONE=== diff --git a/ext/standard/tests/network/syslog_basic-win32.phpt b/ext/standard/tests/network/syslog_basic.phpt index 8ad480a607..47da28f094 100644 --- a/ext/standard/tests/network/syslog_basic-win32.phpt +++ b/ext/standard/tests/network/syslog_basic.phpt @@ -1,10 +1,5 @@ --TEST-- Test syslog() function : basic functionality ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Only run on Windows"); -?> --FILE-- <?php /* Prototype : bool syslog(int priority, string message) diff --git a/ext/standard/tests/network/tcp4loop.phpt b/ext/standard/tests/network/tcp4loop.phpt index a163cd9b35..a18fa3ba57 100644 --- a/ext/standard/tests/network/tcp4loop.phpt +++ b/ext/standard/tests/network/tcp4loop.phpt @@ -1,7 +1,7 @@ --TEST-- Streams Based IPv4 TCP Loopback test --FILE-- -<?php # vim:ft=php: +<?php for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); diff --git a/ext/standard/tests/network/udgloop.phpt b/ext/standard/tests/network/udgloop.phpt index 61f8f25135..47ecaf042e 100644 --- a/ext/standard/tests/network/udgloop.phpt +++ b/ext/standard/tests/network/udgloop.phpt @@ -1,7 +1,7 @@ --TEST-- Streams Based Unix Domain Datagram Loopback test --SKIPIF-- -<?php # vim:ft=php: +<?php if (array_search("udg",stream_get_transports()) === false) die('SKIP No support for UNIX domain sockets.'); ?> diff --git a/ext/standard/tests/network/udp6loop.phpt b/ext/standard/tests/network/udp6loop.phpt index 8241d80bac..3b70f43119 100644 --- a/ext/standard/tests/network/udp6loop.phpt +++ b/ext/standard/tests/network/udp6loop.phpt @@ -1,7 +1,7 @@ --TEST-- Streams Based IPv6 UDP Loopback test --SKIPIF-- -<?php # vim:ft=php: +<?php /* If IPv6 is supported on the platform this will error out with code 111 - * Connection refused. If IPv6 is NOT supported, $errno will be set to * something else (indicating parse/getaddrinfo error) diff --git a/ext/standard/tests/network/unixloop.phpt b/ext/standard/tests/network/unixloop.phpt index 83bfbb0667..2e95beb9f5 100644 --- a/ext/standard/tests/network/unixloop.phpt +++ b/ext/standard/tests/network/unixloop.phpt @@ -1,7 +1,7 @@ --TEST-- Streams Based Unix Domain Loopback test --SKIPIF-- -<?php # vim:ft=php: +<?php if (array_search("unix",stream_get_transports()) === false) die('SKIP No support for UNIX domain sockets.'); ?> diff --git a/ext/standard/tests/password/password_get_info.phpt b/ext/standard/tests/password/password_get_info.phpt index 4c8dc04ff8..22c4ce4c52 100644 --- a/ext/standard/tests/password/password_get_info.phpt +++ b/ext/standard/tests/password/password_get_info.phpt @@ -17,7 +17,7 @@ echo "OK!"; --EXPECT-- array(3) { ["algo"]=> - int(1) + string(2) "2y" ["algoName"]=> string(6) "bcrypt" ["options"]=> @@ -28,7 +28,7 @@ array(3) { } array(3) { ["algo"]=> - int(1) + string(2) "2y" ["algoName"]=> string(6) "bcrypt" ["options"]=> @@ -39,7 +39,7 @@ array(3) { } array(3) { ["algo"]=> - int(0) + NULL ["algoName"]=> string(7) "unknown" ["options"]=> @@ -48,7 +48,7 @@ array(3) { } array(3) { ["algo"]=> - int(0) + NULL ["algoName"]=> string(7) "unknown" ["options"]=> diff --git a/ext/standard/tests/password/password_get_info_argon2.phpt b/ext/standard/tests/password/password_get_info_argon2.phpt index b67fc5790e..1965d103db 100644 --- a/ext/standard/tests/password/password_get_info_argon2.phpt +++ b/ext/standard/tests/password/password_get_info_argon2.phpt @@ -15,7 +15,7 @@ echo "OK!"; --EXPECT-- array(3) { ["algo"]=> - int(2) + string(7) "argon2i" ["algoName"]=> string(7) "argon2i" ["options"]=> @@ -30,7 +30,7 @@ array(3) { } array(3) { ["algo"]=> - int(3) + string(8) "argon2id" ["algoName"]=> string(8) "argon2id" ["options"]=> diff --git a/ext/standard/tests/password/password_hash.phpt b/ext/standard/tests/password/password_hash.phpt index 47335c376a..2ddfda32d1 100644 --- a/ext/standard/tests/password/password_hash.phpt +++ b/ext/standard/tests/password/password_hash.phpt @@ -6,13 +6,22 @@ Test normal operation of password_hash() var_dump(strlen(password_hash("foo", PASSWORD_BCRYPT))); -$hash = password_hash("foo", PASSWORD_BCRYPT); +$algos = [ + PASSWORD_BCRYPT, + '2y', + 1, +]; -var_dump($hash === crypt("foo", $hash)); +foreach ($algos as $algo) { + $hash = password_hash("foo", $algo); + var_dump($hash === crypt("foo", $hash)); +} echo "OK!"; ?> --EXPECT-- int(60) bool(true) +bool(true) +bool(true) OK! diff --git a/ext/standard/tests/password/password_hash_argon2.phpt b/ext/standard/tests/password/password_hash_argon2.phpt index 184bac4ac6..a7612effa9 100644 --- a/ext/standard/tests/password/password_hash_argon2.phpt +++ b/ext/standard/tests/password/password_hash_argon2.phpt @@ -9,15 +9,33 @@ if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2 $password = "the password for testing 12345!"; -$hash = password_hash($password, PASSWORD_ARGON2I); -var_dump(password_verify($password, $hash)); - -$hash = password_hash($password, PASSWORD_ARGON2ID); -var_dump(password_verify($password, $hash)); +$algos = [ + PASSWORD_ARGON2I, + 'argon2i', + 2, + PASSWORD_ARGON2ID, + 'argon2id', + 3, +]; +foreach ($algos as $algo) { + $hash = password_hash($password, $algo); + var_dump(password_verify($password, $hash)); + var_dump(password_get_info($hash)['algo']); +} echo "OK!"; ?> --EXPECT-- bool(true) +string(7) "argon2i" +bool(true) +string(7) "argon2i" +bool(true) +string(7) "argon2i" +bool(true) +string(8) "argon2id" +bool(true) +string(8) "argon2id" bool(true) +string(8) "argon2id" OK! diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt index 5f576c3122..6416eca91b 100644 --- a/ext/standard/tests/password/password_hash_error.phpt +++ b/ext/standard/tests/password/password_hash_error.phpt @@ -29,7 +29,9 @@ NULL Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d NULL -Warning: password_hash() expects parameter 2 to be int, array given in %s on line %d +Notice: Array to string conversion in %s on line %d + +Warning: password_hash(): Unknown password hashing algorithm: Array in %s on line %d NULL Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d diff --git a/ext/standard/tests/password/password_needs_rehash.phpt b/ext/standard/tests/password/password_needs_rehash.phpt index 8efd0add8f..688d57ed32 100644 --- a/ext/standard/tests/password/password_needs_rehash.phpt +++ b/ext/standard/tests/password/password_needs_rehash.phpt @@ -6,9 +6,13 @@ Test normal operation of password_needs_rehash() // Invalid Hash, always rehash var_dump(password_needs_rehash('', PASSWORD_BCRYPT)); +var_dump(password_needs_rehash('', 1)); +var_dump(password_needs_rehash('', '2y')); // Valid, as it's an unknown algorithm +var_dump(password_needs_rehash('', PASSWORD_DEFAULT)); var_dump(password_needs_rehash('', 0)); +var_dump(password_needs_rehash('', NULL)); // Valid with cost the same var_dump(password_needs_rehash('$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y', PASSWORD_BCRYPT, array('cost' => 10))); @@ -35,6 +39,10 @@ echo "OK!"; ?> --EXPECT-- bool(true) +bool(true) +bool(true) +bool(false) +bool(false) bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt index 65766cb3fe..7180d11de7 100644 --- a/ext/standard/tests/password/password_needs_rehash_error.phpt +++ b/ext/standard/tests/password/password_needs_rehash_error.phpt @@ -7,11 +7,11 @@ var_dump(password_needs_rehash()); var_dump(password_needs_rehash('')); -var_dump(password_needs_rehash('', "foo")); +var_dump(password_needs_rehash('', [])); -var_dump(password_needs_rehash(array(), 1)); +var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); -var_dump(password_needs_rehash("", 1, "foo")); +var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); echo "OK!"; ?> @@ -21,9 +21,7 @@ NULL Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d NULL - -Warning: password_needs_rehash() expects parameter 2 to be int, string given in %s on line %d -NULL +bool(false) Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d NULL diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt index 7f634b0eea..b152b91aad 100644 --- a/ext/standard/tests/serialize/005.phpt +++ b/ext/standard/tests/serialize/005.phpt @@ -9,7 +9,7 @@ function do_autoload($class_name) { if ($class_name != 'autoload_not_available') { - require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c'); + require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.inc'); } echo __FUNCTION__ . "($class_name)\n"; } diff --git a/ext/standard/tests/serialize/autoload_implements.p5c b/ext/standard/tests/serialize/autoload_implements.inc index 2c3479c860..55fcc3cd9f 100755..100644 --- a/ext/standard/tests/serialize/autoload_implements.p5c +++ b/ext/standard/tests/serialize/autoload_implements.inc @@ -7,4 +7,4 @@ class autoload_implements implements autoload_interface { } } -?>
\ No newline at end of file +?> diff --git a/ext/standard/tests/serialize/autoload_interface.p5c b/ext/standard/tests/serialize/autoload_interface.inc index 6908155e61..e6a416e721 100755..100644 --- a/ext/standard/tests/serialize/autoload_interface.p5c +++ b/ext/standard/tests/serialize/autoload_interface.inc @@ -4,4 +4,4 @@ interface autoload_interface { function testFunction(); } -?>
\ No newline at end of file +?> diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt index 2111962294..1a46fc7851 100644 --- a/ext/standard/tests/serialize/bug30234.phpt +++ b/ext/standard/tests/serialize/bug30234.phpt @@ -8,7 +8,7 @@ Bug #30234 (__autoload() not invoked for interfaces) <?php spl_autoload_register(function ($class_name) { - require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c'); + require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.inc'); echo __FUNCTION__ . '(' . $class_name . ")\n"; }); diff --git a/ext/standard/tests/serialize/typed_property_refs.phpt b/ext/standard/tests/serialize/typed_property_refs.phpt new file mode 100644 index 0000000000..9475e8a783 --- /dev/null +++ b/ext/standard/tests/serialize/typed_property_refs.phpt @@ -0,0 +1,73 @@ +--TEST-- +unserialize with references to typed properties shall skip the references or fail +--FILE-- +<?php + +class A { + public int $a; + public $b; +} + +class B { + public $a; + public int $b; +} + +class C { + public int $a; + public string $b; +} + +class D { + public int $a; + public float $b; +} + +var_dump(unserialize('O:1:"A":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +var_dump(unserialize('O:1:"B":2:{s:1:"a";i:1;s:1:"b";R:2;}')); + +try { + var_dump(unserialize('O:1:"A":2:{s:1:"a";N;s:1:"b";R:2;}')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unserialize('O:1:"B":2:{s:1:"a";N;s:1:"b";R:2;}')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unserialize('O:1:"C":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unserialize('O:1:"C":2:{s:1:"b";s:1:"x";s:1:"a";R:2;}')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unserialize('O:1:"D":2:{s:1:"a";i:1;s:1:"b";R:2;}')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +object(A)#1 (2) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) +} +object(B)#1 (2) { + ["a"]=> + &int(1) + ["b"]=> + &int(1) +} +Typed property A::$a must be int, null used +Typed property B::$b must be int, null used +Typed property C::$b must be string, int used +Typed property C::$a must be int, string used +Reference with value of type int held by property D::$a of type int is not compatible with property D::$b of type float diff --git a/ext/standard/tests/streams/bug61371-win.phpt b/ext/standard/tests/streams/bug61371-unix.phpt index dc70530447..7c64d1d30f 100644 --- a/ext/standard/tests/streams/bug61371-win.phpt +++ b/ext/standard/tests/streams/bug61371-unix.phpt @@ -2,8 +2,8 @@ Bug #61371: stream_context_create() causes memory leaks on use streams_socket_create --SKIPIF-- <?php -if(substr(PHP_OS, 0, 3) != 'WIN' ) { - die('skip windows only test'); +if(substr(PHP_OS, 0, 3) == 'WIN' ) { + die('skip non windows test'); } --FILE-- <?php @@ -19,7 +19,7 @@ for($test=1;$test<=3;$test++) { echo 'memory: '.round($current / 1024, 0)."kb\n"; for($i=0;$i<=100;$i++) { $context = stream_context_create(array()); - $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); + $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); if ($doFclose) fclose($stream); unset($context); unset($stream); diff --git a/ext/standard/tests/streams/bug61371.phpt b/ext/standard/tests/streams/bug61371.phpt index 7c64d1d30f..924219f896 100644 --- a/ext/standard/tests/streams/bug61371.phpt +++ b/ext/standard/tests/streams/bug61371.phpt @@ -1,10 +1,5 @@ --TEST-- Bug #61371: stream_context_create() causes memory leaks on use streams_socket_create ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == 'WIN' ) { - die('skip non windows test'); -} --FILE-- <?php function test($doFclose) { @@ -19,7 +14,7 @@ for($test=1;$test<=3;$test++) { echo 'memory: '.round($current / 1024, 0)."kb\n"; for($i=0;$i<=100;$i++) { $context = stream_context_create(array()); - $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); + $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context); if ($doFclose) fclose($stream); unset($context); unset($stream); diff --git a/ext/standard/tests/streams/bug64433.phpt b/ext/standard/tests/streams/bug64433.phpt index a7e4cf4931..897947f453 100644 --- a/ext/standard/tests/streams/bug64433.phpt +++ b/ext/standard/tests/streams/bug64433.phpt @@ -8,11 +8,9 @@ $res = @include dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.in if(!$res) { die("skip could not open cli server script"); } - -if (CURL_WRAPPERS_ENABLED) { - die("skip curl wrappers used"); -} ?> +--CONFLICTS-- +server --FILE-- <?php include dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.inc"; diff --git a/ext/standard/tests/streams/bug70198.phpt b/ext/standard/tests/streams/bug70198.phpt index f79a3d03c4..7b4b8cc16d 100644 --- a/ext/standard/tests/streams/bug70198.phpt +++ b/ext/standard/tests/streams/bug70198.phpt @@ -4,6 +4,8 @@ Bug #70198 Checking liveness does not work as expected <?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?> +--CONFLICTS-- +server --FILE-- <?php diff --git a/ext/standard/tests/streams/bug74090.phpt b/ext/standard/tests/streams/bug74090.phpt index f6187003fa..7a0250a124 100644 --- a/ext/standard/tests/streams/bug74090.phpt +++ b/ext/standard/tests/streams/bug74090.phpt @@ -7,14 +7,26 @@ if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); } ?> --FILE-- <?php +$port = 12327; +$server = false; +while(!$server && $port < 20000){ + $port++; + $server = stream_socket_server("udp://localhost:$port", $errno, $errstr, STREAM_SERVER_BIND); +} +if(!$server){ + var_dump(false); + die("Cannot create server socket"); +} $data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE="); -$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); +$fd = stream_socket_client("udp://localhost:$port", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); stream_set_blocking($fd, 0); -stream_socket_sendto($fd,$data); -sleep(1); -$ret = stream_get_contents($fd,65565); +stream_socket_sendto($fd, $data); +stream_socket_recvfrom($server, 1, 0, $peer); +stream_socket_sendto($server, $data, 0, $peer); +$ret = stream_get_contents($fd, 65565); var_dump(strlen($ret) > 0); -stream_socket_shutdown($fd,STREAM_SHUT_RDWR); +stream_socket_shutdown($fd, STREAM_SHUT_RDWR); +stream_socket_shutdown($server, STREAM_SHUT_RDWR); ?> ==DONE== --EXPECT-- diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt index 20d3cba84a..8e0c99fb83 100644 --- a/ext/standard/tests/streams/proc_open_bug69900.phpt +++ b/ext/standard/tests/streams/proc_open_bug69900.phpt @@ -6,7 +6,7 @@ Bug #69900 Commandline input/output weird behaviour with STDIO error_reporting(E_ALL); $fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test69900.php"; -$max_ms = ((bool)getenv('TRAVIS') || (bool)getenv('APPVEYOR')) ? 10 : 1; +$max_ms = 10; $test_content = '<?php @@ -34,7 +34,13 @@ for($i = 0; $i < 10; $i++){ $t1 = microtime(1); echo $s; - echo "fgets() took ", (($t1 - $t0)*1000 > $max_ms ? 'more' : 'less'), " than $max_ms ms\n"; + + $dt_ms = ($t1 - $t0)*1000; + if ($dt_ms > $max_ms) { + echo "fgets() took more than $max_ms ms ($dt_ms ms)\n"; + } else { + echo "fgets() took less than $max_ms ms\n"; + } } fclose($pipes[0]); @@ -51,7 +57,7 @@ $fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test69900.php"; ?> --EXPECTF-- hello0 -fgets() took more than %d ms +fgets() took more than %d ms (%s ms) hello1 fgets() took less than %d ms hello2 diff --git a/ext/standard/tests/streams/stream_filter_register.phpt b/ext/standard/tests/streams/stream_filter_register.phpt new file mode 100644 index 0000000000..6ac28a1174 --- /dev/null +++ b/ext/standard/tests/streams/stream_filter_register.phpt @@ -0,0 +1,25 @@ +--TEST-- +testing the behavior of stream_filter_register +--CREDITS-- +Robrecht Plaisier <php@mcq8.be> +User Group: PHP-WVL & PHPGent #PHPTestFest +--FILE-- +<?php +class foo extends php_user_filter { + function filter($in, $out, &$consumed, $closing) { + } +} + +class bar extends php_user_filter { + function filter($in, $out, &$consumed, $closing) { + } +} + +var_dump(stream_filter_register("myfilter","foo")); +var_dump(stream_filter_register("myfilter","bar")); +var_dump(stream_filter_register("foo","foo")); +?> +--EXPECT-- +bool(true) +bool(false) +bool(true) diff --git a/ext/standard/tests/streams/stream_socket_get_name.phpt b/ext/standard/tests/streams/stream_socket_get_name.phpt index 34c88b9c96..affc3762ea 100644 --- a/ext/standard/tests/streams/stream_socket_get_name.phpt +++ b/ext/standard/tests/streams/stream_socket_get_name.phpt @@ -4,17 +4,12 @@ string stream_socket_get_name ( resource $handle , bool $want_peer ) ; marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br --FILE-- <?php -$serverUri = "tcp://127.0.0.1:31854"; +$serverUri = "tcp://127.0.0.1:31855"; $sock = stream_socket_server($serverUri, $errno, $errstr); var_dump(stream_socket_get_name($sock, false)); var_dump(stream_socket_get_name($sock, true)); ?> ---CLEAN-- -<?php -unset($serverUri); -unset($sock); -?> --EXPECT-- -string(15) "127.0.0.1:31854" +string(15) "127.0.0.1:31855" bool(false) diff --git a/ext/standard/tests/streams/stream_socket_recvfrom.phpt b/ext/standard/tests/streams/stream_socket_recvfrom.phpt index 08de4e31a9..a4a1efdb4f 100644 --- a/ext/standard/tests/streams/stream_socket_recvfrom.phpt +++ b/ext/standard/tests/streams/stream_socket_recvfrom.phpt @@ -4,7 +4,7 @@ string stream_socket_recvfrom ( resource $socket , int $length [, int $flags = 0 marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br --FILE-- <?php -$serverUri = "tcp://127.0.0.1:31854"; +$serverUri = "tcp://127.0.0.1:31856"; $sock = stream_socket_server($serverUri, $errno, $errstr); $sockLen = 1500; @@ -12,16 +12,6 @@ var_dump(stream_socket_recvfrom($sock, $sockLen)); var_dump(stream_socket_recvfrom($sock, $sockLen, STREAM_OOB)); var_dump(stream_socket_recvfrom($sock, $sockLen, STREAM_PEEK)); ?> ---CLEAN-- -<?php -fclose($sock); -unset($serverUri); -unset($clientFlags); -unset($sock); -unset($sockLen); -unset($errno); -unset($errstr); -?> --EXPECT-- bool(false) bool(false) diff --git a/ext/standard/tests/streams/stream_socket_sendto.phpt b/ext/standard/tests/streams/stream_socket_sendto.phpt index 73515a7434..2812d30930 100644 --- a/ext/standard/tests/streams/stream_socket_sendto.phpt +++ b/ext/standard/tests/streams/stream_socket_sendto.phpt @@ -8,7 +8,7 @@ if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); } ?> --FILE-- <?php -$serverUri = "tcp://127.0.0.1:31854"; +$serverUri = "tcp://127.0.0.1:31857"; $serverUrl = "http://php.net"; $stringSocket = "out of band data."; $stringFWrite = "normal data to transmit"; diff --git a/ext/standard/tests/strings/addslashes_variation1.phpt b/ext/standard/tests/strings/addslashes_variation1.phpt deleted file mode 100644 index e204498ba6..0000000000 --- a/ext/standard/tests/strings/addslashes_variation1.phpt +++ /dev/null @@ -1,171 +0,0 @@ ---TEST-- -Test addslashes() function : usage variations - non-string type argument ---FILE-- -<?php -/* Prototype : string addslashes ( string $str ) - * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc. - * Source code: ext/standard/string.c -*/ - -/* - * Test addslashes() with non-string type argument such as int, float, etc -*/ - -echo "*** Testing addslashes() : with non-string type argument ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj'ct"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - 12345, - -2345, - - // float values -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*15*/ true, - false, - TRUE, - FALSE, - - // empty string -/*19*/ "", - '', - - // undefined variable -/*21*/ $undefined_var, - - // unset variable -/*22*/ $unset_var, - - // objects -/*23*/ new sample(), - - // resource -/*24*/ $file_handle, - -/*25*/ NULL, - null -); - - -// loop through each element of the array and check the working of addslashes() -// when $str argument is supplied with different values -echo "\n--- Testing addslashes() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( addslashes($str) ); - - $counter ++; -} - -// closing the file -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing addslashes() : with non-string type argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing addslashes() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: addslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(7) "obj\'ct" --- Iteration 24 -- - -Warning: addslashes() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" --- Iteration 26 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/bin2hex_variation1.phpt b/ext/standard/tests/strings/bin2hex_variation1.phpt deleted file mode 100644 index d7bf15f4f4..0000000000 --- a/ext/standard/tests/strings/bin2hex_variation1.phpt +++ /dev/null @@ -1,128 +0,0 @@ ---TEST-- -Test bin2hex() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string bin2hex ( string $str ) - * Description: Convert binary data into hexadecimal representation - * Source code: ext/standard/string.c -*/ - -echo "*** Testing bin2hex() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 123456, - - // float values -/*4*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*7*/ array(), - array(0), - array(1, 2), - - // boolean values -/*10*/true, - false, - TRUE, - FALSE, - - // null values -/*14*/NULL, - null, - - // objects -/*16*/new sample(), - - // resource -/*17*/$file_handle, - - // undefined variable -/*18*/@$undefined_var, - - // unset variable -/*19*/@$unset_var -); - -// loop through with each element of the $inputs array to test bin2hex() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump(bin2hex($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing bin2hex() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(2) "30" --- Iteration 2 -- -string(2) "31" --- Iteration 3 -- -string(12) "313233343536" --- Iteration 4 -- -string(8) "31302e35" --- Iteration 5 -- -string(10) "2d32302e35" --- Iteration 6 -- -string(24) "313031323334353637303030" --- Iteration 7 -- - -Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: bin2hex() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- -string(2) "31" --- Iteration 11 -- -string(0) "" --- Iteration 12 -- -string(2) "31" --- Iteration 13 -- -string(0) "" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(26) "73616d706c65206f626a656374" --- Iteration 17 -- - -Warning: bin2hex() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/bug46578.phpt b/ext/standard/tests/strings/bug46578.phpt index a5eff1dbe2..e07e928597 100644 --- a/ext/standard/tests/strings/bug46578.phpt +++ b/ext/standard/tests/strings/bug46578.phpt @@ -16,7 +16,7 @@ var_dump(strip_tags('<! a>')); var_dump(strip_tags('<? ax')); ?> ---EXPECTF-- +--EXPECT-- string(6) "foobar" string(6) "foobar" string(6) "foobar" diff --git a/ext/standard/tests/strings/bug47443.phpt b/ext/standard/tests/strings/bug47443.phpt index 033aeb4d79..e673e807ee 100644 --- a/ext/standard/tests/strings/bug47443.phpt +++ b/ext/standard/tests/strings/bug47443.phpt @@ -8,7 +8,7 @@ var_dump(metaphone("scrath")); var_dump(metaphone("scratc")); ?> ---EXPECTF-- +--EXPECT-- string(4) "SKRX" string(4) "SKR0" string(5) "SKRTK" diff --git a/ext/standard/tests/strings/bug47481.phpt b/ext/standard/tests/strings/bug47481.phpt index 6cad98ac91..a8f2e028a0 100644 --- a/ext/standard/tests/strings/bug47481.phpt +++ b/ext/standard/tests/strings/bug47481.phpt @@ -21,7 +21,7 @@ var_dump($array); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- -- Before sorting: -- array(6) { [0]=> diff --git a/ext/standard/tests/strings/bug65947.phpt b/ext/standard/tests/strings/bug65947.phpt index a746f96f7a..ff7dbf4b8c 100644 --- a/ext/standard/tests/strings/bug65947.phpt +++ b/ext/standard/tests/strings/bug65947.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #65947 (basename is no more working after fgetcsv in certain situation) ---SKIPIF-- -<?php if (!PHP_ZTS) { print "skip only for zts build"; } --FILE-- <?php $filename = 'test.toto'; diff --git a/ext/standard/tests/strings/bug68996.phpt b/ext/standard/tests/strings/bug68996.phpt index fea1371a32..3f1e6c4929 100644 --- a/ext/standard/tests/strings/bug68996.phpt +++ b/ext/standard/tests/strings/bug68996.phpt @@ -1,10 +1,5 @@ --TEST-- Bug #68996 (Invalid free of CG(interned_empty_string)) ---SKIPIF-- -<?php -if (getenv("USE_ZEND_ALLOC") !== "0") - print "skip Need Zend MM disabled"; -?> --INI-- html_errors=1 --FILE-- diff --git a/ext/standard/tests/strings/bug72434.phpt b/ext/standard/tests/strings/bug72434.phpt index 447ad4609c..6d64baa26f 100644 --- a/ext/standard/tests/strings/bug72434.phpt +++ b/ext/standard/tests/strings/bug72434.phpt @@ -1,9 +1,5 @@ --TEST-- Bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize ---SKIPIF-- -<?php -if(!class_exists('zip')) die('skip ZipArchive'); -?> --FILE-- <?php // The following array will be serialized and this representation will be freed later on. diff --git a/ext/standard/tests/strings/chop_variation1.phpt b/ext/standard/tests/strings/chop_variation1.phpt deleted file mode 100644 index 51f53f0153..0000000000 --- a/ext/standard/tests/strings/chop_variation1.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -Test chop() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : string chop ( string $str [, string $charlist] ) - * Description: Strip whitespace (or other characters) from the end of a string - * Source code: ext/standard/string.c -*/ - -/* - * Testing chop() : with different unexpected values for $str argument passed to the function -*/ - -echo "*** Testing chop() : with unexpected values for str argument ***\n"; -// initialize all required variables - -$charlist = " @#$%1234567890"; -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring class -class sample { - public function __toString() { - return " @#$%Object @#$%"; - } -} -$sample_obj = new sample; - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // empty string - "", - '', - - // null values - NULL, - null, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var, - - // object - $sample_obj, - - // resource - $file_handle -); - - -// loop through each element of the array and check the working of chop() -// when $str argument is supplied with different values - -echo "\n--- Testing chop() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( chop($str) ); - var_dump( chop($str, $charlist) ); - - $counter ++; -} - -// closing the resource -fclose( $file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing chop() : with unexpected values for str argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing chop() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" -string(0) "" --- Iteration 2 -- -string(1) "1" -string(0) "" --- Iteration 3 -- -string(5) "12345" -string(0) "" --- Iteration 4 -- -string(5) "-2345" -string(1) "-" --- Iteration 5 -- -string(4) "10.5" -string(3) "10." --- Iteration 6 -- -string(5) "-10.5" -string(4) "-10." --- Iteration 7 -- -string(12) "101234567000" -string(0) "" --- Iteration 8 -- -string(13) "1.07654321E-9" -string(12) "1.07654321E-" --- Iteration 9 -- -string(3) "0.5" -string(2) "0." --- Iteration 10 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" -string(0) "" --- Iteration 16 -- -string(0) "" -string(0) "" --- Iteration 17 -- -string(1) "1" -string(0) "" --- Iteration 18 -- -string(0) "" -string(0) "" --- Iteration 19 -- -string(0) "" -string(0) "" --- Iteration 20 -- -string(0) "" -string(0) "" --- Iteration 21 -- -string(0) "" -string(0) "" --- Iteration 22 -- -string(0) "" -string(0) "" --- Iteration 23 -- -string(0) "" -string(0) "" --- Iteration 24 -- -string(0) "" -string(0) "" --- Iteration 25 -- -string(16) " @#$%Object @#$%" -string(11) " @#$%Object" --- Iteration 26 -- - -Warning: chop() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: chop() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/chop_variation2.phpt b/ext/standard/tests/strings/chop_variation2.phpt deleted file mode 100644 index cad8ec75f5..0000000000 --- a/ext/standard/tests/strings/chop_variation2.phpt +++ /dev/null @@ -1,175 +0,0 @@ ---TEST-- -Test chop() function : usage variations - unexpected values for charlist argument ---FILE-- -<?php -/* Prototype : string chop ( string $str [, string $charlist] ) - * Description: Strip whitespace (or other characters) from the end of a string - * Source code: ext/standard/string.c -*/ - -/* - * Testing chop() : with different unexpected values for charlist argument passes to the function -*/ - -echo "*** Testing chop() : with different unexpected values for charlist argument ***\n"; -// initialize all required variables -$str = 'hello world12345 '; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring class -class sample { - public function __toString() { - return "@# $%12345"; - } -} - -// defining a resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource - $file_handle, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var - -); - - -// loop through each element of the array and check the working of chop() -// when $charlist argument is supplied with different values - -echo "\n--- Testing chop() by supplying different values for 'charlist' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $charlist = $values [$index]; - - var_dump( chop($str, $charlist) ); - - $counter ++; -} - -// closing the resource -fclose($file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing chop() : with different unexpected values for charlist argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing chop() by supplying different values for 'charlist' argument --- --- Iteration 1 -- -string(17) "hello world12345 " --- Iteration 2 -- -string(17) "hello world12345 " --- Iteration 3 -- -string(17) "hello world12345 " --- Iteration 4 -- -string(17) "hello world12345 " --- Iteration 5 -- -string(17) "hello world12345 " --- Iteration 6 -- -string(17) "hello world12345 " --- Iteration 7 -- -string(17) "hello world12345 " --- Iteration 8 -- -string(17) "hello world12345 " --- Iteration 9 -- -string(17) "hello world12345 " --- Iteration 10 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: chop() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(17) "hello world12345 " --- Iteration 16 -- -string(17) "hello world12345 " --- Iteration 17 -- -string(17) "hello world12345 " --- Iteration 18 -- -string(17) "hello world12345 " --- Iteration 19 -- -string(11) "hello world" --- Iteration 20 -- -string(17) "hello world12345 " --- Iteration 21 -- -string(17) "hello world12345 " --- Iteration 22 -- -string(17) "hello world12345 " --- Iteration 23 -- -string(17) "hello world12345 " --- Iteration 24 -- - -Warning: chop() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(17) "hello world12345 " --- Iteration 26 -- -string(17) "hello world12345 " -Done diff --git a/ext/standard/tests/strings/chunk_split_variation1.phpt b/ext/standard/tests/strings/chunk_split_variation1.phpt deleted file mode 100644 index 0b24f9b6d9..0000000000 --- a/ext/standard/tests/strings/chunk_split_variation1.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test chunk_split() function : usage variations - with unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) - * Description: Returns split line %d%d - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing chunk_split() : with unexpected values for 'str' argument ***\n"; - -// Initialising variables -$chunklen = 2; -$ending = ' '; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource data - $fp -); - -// loop through each element of the array for 'str' -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( chunk_split($values[$count], $chunklen, $ending) ); -}; - -echo "Done"; - -// close the resource -fclose($fp); - -?> ---EXPECTF-- -*** Testing chunk_split() : with unexpected values for 'str' argument *** --- Iteration 1 -- -string(2) "0 " --- Iteration 2 -- -string(2) "1 " --- Iteration 3 -- -string(8) "12 34 5 " --- Iteration 4 -- -string(8) "-2 34 5 " --- Iteration 5 -- -string(6) "10 .5 " --- Iteration 6 -- -string(8) "-1 0. 5 " --- Iteration 7 -- -string(18) "10 12 34 56 70 00 " --- Iteration 8 -- -string(20) "1. 07 65 43 21 E- 9 " --- Iteration 9 -- -string(5) "0. 5 " --- Iteration 10 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 11 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 12 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 13 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 14 -- - -Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87 -NULL --- Iteration 15 -- -string(1) " " --- Iteration 16 -- -string(1) " " --- Iteration 17 -- -string(2) "1 " --- Iteration 18 -- -string(1) " " --- Iteration 19 -- -string(2) "1 " --- Iteration 20 -- -string(1) " " --- Iteration 21 -- -string(1) " " --- Iteration 22 -- -string(1) " " --- Iteration 23 -- -string(9) "st ri ng " --- Iteration 24 -- -string(9) "st ri ng " --- Iteration 25 -- -string(9) "ob je ct " --- Iteration 26 -- -string(1) " " --- Iteration 27 -- -string(1) " " --- Iteration 28 -- - -Warning: chunk_split() expects parameter 1 to be string, resource given in %s on line 87 -NULL -Done diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt deleted file mode 100644 index b5d58b0d00..0000000000 --- a/ext/standard/tests/strings/chunk_split_variation2.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) - * Description: Returns split line - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing chunk_split() : with unexpected values for 'chunklen' argument ***\n"; - -// Initialise function arguments -$str = 'This is chuklen variation'; -$ending = '*'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get resource variable -$fp = fopen(__FILE__, 'r'); - -//Class to get object variable -class MyClass -{ - public function __toString() { - return "object"; - } -} - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - (float) PHP_INT_MAX + 1, - (float) -PHP_INT_MAX - 1, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable - $fp -); - -// loop through each element of the values for 'chunklen' -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( chunk_split($str, $values[$count], $ending) ); -} - -//closing resource -fclose($fp); - -?> -===DONE=== ---EXPECTF-- -*** Testing chunk_split() : with unexpected values for 'chunklen' argument *** --- Iteration 1 -- -string(28) "This is ch*uklen vari*ation*" --- Iteration 2 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 3 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 4 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 5 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 6 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 8 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 9 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 10 -- - -Warning: chunk_split() expects parameter 2 to be int, array given in %schunk_split_variation2.php on line %d -NULL --- Iteration 11 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 12 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 13 -- -string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" --- Iteration 14 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 15 -- -string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" --- Iteration 16 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 17 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 18 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 19 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 20 -- - -Warning: chunk_split() expects parameter 2 to be int, string given in %schunk_split_variation2.php on line %d -NULL --- Iteration 21 -- - -Warning: chunk_split() expects parameter 2 to be int, object given in %schunk_split_variation2.php on line %d -NULL --- Iteration 22 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 23 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %schunk_split_variation2.php on line %d -bool(false) --- Iteration 24 -- - -Warning: chunk_split() expects parameter 2 to be int, resource given in %schunk_split_variation2.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt deleted file mode 100644 index 791535371f..0000000000 --- a/ext/standard/tests/strings/chunk_split_variation3.phpt +++ /dev/null @@ -1,160 +0,0 @@ ---TEST-- -Test chunk_split() function : usage variations - unexpected values for 'ending' argument ---FILE-- -<?php -/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) - * Description: Returns split line - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing chunk_split() : unexpected values for 'ending' ***\n"; - -// Initializing variables -$str = 'This is simple string.'; -$chunklen = 4.9; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__,'r'); - -//Class to get object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//different values for 'ending' -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.123456e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource data - $fp -); - -// loop through each element of values for 'ending' -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( chunk_split($str, $chunklen, $values[$count]) ); -} - -echo "Done"; - -//closing resource -fclose($fp); -?> ---EXPECTF-- -*** Testing chunk_split() : unexpected values for 'ending' *** --- Iteration 1 -- -string(28) "This0 is 0simp0le s0trin0g.0" --- Iteration 2 -- -string(28) "This1 is 1simp1le s1trin1g.1" --- Iteration 3 -- -string(52) "This12345 is 12345simp12345le s12345trin12345g.12345" --- Iteration 4 -- -string(52) "This-2345 is -2345simp-2345le s-2345trin-2345g.-2345" --- Iteration 5 -- -string(46) "This10.5 is 10.5simp10.5le s10.5trin10.5g.10.5" --- Iteration 6 -- -string(52) "This-10.5 is -10.5simp-10.5le s-10.5trin-10.5g.-10.5" --- Iteration 7 -- -string(94) "This101234560000 is 101234560000simp101234560000le s101234560000trin101234560000g.101234560000" --- Iteration 8 -- -string(100) "This1.07654321E-9 is 1.07654321E-9simp1.07654321E-9le s1.07654321E-9trin1.07654321E-9g.1.07654321E-9" --- Iteration 9 -- -string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5" --- Iteration 10 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: chunk_split() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(22) "This is simple string." --- Iteration 16 -- -string(22) "This is simple string." --- Iteration 17 -- -string(28) "This1 is 1simp1le s1trin1g.1" --- Iteration 18 -- -string(22) "This is simple string." --- Iteration 19 -- -string(28) "This1 is 1simp1le s1trin1g.1" --- Iteration 20 -- -string(22) "This is simple string." --- Iteration 21 -- -string(22) "This is simple string." --- Iteration 22 -- -string(22) "This is simple string." --- Iteration 23 -- -string(58) "Thisobject is objectsimpobjectle sobjecttrinobjectg.object" --- Iteration 24 -- -string(22) "This is simple string." --- Iteration 25 -- -string(22) "This is simple string." --- Iteration 26 -- - -Warning: chunk_split() expects parameter 3 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/convert_cyr_string_variation1.phpt b/ext/standard/tests/strings/convert_cyr_string_variation1.phpt deleted file mode 100644 index 89cb6ccc4b..0000000000 --- a/ext/standard/tests/strings/convert_cyr_string_variation1.phpt +++ /dev/null @@ -1,139 +0,0 @@ ---TEST-- -Test convert_cyr_string() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string convert_cyr_string ( string $str , string $from , string $to ) - * Description: Convert from one Cyrillic character set to another - * Source code: ext/standard/string.c -*/ - -echo "*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $str -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test convert_cyr_string() function -$count = 1; -$from = "w"; -$to = "k"; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( convert_cyr_string($input, $from, $to) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing convert_cyr_string() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: convert_cyr_string() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/convert_uudecode_variation1.phpt b/ext/standard/tests/strings/convert_uudecode_variation1.phpt deleted file mode 100644 index 4c66f076a5..0000000000 --- a/ext/standard/tests/strings/convert_uudecode_variation1.phpt +++ /dev/null @@ -1,161 +0,0 @@ ---TEST-- -Test convert_uudecode() function : usage variations - test values for $data argument ---FILE-- -<?php - -/* Prototype : string convert_uudecode ( string $data ) - * Description: Decode a uuencoded string - * Source code: ext/standard/uuencode.c -*/ - -echo "*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $data -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $data array to test convert_uudecode() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( convert_uudecode($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument *** --- Iteration 1 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 14 -- -bool(false) --- Iteration 15 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- - -Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: convert_uudecode() expects parameter 1 to be string, resource given in %s on line %d -bool(false) --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/convert_uuencode_variation1.phpt b/ext/standard/tests/strings/convert_uuencode_variation1.phpt deleted file mode 100644 index c9ef4335be..0000000000 --- a/ext/standard/tests/strings/convert_uuencode_variation1.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test convert_uuencode() function : usage variations - test values for $data argument ---FILE-- -<?php - -/* Prototype : string convert_uuencode ( string $data ) - * Description: Uuencode a string - * Source code: ext/standard/uuencode.c -*/ - -echo "*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $data -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $data array to test convert_uuencode() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( bin2hex(convert_uuencode($input)) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument *** --- Iteration 1 -- -string(16) "212c6060600a600a" --- Iteration 2 -- -string(16) "212c3060600a600a" --- Iteration 3 -- -string(16) "232c4334550a600a" --- Iteration 4 -- -string(16) "232c4334560a600a" --- Iteration 5 -- -string(40) "2a2c4324542d5330582c5338542d5060600a600a" --- Iteration 6 -- -string(40) "2b2b3328512d233c542e232c562d2340600a600a" --- Iteration 7 -- -string(24) "242c33604e2d3060600a600a" --- Iteration 8 -- -string(24) "252b3328502b4334600a600a" --- Iteration 9 -- -string(40) "2c2c3360512c432c542d3338572c2360500a600a" --- Iteration 10 -- - -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" --- Iteration 11 -- - -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" --- Iteration 12 -- - -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" --- Iteration 13 -- -string(16) "212c3060600a600a" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(16) "212c3060600a600a" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(48) "2d3c56254d3c26514528265d423a4635433d6060600a600a" --- Iteration 20 -- - -Warning: convert_uuencode() expects parameter 1 to be string, resource given in %s on line %d -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/count_chars_variation1.phpt b/ext/standard/tests/strings/count_chars_variation1.phpt deleted file mode 100644 index 9e78219dbe..0000000000 --- a/ext/standard/tests/strings/count_chars_variation1.phpt +++ /dev/null @@ -1,262 +0,0 @@ ---TEST-- -Test count_chars() function : usage variations - test values for $string argument ---FILE-- -<?php - -/* Prototype : mixed count_chars ( string $string [, int $mode ] ) - * Description: Return information about characters used in a string - * Source code: ext/standard/string.c -*/ - -echo "*** Testing count_chars() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/* 1 */ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/* 7 */ 10.5, - -20.5, - 10.1234567e10, - - // array values -/* 10 */ array(), - array(0), - array(1, 2), - - // boolean values -/* 13 */ true, - false, - TRUE, - FALSE, - - // null values -/* 17 */ NULL, - null, - - // objects -/* 19 */ new sample(), - - // resource -/* 20 */ $file_handle, - - // undefined variable -/* 21 */ @$undefined_var, - - // unset variable -/* 22 */ @$unset_var -); - -// loop through with each element of the $inputs array to test count_chars() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // only list characters with a frequency > 0 - var_dump(count_chars($input, 1)); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing count_chars() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -array(1) { - [48]=> - int(1) -} --- Iteration 2 -- -array(1) { - [49]=> - int(1) -} --- Iteration 3 -- -array(2) { - [50]=> - int(1) - [53]=> - int(2) -} --- Iteration 4 -- -array(3) { - [50]=> - int(1) - [53]=> - int(1) - [54]=> - int(1) -} --- Iteration 5 -- -array(7) { - [49]=> - int(1) - [50]=> - int(1) - [51]=> - int(1) - [52]=> - int(3) - [54]=> - int(1) - [55]=> - int(2) - [56]=> - int(1) -} --- Iteration 6 -- -array(8) { - [45]=> - int(1) - [49]=> - int(1) - [50]=> - int(1) - [51]=> - int(1) - [52]=> - int(3) - [54]=> - int(1) - [55]=> - int(1) - [56]=> - int(2) -} --- Iteration 7 -- -array(4) { - [46]=> - int(1) - [48]=> - int(1) - [49]=> - int(1) - [53]=> - int(1) -} --- Iteration 8 -- -array(5) { - [45]=> - int(1) - [46]=> - int(1) - [48]=> - int(1) - [50]=> - int(1) - [53]=> - int(1) -} --- Iteration 9 -- -array(8) { - [48]=> - int(4) - [49]=> - int(2) - [50]=> - int(1) - [51]=> - int(1) - [52]=> - int(1) - [53]=> - int(1) - [54]=> - int(1) - [55]=> - int(1) -} --- Iteration 10 -- - -Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: count_chars() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(1) { - [49]=> - int(1) -} --- Iteration 14 -- -array(0) { -} --- Iteration 15 -- -array(1) { - [49]=> - int(1) -} --- Iteration 16 -- -array(0) { -} --- Iteration 17 -- -array(0) { -} --- Iteration 18 -- -array(0) { -} --- Iteration 19 -- -array(12) { - [32]=> - int(1) - [97]=> - int(1) - [98]=> - int(1) - [99]=> - int(1) - [101]=> - int(2) - [106]=> - int(1) - [108]=> - int(1) - [109]=> - int(1) - [111]=> - int(1) - [112]=> - int(1) - [115]=> - int(1) - [116]=> - int(1) -} --- Iteration 20 -- - -Warning: count_chars() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -array(0) { -} --- Iteration 22 -- -array(0) { -} -===DONE=== diff --git a/ext/standard/tests/strings/count_chars_variation2.phpt b/ext/standard/tests/strings/count_chars_variation2.phpt deleted file mode 100644 index 986312a930..0000000000 --- a/ext/standard/tests/strings/count_chars_variation2.phpt +++ /dev/null @@ -1,164 +0,0 @@ ---TEST-- -Test count_chars() function : usage variations - test values for $mode argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php - -/* Prototype : mixed count_chars ( string $string [, int $mode ] ) - * Description: Return information about characters used in a string - * Source code: ext/standard/string.c -*/ - -echo "*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { -} - -// array with different values for $input -$inputs = array ( - - // integer values -/* 1 */ 0, - 1, - 255, - 2147483647, - -2147483648, - - // float values -/* 6 */ 0.0, - 1.3, - 10.5, - -20.5, - 10.1234567e10, - - // array values -/* 11 */ array(), - array(1, 2, 3, 4, 5, 6, 7, 8, 9), - - // boolean values -/* 14 */ true, - false, - TRUE, - FALSE, - - // null values -/* 18 */ NULL, - null, - - // string values -/* 20 */ "ABCD", - 'abcd', - "1ABC", - "5ABC", - - // objects -/* 24 */ new sample(), - - // undefined variable -/* 25 */ @$undefined_var, - - // unset variable -/* 26 */ @$unset_var -); - -// loop through with each element of the $inputs array to test count_chars() function -// with unexepcted values for the 'mode' argument -$count = 1; -$string = "Return information about characters used in a string"; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // only list characters with a frequency > 0 - var_dump(is_array(count_chars($string, $input))); - $count ++; -} - - -?> -===DONE=== ---EXPECTF-- -*** Testing count_chars() function: with unexpected inputs for 'mode' argument *** --- Iteration 1 -- -bool(true) --- Iteration 2 -- -bool(true) --- Iteration 3 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 6 -- -bool(true) --- Iteration 7 -- -bool(true) --- Iteration 8 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: count_chars() expects parameter 2 to be int, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: count_chars() expects parameter 2 to be int, array given in %s on line %d -bool(false) --- Iteration 13 -- -bool(true) --- Iteration 14 -- -bool(true) --- Iteration 15 -- -bool(true) --- Iteration 16 -- -bool(true) --- Iteration 17 -- -bool(true) --- Iteration 18 -- -bool(true) --- Iteration 19 -- - -Warning: count_chars() expects parameter 2 to be int, string given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: count_chars() expects parameter 2 to be int, string given in %s on line %d -bool(false) --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -bool(true) --- Iteration 22 -- - -Notice: A non well formed numeric value encountered in %s on line %d - -Warning: count_chars(): Unknown mode in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: count_chars() expects parameter 2 to be int, object given in %s on line %d -bool(false) --- Iteration 24 -- -bool(true) --- Iteration 25 -- -bool(true) -===DONE=== diff --git a/ext/standard/tests/strings/crc32_variation1.phpt b/ext/standard/tests/strings/crc32_variation1.phpt deleted file mode 100644 index 21d3fbe0dc..0000000000 --- a/ext/standard/tests/strings/crc32_variation1.phpt +++ /dev/null @@ -1,196 +0,0 @@ ---TEST-- -Test crc32() function : usage variations - unexpected values ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) - die("skip this test is for 32bit platform only"); -?> ---FILE-- -<?php -/* Prototype : string crc32(string $str) - * Description: Calculate the crc32 polynomial of a string - * Source code: ext/standard/crc32.c - * Alias to functions: none -*/ - -/* - * Testing crc32() : with unexpected values for str argument -*/ - -echo "*** Testing crc32() : with unexpected values for str argument ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for str - -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump( crc32($value) ); - $count++; -}; - -// closing the resource -fclose($file_handle); - -echo "Done"; -?> ---EXPECTF-- -*** Testing crc32() : with unexpected values for str argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - --- Iteration 1 -- -int(-186917087) - --- Iteration 2 -- -int(-2082672713) - --- Iteration 3 -- -int(-873121252) - --- Iteration 4 -- -int(1860518047) - --- Iteration 5 -- -int(269248583) - --- Iteration 6 -- -int(-834950157) - --- Iteration 7 -- -int(-965354630) - --- Iteration 8 -- -int(1376932222) - --- Iteration 9 -- -int(-2036403827) - --- Iteration 10 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: crc32() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 15 -- -int(0) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(-2082672713) - --- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(-2082672713) - --- Iteration 20 -- -int(0) - --- Iteration 21 -- -int(0) - --- Iteration 22 -- -int(0) - --- Iteration 23 -- -int(-1465013268) - --- Iteration 24 -- -int(0) - --- Iteration 25 -- -int(0) - --- Iteration 26 -- - -Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt deleted file mode 100644 index 7ced1dc822..0000000000 --- a/ext/standard/tests/strings/explode_variation1.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $delimiter argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'delimiter' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $delimiter -$delimiters = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $delimiters array to test explode() function -$count = 1; -$string = "piece1 piece2 piece3 piece4 piece5 piece6"; -$limit = 5; -foreach($delimiters as $delimiter) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'delimiter' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 2 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 3 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 4 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 5 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 6 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 7 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 8 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 9 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 10 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 14 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 15 -- -array(2) { - [0]=> - string(5) "piece" - [1]=> - string(35) " piece2 piece3 piece4 piece5 piece6" -} --- Iteration 16 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 19 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 20 -- - -Warning: explode() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt deleted file mode 100644 index 9377f30842..0000000000 --- a/ext/standard/tests/strings/explode_variation2.phpt +++ /dev/null @@ -1,195 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $string argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $string -$strings = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $strings array to test explode() function -$count = 1; -$delimiter = " "; -$limit = 5; -foreach($strings as $string) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(1) "0" -} --- Iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 3 -- -array(1) { - [0]=> - string(3) "255" -} --- Iteration 4 -- -array(1) { - [0]=> - string(3) "256" -} --- Iteration 5 -- -array(1) { - [0]=> - string(10) "2147483647" -} --- Iteration 6 -- -array(1) { - [0]=> - string(11) "-2147483648" -} --- Iteration 7 -- -array(1) { - [0]=> - string(4) "10.5" -} --- Iteration 8 -- -array(1) { - [0]=> - string(5) "-20.5" -} --- Iteration 9 -- -array(1) { - [0]=> - string(12) "101234567000" -} --- Iteration 10 -- - -Warning: explode() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 14 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 15 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 16 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 17 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 18 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 19 -- -array(2) { - [0]=> - string(6) "sample" - [1]=> - string(6) "object" -} --- Iteration 20 -- - -Warning: explode() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 22 -- -array(1) { - [0]=> - string(0) "" -} -===DONE=== diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt deleted file mode 100644 index 34c1cdffc3..0000000000 --- a/ext/standard/tests/strings/explode_variation3.phpt +++ /dev/null @@ -1,238 +0,0 @@ ---TEST-- -Test explode() function : usage variations - test values for $limit argument ---FILE-- -<?php - -/* Prototype : array explode ( string $delimiter , string $string [, int $limit ] ) - * Description: Split a string by string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing explode() function: with unexpected inputs for 'limit' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $delimiter -$limits = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $limits array to test explode() function -$count = 1; -$delimiter = " "; -$string = "piece1 piece2 piece3 piece4 piece5 piece6"; -foreach($limits as $limit) { - echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===Done=== ---EXPECTF-- -*** Testing explode() function: with unexpected inputs for 'limit' argument *** --- Iteration 1 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 2 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 3 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 4 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 5 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 6 -- -array(0) { -} --- Iteration 7 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 8 -- -array(0) { -} --- Iteration 9 -- -array(6) { - [0]=> - string(6) "piece1" - [1]=> - string(6) "piece2" - [2]=> - string(6) "piece3" - [3]=> - string(6) "piece4" - [4]=> - string(6) "piece5" - [5]=> - string(6) "piece6" -} --- Iteration 10 -- - -Warning: explode() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: explode() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: explode() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 14 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 15 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 16 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 17 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 18 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 19 -- - -Warning: explode() expects parameter 3 to be int, object given in %s on line %d -NULL --- Iteration 20 -- - -Warning: explode() expects parameter 3 to be int, resource given in %s on line %d -NULL --- Iteration 21 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} --- Iteration 22 -- -array(1) { - [0]=> - string(41) "piece1 piece2 piece3 piece4 piece5 piece6" -} -===Done=== diff --git a/ext/standard/tests/strings/fprintf_variation_001.phpt b/ext/standard/tests/strings/fprintf_variation_001.phpt index 3a935107a7..df81c249b6 100644 --- a/ext/standard/tests/strings/fprintf_variation_001.phpt +++ b/ext/standard/tests/strings/fprintf_variation_001.phpt @@ -1,12 +1,5 @@ --TEST-- Test fprintf() function (variation - 1) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php @@ -14,7 +7,7 @@ $float_variation = array( "%f","%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07. $float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54 ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_001.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_002.phpt b/ext/standard/tests/strings/fprintf_variation_002.phpt index 49e62e2b74..1cc1a4ddd7 100644 --- a/ext/standard/tests/strings/fprintf_variation_002.phpt +++ b/ext/standard/tests/strings/fprintf_variation_002.phpt @@ -1,12 +1,5 @@ --TEST-- Test fprintf() function (variation - 2) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php @@ -14,7 +7,7 @@ $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2 $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_002.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_003.phpt b/ext/standard/tests/strings/fprintf_variation_003.phpt index b4860879b0..1e8eb4706f 100644 --- a/ext/standard/tests/strings/fprintf_variation_003.phpt +++ b/ext/standard/tests/strings/fprintf_variation_003.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 3) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_003.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt index ba8e525c3f..26db7ab18b 100644 --- a/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 3) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_003_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_004.phpt b/ext/standard/tests/strings/fprintf_variation_004.phpt Binary files differindex 5502b6d7c0..aa47a298d8 100644 --- a/ext/standard/tests/strings/fprintf_variation_004.phpt +++ b/ext/standard/tests/strings/fprintf_variation_004.phpt diff --git a/ext/standard/tests/strings/fprintf_variation_005.phpt b/ext/standard/tests/strings/fprintf_variation_005.phpt index 0967b77cd8..0be2cb6847 100644 --- a/ext/standard/tests/strings/fprintf_variation_005.phpt +++ b/ext/standard/tests/strings/fprintf_variation_005.phpt @@ -1,19 +1,12 @@ --TEST-- Test fprintf() function (variation - 5) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_005.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_006.phpt b/ext/standard/tests/strings/fprintf_variation_006.phpt index 8a66fb9fb4..b48720c2d5 100644 --- a/ext/standard/tests/strings/fprintf_variation_006.phpt +++ b/ext/standard/tests/strings/fprintf_variation_006.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 6) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_006.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt index fe4cc91dd7..92ab010d03 100644 --- a/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 6) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_006_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_007.phpt b/ext/standard/tests/strings/fprintf_variation_007.phpt index 16d39bbde3..f2653a1ee1 100644 --- a/ext/standard/tests/strings/fprintf_variation_007.phpt +++ b/ext/standard/tests/strings/fprintf_variation_007.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 7) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_007.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt index 55cd946a3b..9e30f91639 100644 --- a/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 7) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_007_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_008.phpt b/ext/standard/tests/strings/fprintf_variation_008.phpt index d2187c7ccd..e8c0a9e412 100644 --- a/ext/standard/tests/strings/fprintf_variation_008.phpt +++ b/ext/standard/tests/strings/fprintf_variation_008.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 8) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> --FILE-- @@ -15,7 +11,7 @@ $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2 $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_008.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt index 9d326a91c1..661f2711f3 100644 --- a/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt +++ b/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt @@ -2,10 +2,6 @@ Test fprintf() function (variation - 8) --SKIPIF-- <?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- @@ -15,7 +11,7 @@ $int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2 $int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_008_64bit.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/fprintf_variation_009.phpt b/ext/standard/tests/strings/fprintf_variation_009.phpt index e36c0e8c0f..c16623ba8f 100644 --- a/ext/standard/tests/strings/fprintf_variation_009.phpt +++ b/ext/standard/tests/strings/fprintf_variation_009.phpt @@ -1,12 +1,5 @@ --TEST-- Test fprintf() function (variation - 9) ---SKIPIF-- -<?php -$data_file = dirname(__FILE__) . '/dump.txt'; -if (!($fp = fopen($data_file, 'w'))) { - die('skip File dump.txt could not be created'); -} -?> --FILE-- <?php @@ -14,7 +7,7 @@ $string_variation = array( "%5s", "%-5s", "%05s", "%'#5s" ); $strings = array( NULL, "abc", 'aaa' ); /* creating dumping file */ -$data_file = dirname(__FILE__) . '/dump.txt'; +$data_file = dirname(__FILE__) . '/fprintf_variation_009.txt'; if (!($fp = fopen($data_file, 'wt'))) return; diff --git a/ext/standard/tests/strings/get_html_translation_table_variation1.phpt b/ext/standard/tests/strings/get_html_translation_table_variation1.phpt deleted file mode 100644 index 0794853e8e..0000000000 --- a/ext/standard/tests/strings/get_html_translation_table_variation1.phpt +++ /dev/null @@ -1,316 +0,0 @@ ---TEST-- -Test get_html_translation_table() function : usage variations - unexpected table values ---FILE-- -<?php -/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] ) - * Description: Returns the internal translation table used by htmlspecialchars and htmlentities - * Source code: ext/standard/html.c -*/ - -/* - * test get_html_translation_table() with unexpected value for argument $table -*/ - -echo "*** Testing get_html_translation_table() : usage variations ***\n"; -// initialize all required variables -$quote_style = ENT_COMPAT; - -// get an unset variable -$unset_var = 10; -unset($unset_var); - -// a resource variable -$fp = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource var - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of get_html_translation_table() -// when $table argument is supplied with different values -echo "\n--- Testing get_html_translation_table() by supplying different values for 'table' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $table = $values [$index]; - - $v = get_html_translation_table($table, ENT_COMPAT, "UTF-8"); - if (is_array($v) && count($v) > 100) - var_dump(count($v)); - elseif (is_array($v)) { - asort($v); - var_dump($v); - } else { - var_dump($v); - } - - $v = get_html_translation_table($table, $quote_style, "UTF-8"); - if (is_array($v) && count($v) > 100) - var_dump(count($v)); - elseif (is_array($v)) { - asort($v); - var_dump($v); - } else { - var_dump($v); - } - - $counter ++; -} - -// close resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing get_html_translation_table() : usage variations *** - ---- Testing get_html_translation_table() by supplying different values for 'table' argument --- --- Iteration 1 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 2 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 3 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 4 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 5 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, array given in %s on line %d -NULL --- Iteration 6 -- -int(252) -int(252) --- Iteration 7 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 8 -- -int(252) -int(252) --- Iteration 9 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 10 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 11 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 12 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, object given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, object given in %s on line %d -NULL --- Iteration 13 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 14 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, string given in %s on line %d -NULL --- Iteration 15 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 16 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 17 -- - -Warning: get_html_translation_table() expects parameter 1 to be int, resource given in %s on line %d -NULL - -Warning: get_html_translation_table() expects parameter 1 to be int, resource given in %s on line %d -NULL --- Iteration 18 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} --- Iteration 19 -- -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -array(4) { - ["&"]=> - string(5) "&" - [">"]=> - string(4) ">" - ["<"]=> - string(4) "<" - ["""]=> - string(6) """ -} -Done diff --git a/ext/standard/tests/strings/get_html_translation_table_variation2.phpt b/ext/standard/tests/strings/get_html_translation_table_variation2.phpt deleted file mode 100644 index 8d9fe0af56..0000000000 --- a/ext/standard/tests/strings/get_html_translation_table_variation2.phpt +++ /dev/null @@ -1,209 +0,0 @@ ---TEST-- -Test get_html_translation_table() function : usage variations - unexpected quote_style values ---FILE-- -<?php -/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] ) - * Description: Returns the internal translation table used by htmlspecialchars and htmlentities - * Source code: ext/standard/html.c -*/ - -/* - * test get_html_translation_table() with unexpteced value for argument $quote_style -*/ - -//set locale to en_US.UTF-8 -setlocale(LC_ALL, "en_US.UTF-8"); - -echo "*** Testing get_html_translation_table() : usage variations ***\n"; -// initialize all required variables -$table = HTML_SPECIALCHARS; - -// get an unset variable -$unset_var = 10; -unset($unset_var); - -// a resource var -$fp = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource var - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of get_html_translation_table() -// when $quote_style argument is supplied with different values -echo "\n--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $quote_style = $values [$index]; - - var_dump( get_html_translation_table($table, $quote_style) ); - - $counter ++; -} - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing get_html_translation_table() : usage variations *** - ---- Testing get_html_translation_table() by supplying different values for 'quote_style' argument --- --- Iteration 1 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 2 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 3 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 4 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 5 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 6 -- -array(4) { - ["&"]=> - string(5) "&" - ["'"]=> - string(6) "'" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 7 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 8 -- -array(4) { - ["&"]=> - string(5) "&" - ["'"]=> - string(6) "'" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 9 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 10 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 11 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 12 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 13 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 14 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 15 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 16 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 17 -- - -Warning: get_html_translation_table() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 18 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} --- Iteration 19 -- -array(3) { - ["&"]=> - string(5) "&" - ["<"]=> - string(4) "<" - [">"]=> - string(4) ">" -} -Done diff --git a/ext/standard/tests/strings/hebrev_variation1.phpt b/ext/standard/tests/strings/hebrev_variation1.phpt deleted file mode 100644 index 33fd974eb7..0000000000 --- a/ext/standard/tests/strings/hebrev_variation1.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test hebrev() function : usage variations - test values for $hebrew_text argument ---FILE-- -<?php - -/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $hebrew_text -$texts = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var, - - // text with parentheses - 'text with parentheses (', - 'text with parentheses )', - - // text with brackets - 'text with bracket [', - 'text with bracket ]', - - // text with curly brackets - 'text with curly bracket {', - 'text with curly bracket }', - - // text with backslash escape - 'text with backslash escape \\', - - // text with a slash char - 'text with a slash char /', - - // text with a greater than char - 'text with a greater than char >', - - // text with a less than char - 'text with a less than char <' -); - -// loop through with each element of the $texts array to test hebrev() function -$count = 1; - -foreach($texts as $hebrew_text) { - echo "-- Iteration $count --\n"; - var_dump( hebrev($hebrew_text) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(10) "1012345.67" --- Iteration 10 -- - -Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrev() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -bool(false) --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: hebrev() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) --- Iteration 23 -- -string(23) ") text with parentheses" --- Iteration 24 -- -string(23) "( text with parentheses" --- Iteration 25 -- -string(19) "] text with bracket" --- Iteration 26 -- -string(19) "[ text with bracket" --- Iteration 27 -- -string(25) "} text with curly bracket" --- Iteration 28 -- -string(25) "{ text with curly bracket" --- Iteration 29 -- -string(28) "/ text with backslash escape" --- Iteration 30 -- -string(24) "text with a slash char /" --- Iteration 31 -- -string(31) "< text with a greater than char" --- Iteration 32 -- -string(28) "> text with a less than char" -===DONE=== diff --git a/ext/standard/tests/strings/hebrev_variation2.phpt b/ext/standard/tests/strings/hebrev_variation2.phpt deleted file mode 100644 index f312472c82..0000000000 --- a/ext/standard/tests/strings/hebrev_variation2.phpt +++ /dev/null @@ -1,283 +0,0 @@ ---TEST-- -Test hebrev() function : usage variations - test values for $max_chars_per_line argument ---FILE-- -<?php - -/* Prototype : string hebrev ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $max_chars_per_line -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abc", - 'abc', - "3abc", - "0abc", - "0x3", - - // objects -/*24*/ new sample(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $texts array to test hebrev() function -$count = 1; - -$hebrew_text = "The hebrev function converts logical Hebrew text to visual text.\nThe function tries to avoid breaking words.\n"; - -foreach($inputs as $max_chars_per_line) { - echo "-- Iteration $count --\n"; - var_dump( hebrev($hebrew_text, $max_chars_per_line) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' argument *** --- Iteration 1 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 2 -- -string(109) "xttel uaisv -tot ext -ewbrHel cagilos rtveonc -ontincfuv reebh -he.Ts -rdwog inakreb -idvoa -tos ietrn ioctunf -he.T -" --- Iteration 3 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 4 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 5 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 6 -- -string(109) "txet -lausiv -ot -txet -werbeH -lacigol -strevnoc -noitcnuf -verbeh -ehT. -sdrow -gnikaerb -diova -ot -seirt -noitcnuf -ehT. -" --- Iteration 7 -- -string(109) "text -to visual -text -Hebrew -logical -converts -function -hebrev -.The -words -breaking -to avoid -tries -function -.The -" --- Iteration 8 -- -string(109) "txet -lausiv -ot -txet -werbeH -lacigol -strevnoc -noitcnuf -verbeh -ehT. -sdrow -gnikaerb -diova -ot -seirt -noitcnuf -ehT. -" --- Iteration 9 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 10 -- - -Warning: hebrev() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrev() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrev() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -string(109) "xttel uaisv -tot ext -ewbrHel cagilos rtveonc -ontincfuv reebh -he.Ts -rdwog inakreb -idvoa -tos ietrn ioctunf -he.T -" --- Iteration 14 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 15 -- -string(109) "xttel uaisv -tot ext -ewbrHel cagilos rtveonc -ontincfuv reebh -he.Ts -rdwog inakreb -idvoa -tos ietrn ioctunf -he.T -" --- Iteration 16 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 17 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 18 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 19 -- - -Warning: hebrev() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: hebrev() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(109) "textual vis -to -textrew Heb -icallog -ertsconvion unctf -brevhe -.Therds -wo -kingbreaoid av -to -riest -tionfuncThe . -" --- Iteration 22 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 23 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 24 -- - -Warning: hebrev() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 25 -- - -Warning: hebrev() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 26 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" --- Iteration 27 -- -string(109) ".The hebrev function converts logical Hebrew text to visual text -.The function tries to avoid breaking words -" -===DONE=== diff --git a/ext/standard/tests/strings/hebrevc_variation1.phpt b/ext/standard/tests/strings/hebrevc_variation1.phpt deleted file mode 100644 index c16780e769..0000000000 --- a/ext/standard/tests/strings/hebrevc_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test hebrevc() function : usage variations - test values for $hebrew_text argument ---FILE-- -<?php - -/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $hebrew_text -$texts = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $texts array to test hebrevc() function -$count = 1; - -foreach($texts as $hebrew_text) { - echo "-- Iteration $count --\n"; - var_dump( hebrevc($hebrew_text) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(10) "1012345.67" --- Iteration 10 -- - -Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrevc() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -bool(false) --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: hebrevc() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/hebrevc_variation2.phpt b/ext/standard/tests/strings/hebrevc_variation2.phpt deleted file mode 100644 index 334d128989..0000000000 --- a/ext/standard/tests/strings/hebrevc_variation2.phpt +++ /dev/null @@ -1,414 +0,0 @@ ---TEST-- -Test hebrevc() function : usage variations - test values for $max_chars_per_line argument ---FILE-- -<?php - -/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] ) - * Description: Convert logical Hebrew text to visual text - * Source code: ext/standard/string.c -*/ - -echo "*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $max_chars_per_line -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e5, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abc", - 'abc', - "3abc", - "0abc", - "0x3", - - // objects -/*24*/ new sample(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $texts array to test hebrevc() function -$count = 1; - -$hebrew_text = "The hebrevcc function converts logical Hebrew text to visual text.\nThis function is similar to hebrevc() with the difference that it converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking words.\n"; - -foreach($inputs as $max_chars_per_line) { - echo "-- Iteration $count --\n"; - var_dump( hebrevc($hebrew_text, $max_chars_per_line) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument *** --- Iteration 1 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 2 -- -string(331) "xttel uaisv<br /> -tot ext<br /> -ewbrHel cagilos rtveonc<br /> -ontincfuc vcreebh<br /> -he.Ts<br /> -neliewn<br /> -tsernvcot i<br /> -atthe ncrefeifd<br /> -het<br /> -thwi) c(evbrheo t<br /> -arilims<br /> -isn ioctunf<br /> -isTh) (<br /> -r <b'<br /> -to<<br /> -.'s<br /> -rdwog inakreb<br /> -idvoa<br /> -tos ietrn ioctunf<br /> -he.T<br /> -" --- Iteration 3 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 4 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 5 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 6 -- -string(421) "txet<br /> -lausiv<br /> -ot<br /> -txet<br /> -werbeH<br /> -lacigol<br /> -strevnoc<br /> -noitcnuf<br /> -ccverbeh<br /> -ehT.<br /> -senilwen<br /> -strevnoc<br /> -ti<br /> -taht<br /> -ecnereffid<br /> -eht<br /> -htiw<br /> -)(cverbeh<br /> -ot<br /> -ralimis<br /> -si<br /> -noitcnuf<br /> -sihT<br /> -)<br /> -(<br /> -rb<'<br /> -ot<<br /> -'.<br /> -sdrow<br /> -gnikaerb<br /> -diova<br /> -ot<br /> -seirt<br /> -noitcnuf<br /> -ehT.<br /> -" --- Iteration 7 -- -string(373) "text<br /> -to visual<br /> -text<br /> -Hebrew<br /> -logical<br /> -converts<br /> -function<br /> -hebrevcc<br /> -.The<br /> -newlines<br /> -converts<br /> -that it<br /> -difference<br /> -with the<br /> -hebrevc()<br /> -similar to<br /> -is<br /> -function<br /> -) This<br /> -<to '<br (<br /> -.'<br /> -words<br /> -breaking<br /> -to avoid<br /> -tries<br /> -function<br /> -.The<br /> -" --- Iteration 8 -- -string(421) "txet<br /> -lausiv<br /> -ot<br /> -txet<br /> -werbeH<br /> -lacigol<br /> -strevnoc<br /> -noitcnuf<br /> -ccverbeh<br /> -ehT.<br /> -senilwen<br /> -strevnoc<br /> -ti<br /> -taht<br /> -ecnereffid<br /> -eht<br /> -htiw<br /> -)(cverbeh<br /> -ot<br /> -ralimis<br /> -si<br /> -noitcnuf<br /> -sihT<br /> -)<br /> -(<br /> -rb<'<br /> -ot<<br /> -'.<br /> -sdrow<br /> -gnikaerb<br /> -diova<br /> -ot<br /> -seirt<br /> -noitcnuf<br /> -ehT.<br /> -" --- Iteration 9 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 10 -- - -Warning: hebrevc() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: hebrevc() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: hebrevc() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -string(331) "xttel uaisv<br /> -tot ext<br /> -ewbrHel cagilos rtveonc<br /> -ontincfuc vcreebh<br /> -he.Ts<br /> -neliewn<br /> -tsernvcot i<br /> -atthe ncrefeifd<br /> -het<br /> -thwi) c(evbrheo t<br /> -arilims<br /> -isn ioctunf<br /> -isTh) (<br /> -r <b'<br /> -to<<br /> -.'s<br /> -rdwog inakreb<br /> -idvoa<br /> -tos ietrn ioctunf<br /> -he.T<br /> -" --- Iteration 14 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 15 -- -string(331) "xttel uaisv<br /> -tot ext<br /> -ewbrHel cagilos rtveonc<br /> -ontincfuc vcreebh<br /> -he.Ts<br /> -neliewn<br /> -tsernvcot i<br /> -atthe ncrefeifd<br /> -het<br /> -thwi) c(evbrheo t<br /> -arilims<br /> -isn ioctunf<br /> -isTh) (<br /> -r <b'<br /> -to<<br /> -.'s<br /> -rdwog inakreb<br /> -idvoa<br /> -tos ietrn ioctunf<br /> -he.T<br /> -" --- Iteration 16 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 17 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 18 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 19 -- - -Warning: hebrevc() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: hebrevc() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(349) "textual vis<br /> -to<br /> -textrew Heb<br /> -icallog<br /> -ertsconvion unctf<br /> -evcchebrThe .<br /> -inesnewlrts onvec<br /> -it<br /> -thatnce feredif<br /> -the<br /> -withc() brevhe<br /> -to<br /> -ilarsim<br /> -is<br /> -tionfunchis ) T<br /> -(<br /> -'<br<to .'<br /> -<br /> -ordsw<br /> -kingbreaoid av<br /> -to<br /> -riest<br /> -tionfuncThe .<br /> -" --- Iteration 22 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 23 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 24 -- - -Warning: hebrevc() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 25 -- - -Warning: hebrevc() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 26 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" --- Iteration 27 -- -string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br /> -) This function is similar to hebrevc() with the difference that it converts newlines<br /> -<to '<br (<br /> -.'<br /> -.The function tries to avoid breaking words<br /> -" -===DONE=== diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt deleted file mode 100644 index 35719186e4..0000000000 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt +++ /dev/null @@ -1,161 +0,0 @@ ---TEST-- -Test htmlspecialchars_decode() function : usage variations - unexpected values for 'string' argument ---FILE-- -<?php -/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style]) - * Description: Convert special HTML entities back to characters - * Source code: ext/standard/html.c -*/ - -/* - * testing htmlspecialchars_decode() with unexpected input values for $string argument -*/ - -echo "*** Testing htmlspecialchars_decode() : usage variations ***\n"; - -//get a class -class classA -{ - function __toString() { - return "ClassAObject"; - } -} - -//get a resource variable -$file_handle=fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource - $file_handle -); - -// loop through each element of the array for string -$iterator = 1; -foreach($values as $value) { - echo "-- Iterator $iterator --\n"; - var_dump( htmlspecialchars_decode($value) ); - $iterator++; -}; - -// close the file resource used -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing htmlspecialchars_decode() : usage variations *** --- Iterator 1 -- -string(1) "0" --- Iterator 2 -- -string(1) "1" --- Iterator 3 -- -string(5) "12345" --- Iterator 4 -- -string(5) "-2345" --- Iterator 5 -- -string(4) "10.5" --- Iterator 6 -- -string(5) "-10.5" --- Iterator 7 -- -string(12) "101234567000" --- Iterator 8 -- -string(13) "1.07654321E-9" --- Iterator 9 -- -string(3) "0.5" --- Iterator 10 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 11 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 12 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 13 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 14 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iterator 15 -- -string(0) "" --- Iterator 16 -- -string(0) "" --- Iterator 17 -- -string(1) "1" --- Iterator 18 -- -string(0) "" --- Iterator 19 -- -string(1) "1" --- Iterator 20 -- -string(0) "" --- Iterator 21 -- -string(0) "" --- Iterator 22 -- -string(0) "" --- Iterator 23 -- -string(12) "ClassAObject" --- Iterator 24 -- -string(0) "" --- Iterator 25 -- -string(0) "" --- Iterator 26 -- - -Warning: htmlspecialchars_decode() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== - diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt deleted file mode 100644 index 4a8f165e9c..0000000000 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt +++ /dev/null @@ -1,193 +0,0 @@ ---TEST-- -Test htmlspecialchars_decode() function : usage variations - unexpected values for 'quote_style' argument ---FILE-- -<?php -/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style]) - * Description: Convert special HTML entities back to characters - * Source code: ext/standard/html.c -*/ - -/* - * testing htmlspecialchars_decode() by giving unexpected input values for $quote_style argument -*/ - -echo "*** Testing htmlspecialchars_decode() : usage variations ***\n"; - -// Initialise function arguments -// value initialized = Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string " -$string = "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>"; - -//get a class -class classA { - function __toString() { - return "Class A Object"; - } -} - -//get a resource variable -$file_handle = fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset($unset_var); - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.5e20, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource - $file_handle -); - -// loop through each element of the array for quote_style -$iterator = 1; -foreach($values as $value) { - echo "\n-- Iteration $iterator --\n"; - var_dump( htmlspecialchars_decode($string, $value) ); - $iterator++; -} - -// close the file resource used -fclose($file_handle); - -echo "Done"; -?> ---EXPECTF-- -*** Testing htmlspecialchars_decode() : usage variations *** - --- Iteration 1 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 2 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 3 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 4 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 5 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 6 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 7 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 8 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 9 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 10 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, array given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 11 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 12 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 13 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 14 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 15 -- -string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 16 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 17 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 18 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 19 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 20 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, string given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 21 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, object given in %shtmlspecialchars_decode_variation2.php on line %d -NULL - --- Iteration 22 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 23 -- -string(114) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>" - --- Iteration 24 -- - -Warning: htmlspecialchars_decode() expects parameter 2 to be int, resource given in %shtmlspecialchars_decode_variation2.php on line %d -NULL -Done diff --git a/ext/standard/tests/strings/http_build_query.phpt b/ext/standard/tests/strings/http_build_query.phpt index 4ed7fda43d..57fc2f2811 100644 --- a/ext/standard/tests/strings/http_build_query.phpt +++ b/ext/standard/tests/strings/http_build_query.phpt @@ -3,13 +3,13 @@ http_build_query() function --FILE-- <?php -$array = array("foo"=>"bar","baz"=>1,"test"=>"a ' \" ", "abc"); +$array = array("foo"=>"bar","baz"=>1,"test"=>"a ' \" ", "abc", 'float' => 10.42, 'true' => true, 'false' => false); var_dump(http_build_query($array)); var_dump(http_build_query($array, 'foo')); var_dump(http_build_query($array, 'foo', ';')); ?> --EXPECT-- -string(35) "foo=bar&baz=1&test=a+%27+%22+&0=abc" -string(38) "foo=bar&baz=1&test=a+%27+%22+&foo0=abc" -string(38) "foo=bar;baz=1;test=a+%27+%22+;foo0=abc" +string(62) "foo=bar&baz=1&test=a+%27+%22+&0=abc&float=10.42&true=1&false=0" +string(65) "foo=bar&baz=1&test=a+%27+%22+&foo0=abc&float=10.42&true=1&false=0" +string(65) "foo=bar;baz=1;test=a+%27+%22+;foo0=abc;float=10.42;true=1;false=0" diff --git a/ext/standard/tests/strings/http_build_query_error.phpt b/ext/standard/tests/strings/http_build_query_error.phpt index f451310642..2975d2d723 100644 --- a/ext/standard/tests/strings/http_build_query_error.phpt +++ b/ext/standard/tests/strings/http_build_query_error.phpt @@ -10,4 +10,4 @@ $result = http_build_query(null); ?> --EXPECTF-- -Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d +Warning: http_build_query() expects parameter 1 to be array, null given in %s on line %d diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex d09e51eef5..8178fa2eb5 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/ltrim_variation1.phpt b/ext/standard/tests/strings/ltrim_variation1.phpt deleted file mode 100644 index f476b9b793..0000000000 --- a/ext/standard/tests/strings/ltrim_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test ltrim() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string ltrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing ltrim() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test ltrim() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( ltrim($input, " \t-") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing ltrim() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(10) "2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(4) "20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(15) "sample object " --- Iteration 20 -- - -Warning: ltrim() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/ltrim_variation2.phpt b/ext/standard/tests/strings/ltrim_variation2.phpt deleted file mode 100644 index 5dc260e8a1..0000000000 --- a/ext/standard/tests/strings/ltrim_variation2.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test ltrim() function : usage variations - test values for $charlist argument ---FILE-- -<?php - -/* Prototype : string ltrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing ltrim() function: with unexpected inputs for 'charlist' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test ltrim() function -$count = 1; -foreach($inputs as $charlist) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( ltrim("!---Hello World---!", $charlist) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing ltrim() function: with unexpected inputs for 'charlist' argument *** --- Iteration 1 -- -string(19) "!---Hello World---!" --- Iteration 2 -- -string(19) "!---Hello World---!" --- Iteration 3 -- -string(19) "!---Hello World---!" --- Iteration 4 -- -string(19) "!---Hello World---!" --- Iteration 5 -- -string(19) "!---Hello World---!" --- Iteration 6 -- -string(19) "!---Hello World---!" --- Iteration 7 -- -string(19) "!---Hello World---!" --- Iteration 8 -- -string(19) "!---Hello World---!" --- Iteration 9 -- -string(19) "!---Hello World---!" --- Iteration 10 -- - -Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(19) "!---Hello World---!" --- Iteration 14 -- -string(19) "!---Hello World---!" --- Iteration 15 -- -string(19) "!---Hello World---!" --- Iteration 16 -- -string(19) "!---Hello World---!" --- Iteration 17 -- -string(19) "!---Hello World---!" --- Iteration 18 -- -string(19) "!---Hello World---!" --- Iteration 19 -- -string(19) "!---Hello World---!" --- Iteration 20 -- - -Warning: ltrim() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(19) "!---Hello World---!" --- Iteration 22 -- -string(19) "!---Hello World---!" -===DONE=== diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 3e996eccd3..45009669f4 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/money_format_variation1.phpt b/ext/standard/tests/strings/money_format_variation1.phpt deleted file mode 100644 index 4a381c183a..0000000000 --- a/ext/standard/tests/strings/money_format_variation1.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test money_format() function : usage variations - test values for $format argument ---SKIPIF-- -<?php - if (!function_exists('money_format')) { - die("SKIP money_format - not supported\n"); - } -?> ---FILE-- -<?php -/* Prototype : string money_format ( string $format , float $number ) - * Description: Formats a number as a currency string - * Source code: ext/standard/string.c -*/ - -// =========================================================================================== -// = We do not test for exact return-values, as those might be different between OS-versions = -// =========================================================================================== - -echo "*** Testing money_format() function: with unexpected inputs for 'format' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a couple of sample classes -class class_no_tostring { -} - -class class_with_tostring { - public function __toString() { - return " sample object "; - } -} - - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$formats = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abcd", - 'abcd', - "0x12f", - "%=*!14#8.2nabcd", - - // objects -/*23*/ new class_no_tostring(), - new class_with_tostring(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $formats array to test money_format() function -$count = 1; -$value = 1234.56; - -foreach($formats as $format) { - echo "-- Iteration $count --\n"; - echo gettype(money_format($format, $value))."\n"; - $count ++; -} - -// close the file handle -fclose($file_handle); - -?> -===Done=== ---EXPECTF-- -*** Testing money_format() function: with unexpected inputs for 'format' argument *** --- Iteration 1 -- -string --- Iteration 2 -- -string --- Iteration 3 -- -string --- Iteration 4 -- -string --- Iteration 5 -- -string --- Iteration 6 -- -string --- Iteration 7 -- -string --- Iteration 8 -- -string --- Iteration 9 -- -string --- Iteration 10 -- - -Warning: money_format() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: money_format() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: money_format() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string --- Iteration 14 -- -string --- Iteration 15 -- -string --- Iteration 16 -- -string --- Iteration 17 -- -string --- Iteration 18 -- -string --- Iteration 19 -- -string --- Iteration 20 -- -string --- Iteration 21 -- -string --- Iteration 22 -- -string --- Iteration 23 -- - -Warning: money_format() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 24 -- -string --- Iteration 25 -- - -Warning: money_format() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 26 -- -string --- Iteration 27 -- -string -===Done=== diff --git a/ext/standard/tests/strings/money_format_variation2.phpt b/ext/standard/tests/strings/money_format_variation2.phpt deleted file mode 100644 index c8de58bded..0000000000 --- a/ext/standard/tests/strings/money_format_variation2.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test money_format() function : usage variations - test values for $number argument ---SKIPIF-- -<?php - if (!function_exists('money_format')) { - die("SKIP money_format - not supported\n"); - } -?> ---FILE-- -<?php -/* Prototype : string money_format ( string $format , float $number ) - * Description: Formats a number as a currency string - * Source code: ext/standard/string.c -*/ - -// =========================================================================================== -// = We do not test for exact return-values, as those might be different between OS-versions = -// =========================================================================================== - -echo "*** Testing money_format() function: with unexpected inputs for 'number' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a couple of sample classes -class class_no_tostring { -} - -class class_with_tostring { - public function __toString() { - return " sample object "; - } -} - - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $number -$numbers = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // string values -/*19*/ "abcd", - 'abcd', - "0x12f", - "%=*!14#8.2nabcd", - - // objects -/*23*/ new class_no_tostring(), - new class_with_tostring(), - - // resource -/*25*/ $file_handle, - - // undefined variable -/*26*/ @$undefined_var, - - // unset variable -/*27*/ @$unset_var -); - -// loop through with each element of the $numbers array to test money_format() function -$count = 1; -$format = '%14#8.2i'; - -foreach($numbers as $number) { - echo "-- Iteration $count --\n"; - echo gettype(money_format($format, $number))."\n"; - $count ++; -} - -// close the file handle -fclose($file_handle); - -?> -===Done=== ---EXPECTF-- -*** Testing money_format() function: with unexpected inputs for 'number' argument *** --- Iteration 1 -- -string --- Iteration 2 -- -string --- Iteration 3 -- -string --- Iteration 4 -- -string --- Iteration 5 -- -string --- Iteration 6 -- -string --- Iteration 7 -- -string --- Iteration 8 -- -string --- Iteration 9 -- -string --- Iteration 10 -- - -Warning: money_format() expects parameter 2 to be float, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: money_format() expects parameter 2 to be float, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: money_format() expects parameter 2 to be float, array given in %s on line %d -NULL --- Iteration 13 -- -string --- Iteration 14 -- -string --- Iteration 15 -- -string --- Iteration 16 -- -string --- Iteration 17 -- -string --- Iteration 18 -- -string --- Iteration 19 -- - -Warning: money_format() expects parameter 2 to be float, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: money_format() expects parameter 2 to be float, string given in %s on line %d -NULL --- Iteration 21 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string --- Iteration 22 -- - -Warning: money_format() expects parameter 2 to be float, string given in %s on line %d -NULL --- Iteration 23 -- - -Warning: money_format() expects parameter 2 to be float, object given in %s on line %d -NULL --- Iteration 24 -- - -Warning: money_format() expects parameter 2 to be float, object given in %s on line %d -NULL --- Iteration 25 -- - -Warning: money_format() expects parameter 2 to be float, resource given in %s on line %d -NULL --- Iteration 26 -- -string --- Iteration 27 -- -string -===Done=== diff --git a/ext/standard/tests/strings/nl2br_variation5.phpt b/ext/standard/tests/strings/nl2br_variation5.phpt deleted file mode 100644 index 06a70cbc41..0000000000 --- a/ext/standard/tests/strings/nl2br_variation5.phpt +++ /dev/null @@ -1,152 +0,0 @@ ---TEST-- -Test nl2br() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : string nl2br(string $str) - * Description: Inserts HTML line breaks before all newlines in a string. - * Source code: ext/standard/string.c -*/ - -/* -* Test nl2br() function by passing different types of values other than -* expected type for 'str' argument -*/ - -echo "*** Testing nl2br() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//getting resource -$file_handle = fopen(__FILE__, "r"); - -//defining class -class Sample { - public function __toString() { - return "My String"; - } -} - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - //resource - $file_handle, - - // object data - new Sample(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, -); - -// loop through $values array to test nl2br() function with each element -$count = 1; -foreach($values as $value) { - echo "-- Iteration $count --\n"; - var_dump( nl2br($value) ); - $count ++ ; -}; - -//closing the file handle -fclose( $file_handle ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing nl2br() : usage variations *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "105000000000" --- Iteration 8 -- -string(7) "1.06E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: nl2br() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(1) "1" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- - -Warning: nl2br() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 22 -- -string(9) "My String" --- Iteration 23 -- -string(0) "" --- Iteration 24 -- -string(0) "" -Done diff --git a/ext/standard/tests/strings/ord_variation1.phpt b/ext/standard/tests/strings/ord_variation1.phpt deleted file mode 100644 index ffca230dba..0000000000 --- a/ext/standard/tests/strings/ord_variation1.phpt +++ /dev/null @@ -1,136 +0,0 @@ ---TEST-- -Test ord() function : usage variations - test values for $string argument ---FILE-- -<?php - -/* Prototype : int ord ( string $string ) - * Description: Return ASCII value of character - * Source code: ext/standard/string.c -*/ - -echo "*** Testing ord() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $string array to test ord() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( ord($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing ord() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -int(48) --- Iteration 2 -- -int(49) --- Iteration 3 -- -int(50) --- Iteration 4 -- -int(50) --- Iteration 5 -- -int(50) --- Iteration 6 -- -int(45) --- Iteration 7 -- -int(49) --- Iteration 8 -- -int(45) --- Iteration 9 -- -int(49) --- Iteration 10 -- - -Warning: ord() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: ord() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: ord() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -int(49) --- Iteration 14 -- -int(0) --- Iteration 15 -- -int(49) --- Iteration 16 -- -int(0) --- Iteration 17 -- -int(0) --- Iteration 18 -- -int(0) --- Iteration 19 -- -int(115) --- Iteration 20 -- - -Warning: ord() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) -===DONE=== diff --git a/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt b/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt deleted file mode 100644 index 8d147c0e67..0000000000 --- a/ext/standard/tests/strings/quoted_printable_decode_variation1.phpt +++ /dev/null @@ -1,191 +0,0 @@ ---TEST-- -Test quoted_printable_decode() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : string quoted_printable_decode ( string $str ) - * Description: Convert a quoted-printable string to an 8 bit string - * Source code: ext/standard/string.c -*/ - -/* -* Testing quoted_printable_decode() : with different unexpected values for format argument other than the strings -*/ - -echo "*** Testing quoted_printable_decode() : with unexpected values for 'str' argument ***\n"; - -// initialing required variables -$arg1 = "second arg"; -$arg2 = "third arg"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample -{ - public function __toString() { - return "Object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new sample(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource data -/*26*/ $file_handle -); - -// loop through each element of the array for 'str' - -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - var_dump(bin2hex(quoted_printable_decode($value))); - $count++; -}; - -// close the resource -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing quoted_printable_decode() : with unexpected values for 'str' argument *** - --- Iteration 1 -- -string(2) "30" - --- Iteration 2 -- -string(2) "31" - --- Iteration 3 -- -string(10) "3132333435" - --- Iteration 4 -- -string(10) "2d32333435" - --- Iteration 5 -- -string(8) "31302e35" - --- Iteration 6 -- -string(10) "2d31302e35" - --- Iteration 7 -- -string(24) "313031323334353637303030" - --- Iteration 8 -- -string(26) "312e3037363534333231452d39" - --- Iteration 9 -- -string(6) "302e35" - --- Iteration 10 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 11 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 12 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 13 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 14 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, array given in %s on line %d -string(0) "" - --- Iteration 15 -- -string(0) "" - --- Iteration 16 -- -string(0) "" - --- Iteration 17 -- -string(2) "31" - --- Iteration 18 -- -string(0) "" - --- Iteration 19 -- -string(2) "31" - --- Iteration 20 -- -string(0) "" - --- Iteration 21 -- -string(0) "" - --- Iteration 22 -- -string(0) "" - --- Iteration 23 -- -string(12) "4f626a656374" - --- Iteration 24 -- -string(0) "" - --- Iteration 25 -- -string(0) "" - --- Iteration 26 -- - -Warning: quoted_printable_decode() expects parameter 1 to be string, resource given in %s on line %d -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt new file mode 100644 index 0000000000..4b479a9a60 --- /dev/null +++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test function quotemeta() - using an empty string is given as str. +--CREDITS-- +Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> +User Group: PHPSP #PHPTestFestBrasil +--FILE-- +<?php +$str = ""; +var_dump(quotemeta($str)); +?> +--EXPECT-- +bool(false) diff --git a/ext/standard/tests/strings/rtrim_variation1.phpt b/ext/standard/tests/strings/rtrim_variation1.phpt deleted file mode 100644 index f07b7db3df..0000000000 --- a/ext/standard/tests/strings/rtrim_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test rtrim() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string rtrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing rtrim() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = ' !--string_val--! '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " !---sample object---! "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test rtrim() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( rtrim($input, " !-") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing rtrim() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(11) "-2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(5) "-20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: rtrim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(19) " !---sample object" --- Iteration 20 -- - -Warning: rtrim() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/rtrim_variation2.phpt b/ext/standard/tests/strings/rtrim_variation2.phpt deleted file mode 100644 index 70efd09f2b..0000000000 --- a/ext/standard/tests/strings/rtrim_variation2.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test rtrim() function : usage variations - test values for $charlist argument ---FILE-- -<?php - -/* Prototype : string rtrim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing rtrim() function: with unexpected inputs for 'charlist' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test rtrim() function -$count = 1; -foreach($inputs as $charlist) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( rtrim("!---Hello World---!", $charlist) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing rtrim() function: with unexpected inputs for 'charlist' argument *** --- Iteration 1 -- -string(19) "!---Hello World---!" --- Iteration 2 -- -string(19) "!---Hello World---!" --- Iteration 3 -- -string(19) "!---Hello World---!" --- Iteration 4 -- -string(19) "!---Hello World---!" --- Iteration 5 -- -string(19) "!---Hello World---!" --- Iteration 6 -- -string(19) "!---Hello World---!" --- Iteration 7 -- -string(19) "!---Hello World---!" --- Iteration 8 -- -string(19) "!---Hello World---!" --- Iteration 9 -- -string(19) "!---Hello World---!" --- Iteration 10 -- - -Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: rtrim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(19) "!---Hello World---!" --- Iteration 14 -- -string(19) "!---Hello World---!" --- Iteration 15 -- -string(19) "!---Hello World---!" --- Iteration 16 -- -string(19) "!---Hello World---!" --- Iteration 17 -- -string(19) "!---Hello World---!" --- Iteration 18 -- -string(19) "!---Hello World---!" --- Iteration 19 -- -string(19) "!---Hello World---!" --- Iteration 20 -- - -Warning: rtrim() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(19) "!---Hello World---!" --- Iteration 22 -- -string(19) "!---Hello World---!" -===DONE=== diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 83a191b172..102dab75ff 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -10,15 +10,15 @@ Test sha1_file() function with ASCII output and raw binary output. Based on ext/ echo "*** Testing sha1_file() : basic functionality ***\n"; /* Creating an empty file */ -if (($handle = fopen( "EmptyFile.txt", "w+")) == FALSE) +if (($handle = fopen( "EmptyFileSHA1.txt", "w+")) == FALSE) return false; /* Creating a data file */ -if (($handle2 = fopen( "DataFile.txt", "w+")) == FALSE) +if (($handle2 = fopen( "DataFileSHA1.txt", "w+")) == FALSE) return false; /* Writing into file */ -$filename = "DataFile.txt"; +$filename = "DataFileSHA1.txt"; $content = "Add this to the file\n"; if (is_writable($filename)) { if (fwrite($handle2, $content) === FALSE) { @@ -50,23 +50,23 @@ echo "\n-- Zero arguments --\n"; var_dump ( sha1_file() ); echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFile.txt", true, NULL) ); +var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; -var_dump( sha1_file("EmptyFile.txt") ); +var_dump( sha1_file("EmptyFileSHA1.txt") ); echo "\n-- Raw Binary Output for Empty file as Argument --\n"; -var_dump( bin2hex(sha1_file("EmptyFile.txt", true))); +var_dump( bin2hex(sha1_file("EmptyFileSHA1.txt", true))); echo "\n-- Hexadecimal Output for a valid file with some contents --\n"; -var_dump( sha1_file("DataFile.txt") ); +var_dump( sha1_file("DataFileSHA1.txt") ); echo "\n-- Raw Binary Output for a valid file with some contents --\n"; -var_dump ( bin2hex(sha1_file("DataFile.txt", true))); +var_dump ( bin2hex(sha1_file("DataFileSHA1.txt", true))); // remove temp files -unlink("DataFile.txt"); -unlink("EmptyFile.txt"); +unlink("DataFileSHA1.txt"); +unlink("EmptyFileSHA1.txt"); ?> ===DONE=== diff --git a/ext/standard/tests/strings/sha1_variation1.phpt b/ext/standard/tests/strings/sha1_variation1.phpt deleted file mode 100644 index 35fb16a87b..0000000000 --- a/ext/standard/tests/strings/sha1_variation1.phpt +++ /dev/null @@ -1,157 +0,0 @@ ---TEST-- -Test sha1() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php - -/* Prototype: string sha1 ( string $str [, bool $raw_output ] ) - * Description: Calculate the sha1 hash of a string - */ - -echo "*** Testing sha1() : unexpected values for 'str' ***\n"; - -$raw = false; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' argument -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.1234567E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new MyClass(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - //resource data -/*26*/ $fp -); - -// loop through each element of $values for 'str' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( sha1($values[$count], $raw) ); -} - -//closing resource -fclose($fp); - -?> -===DONE=== ---EXPECTF-- -*** Testing sha1() : unexpected values for 'str' *** --- Iteration 1 -- -string(40) "b6589fc6ab0dc82cf12099d1c2d40ab994e8410c" --- Iteration 2 -- -string(40) "356a192b7913b04c54574d18c28d46e6395428ab" --- Iteration 3 -- -string(40) "8cb2237d0679ca88db6464eac60da96345513964" --- Iteration 4 -- -string(40) "bc97c643aba3b6c6abe253222f439d4002a87528" --- Iteration 5 -- -string(40) "1287384bc5ef3ab84a36a5ef1d888df2763567f4" --- Iteration 6 -- -string(40) "c9d6e1b691f17c8ae6d458984a5f56f80e62a60b" --- Iteration 7 -- -string(40) "39493e1e645578a655f532e1f9bcff67991f2c2f" --- Iteration 8 -- -string(40) "681b45cae882ad795afd54ccc2a04ad58e056b83" --- Iteration 9 -- -string(40) "1b390cd54a0c0d4f27fa7adf23e3c45536e9f37c" --- Iteration 10 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: sha1() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 16 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 17 -- -string(40) "356a192b7913b04c54574d18c28d46e6395428ab" --- Iteration 18 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 19 -- -string(40) "356a192b7913b04c54574d18c28d46e6395428ab" --- Iteration 20 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 21 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 22 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 23 -- -string(40) "1615307cc4523f183e777df67f168c86908e8007" --- Iteration 24 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 25 -- -string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" --- Iteration 26 -- - -Warning: sha1() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/sha1_variation2.phpt b/ext/standard/tests/strings/sha1_variation2.phpt deleted file mode 100644 index 13c255451a..0000000000 --- a/ext/standard/tests/strings/sha1_variation2.phpt +++ /dev/null @@ -1,160 +0,0 @@ ---TEST-- -Test sha1() function : usage variations - unexpected values for 'raw' argument ---FILE-- -<?php - -/* Prototype: string sha1 ( string $str [, bool $raw_output ] ) - * Description: Calculate the sha1 hash of a string - */ - -echo "*** Testing sha1() : unexpected values for 'raw' ***\n"; - -$string = "Hello World"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' argument -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.1234567E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // string data -/*17*/ "ABC", - 'abc', - "0abc", - "123abc", - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new MyClass(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - //resource data -/*26*/ $fp -); - -// loop through each element of $values for 'raw' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - // use bin2hex to catch those cases were raw is true - var_dump( bin2hex(sha1($string, $values[$count])) ); -} - -//closing resource -fclose($fp); - -?> -===DONE=== ---EXPECTF-- -*** Testing sha1() : unexpected values for 'raw' *** --- Iteration 1 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 2 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 3 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 4 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 5 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 6 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 7 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 8 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 9 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 10 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 11 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 12 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 13 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 14 -- - -Warning: sha1() expects parameter 2 to be bool, array given in %s on line %d -string(0) "" --- Iteration 15 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 16 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 17 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 18 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 19 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 20 -- -string(40) "0a4d55a8d778e5022fab701977c5d840bbc486d0" --- Iteration 21 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 22 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 23 -- - -Warning: sha1() expects parameter 2 to be bool, object given in %s on line %d -string(0) "" --- Iteration 24 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 25 -- -string(80) "30613464353561386437373865353032326661623730313937376335643834306262633438366430" --- Iteration 26 -- - -Warning: sha1() expects parameter 2 to be bool, resource given in %s on line %d -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/str_getcsv_002.phpt b/ext/standard/tests/strings/str_getcsv_002.phpt new file mode 100644 index 0000000000..a4ff87c206 --- /dev/null +++ b/ext/standard/tests/strings/str_getcsv_002.phpt @@ -0,0 +1,19 @@ +--TEST-- +str_getcsv() with empty $escape +--FILE-- +<?php +$contents = <<<EOS +"cell1","cell2\\","cell3","cell4" +EOS; +print_r(str_getcsv($contents, ',', '"', '')); +?> +===DONE=== +--EXPECT-- +Array +( + [0] => cell1 + [1] => cell2\ + [2] => cell3 + [3] => cell4 +) +===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt deleted file mode 100644 index 32506ab1a9..0000000000 --- a/ext/standard/tests/strings/str_pad_variation1.phpt +++ /dev/null @@ -1,140 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$input' argument ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$input' - * and expected type for '$pad_length' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'input' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, - - // float values -/*6*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*9*/ array(), - array(0), - array(1, 2), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - -//defining '$pad_length' argument -$pad_length = "20"; - -// loop through with each element of the $inputs array to test str_pad() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'input' argument *** --- Iteration 1 -- -string(20) "0 " --- Iteration 2 -- -string(20) "1 " --- Iteration 3 -- -string(20) "-2 " --- Iteration 4 -- -string(20) "2147483647 " --- Iteration 5 -- -string(20) "-2147483648 " --- Iteration 6 -- -string(20) "10.5 " --- Iteration 7 -- -string(20) "-20.5 " --- Iteration 8 -- -string(20) "101234567000 " --- Iteration 9 -- - -Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_pad() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- -string(20) "1 " --- Iteration 13 -- -string(20) " " --- Iteration 14 -- -string(20) "1 " --- Iteration 15 -- -string(20) " " --- Iteration 16 -- -string(20) " " --- Iteration 17 -- -string(20) " " --- Iteration 18 -- -string(20) "sample object " --- Iteration 19 -- - -Warning: str_pad() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 20 -- -string(20) " " --- Iteration 21 -- -string(20) " " -===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt deleted file mode 100644 index 114d5f5ba1..0000000000 --- a/ext/standard/tests/strings/str_pad_variation2.phpt +++ /dev/null @@ -1,139 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$pad_length' argument ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$pad_length' - * and expected type for '$input' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'pad_length' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$pad_lengths = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 255, - - // float values -/*5*/ 10.5, - -20.5, - 10.12345e2, - - // array values -/*8*/ array(), - array(0), - array(1, 2), - - // boolean values -/*11*/ true, - false, - TRUE, - FALSE, - - // null values -/*15*/ NULL, - null, - - // objects -/*17*/ new sample(), - - // resource -/*18*/ $file_handle, - - // undefined variable -/*19*/ @$undefined_var, - - // unset variable -/*20*/ @$unset_var -); - -//defining '$input' argument -$input = "Test string"; - -// loop through with each element of the $pad_lengths array to test str_pad() function -$count = 1; -foreach($pad_lengths as $pad_length) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'pad_length' argument *** --- Iteration 1 -- -string(11) "Test string" --- Iteration 2 -- -string(11) "Test string" --- Iteration 3 -- -string(11) "Test string" --- Iteration 4 -- -string(255) "Test string " --- Iteration 5 -- -string(11) "Test string" --- Iteration 6 -- -string(11) "Test string" --- Iteration 7 -- -string(1012) "Test string " --- Iteration 8 -- - -Warning: str_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: str_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 11 -- -string(11) "Test string" --- Iteration 12 -- -string(11) "Test string" --- Iteration 13 -- -string(11) "Test string" --- Iteration 14 -- -string(11) "Test string" --- Iteration 15 -- -string(11) "Test string" --- Iteration 16 -- -string(11) "Test string" --- Iteration 17 -- - -Warning: str_pad() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 18 -- - -Warning: str_pad() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 19 -- -string(11) "Test string" --- Iteration 20 -- -string(11) "Test string" -===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation3.phpt b/ext/standard/tests/strings/str_pad_variation3.phpt deleted file mode 100644 index 1e58477f21..0000000000 --- a/ext/standard/tests/strings/str_pad_variation3.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$pad_string' argument ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$pad_string' - * and expected type for '$input' and '$pad_length' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'pad_string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$pad_strings = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, - - // float values -/*6*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*9*/ array(), - array(0), - array(1, 2), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - -//defining '$input' argument -$input = "Test string"; -$pad_length = 20; - -// loop through with each element of the $pad_strings array to test str_pad() function -$count = 1; -foreach($pad_strings as $pad_string) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length, $pad_string) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'pad_string' argument *** --- Iteration 1 -- -string(20) "Test string000000000" --- Iteration 2 -- -string(20) "Test string111111111" --- Iteration 3 -- -string(20) "Test string-2-2-2-2-" --- Iteration 4 -- -string(20) "Test string214748364" --- Iteration 5 -- -string(20) "Test string-21474836" --- Iteration 6 -- -string(20) "Test string10.510.51" --- Iteration 7 -- -string(20) "Test string-20.5-20." --- Iteration 8 -- -string(20) "Test string101234567" --- Iteration 9 -- - -Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_pad() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 12 -- -string(20) "Test string111111111" --- Iteration 13 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 14 -- -string(20) "Test string111111111" --- Iteration 15 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 16 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 17 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 18 -- -string(20) "Test stringsample ob" --- Iteration 19 -- - -Warning: str_pad() expects parameter 3 to be string, resource given in %s on line %d -NULL --- Iteration 20 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL --- Iteration 21 -- - -Warning: str_pad(): Padding string cannot be empty in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/str_pad_variation4.phpt b/ext/standard/tests/strings/str_pad_variation4.phpt deleted file mode 100644 index 22ca2d5270..0000000000 --- a/ext/standard/tests/strings/str_pad_variation4.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test str_pad() function : usage variations - unexpected inputs for '$pad_type' argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) - * Description: Pad a string to a certain length with another string - * Source code: ext/standard/string.c -*/ - -/* Test str_pad() function: with unexpected inputs for '$pad_type' - * and expected type for '$input', '$pad_length' and '$pad_string' -*/ - -echo "*** Testing str_pad() function: with unexpected inputs for 'pad_type' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -// array with different values for $input -$pad_types = array ( - - // integer values -/*1*/ 0, // == STR_PAD_LEFT - 1, // == STR_PAD_RIGHT - 2, // == STR_PAD_BOTH - -2, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // string data -/*10*/ "abc", - "STR_PAD_LEFT", - "2", - "0x2", - "02", - - // array values -/*15*/ array(), - array(0), - array(1, 2), - - // boolean values -/*18*/ true, - false, - TRUE, - FALSE, - - // null values -/*22*/ NULL, - null, - - // objects -/*24*/ new sample(), - - // undefined variable -/*25*/ @$undefined_var, - - // unset variable -/*26*/ @$unset_var -); - -//defining '$input' argument -$input = "Test string"; -$pad_length = 20; -$pad_string = "*"; - -// loop through with each element of the $pad_types array to test str_pad() function -$count = 1; -foreach($pad_types as $pad_type) { - echo "-- Iteration $count --\n"; - var_dump( str_pad($input, $pad_length, $pad_string, $pad_type) ); - $count ++; -} - -?> -===DONE=== ---EXPECTF-- -*** Testing str_pad() function: with unexpected inputs for 'pad_type' argument *** --- Iteration 1 -- -string(20) "*********Test string" --- Iteration 2 -- -string(20) "Test string*********" --- Iteration 3 -- -string(20) "****Test string*****" --- Iteration 4 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 5 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 6 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 7 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 8 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 9 -- - -Warning: str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_pad() expects parameter 4 to be int, string given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_pad() expects parameter 4 to be int, string given in %s on line %d -NULL --- Iteration 12 -- -string(20) "****Test string*****" --- Iteration 13 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(20) "*********Test string" --- Iteration 14 -- -string(20) "****Test string*****" --- Iteration 15 -- - -Warning: str_pad() expects parameter 4 to be int, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: str_pad() expects parameter 4 to be int, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: str_pad() expects parameter 4 to be int, array given in %s on line %d -NULL --- Iteration 18 -- -string(20) "Test string*********" --- Iteration 19 -- -string(20) "*********Test string" --- Iteration 20 -- -string(20) "Test string*********" --- Iteration 21 -- -string(20) "*********Test string" --- Iteration 22 -- -string(20) "*********Test string" --- Iteration 23 -- -string(20) "*********Test string" --- Iteration 24 -- - -Warning: str_pad() expects parameter 4 to be int, object given in %s on line %d -NULL --- Iteration 25 -- -string(20) "*********Test string" --- Iteration 26 -- -string(20) "*********Test string" -===DONE=== diff --git a/ext/standard/tests/strings/str_shuffle.phpt b/ext/standard/tests/strings/str_shuffle.phpt index 878cb283dd..f5122bc202 100644 --- a/ext/standard/tests/strings/str_shuffle.phpt +++ b/ext/standard/tests/strings/str_shuffle.phpt @@ -2,7 +2,6 @@ Testing str_shuffle. --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $s = '123'; var_dump(str_shuffle($s)); var_dump($s); diff --git a/ext/standard/tests/strings/str_shuffle_variation1.phpt b/ext/standard/tests/strings/str_shuffle_variation1.phpt deleted file mode 100644 index d5681392b5..0000000000 --- a/ext/standard/tests/strings/str_shuffle_variation1.phpt +++ /dev/null @@ -1,135 +0,0 @@ ---TEST-- -Test str_shuffle() function : usage variations - test values for $haystack argument ---FILE-- -<?php - -/* Prototype : string str_shuffle ( string $str ) - * Description: Randomly shuffles a string - * Source code: ext/standard/string.c -*/ - -echo "*** Testing str_shuffle() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - -2, - 2147483647, - -2147483648, - - // float values -/*6*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*9*/ array(), - array(0), - array(1, 2), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - - -// loop through with each element of the $inputs array to test str_shuffle() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( str_shuffle($input) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing str_shuffle() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(2) "%s" --- Iteration 4 -- -string(10) "%s" --- Iteration 5 -- -string(11) "%s" --- Iteration 6 -- -string(4) "%s" --- Iteration 7 -- -string(5) "%s" --- Iteration 8 -- -string(12) "%s" --- Iteration 9 -- - -Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_shuffle() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- -string(1) "1" --- Iteration 13 -- -string(0) "" --- Iteration 14 -- -string(1) "1" --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(13) "%s" --- Iteration 19 -- - -Warning: str_shuffle() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/str_split_variation1.phpt b/ext/standard/tests/strings/str_split_variation1.phpt deleted file mode 100644 index 94eca406fd..0000000000 --- a/ext/standard/tests/strings/str_split_variation1.phpt +++ /dev/null @@ -1,241 +0,0 @@ ---TEST-- -Test str_split() function : usage variations - unexpected values for 'str' argument ---FILE-- -<?php -/* Prototype : array str_split(string $str [, int $split_length]) - * Description: Convert a string to an array. If split_length is - specified, break the string down into chunks each - split_length characters long. - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing str_split() : unexpected values for 'str' ***\n"; - -// Initialise function arguments -$split_length = 3; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'str' argument -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - $fp -); - -// loop through each element of $values for 'str' argument -for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count+1)." --\n"; - var_dump( str_split($values[$count], $split_length) ); -} - -//closing resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing str_split() : unexpected values for 'str' *** --- Iteration 1 -- -array(1) { - [0]=> - string(1) "0" -} --- Iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 3 -- -array(2) { - [0]=> - string(3) "123" - [1]=> - string(2) "45" -} --- Iteration 4 -- -array(2) { - [0]=> - string(3) "-23" - [1]=> - string(2) "45" -} --- Iteration 5 -- -array(2) { - [0]=> - string(3) "10." - [1]=> - string(1) "5" -} --- Iteration 6 -- -array(2) { - [0]=> - string(3) "-10" - [1]=> - string(2) ".5" -} --- Iteration 7 -- -array(4) { - [0]=> - string(3) "105" - [1]=> - string(3) "000" - [2]=> - string(3) "000" - [3]=> - string(3) "000" -} --- Iteration 8 -- -array(3) { - [0]=> - string(3) "1.0" - [1]=> - string(3) "6E-" - [2]=> - string(1) "9" -} --- Iteration 9 -- -array(1) { - [0]=> - string(3) "0.5" -} --- Iteration 10 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: str_split() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 16 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 17 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 18 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 19 -- -array(1) { - [0]=> - string(1) "1" -} --- Iteration 20 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 21 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 22 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 23 -- -array(2) { - [0]=> - string(3) "obj" - [1]=> - string(3) "ect" -} --- Iteration 24 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 25 -- -array(1) { - [0]=> - string(0) "" -} --- Iteration 26 -- - -Warning: str_split() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/str_split_variation2.phpt b/ext/standard/tests/strings/str_split_variation2.phpt deleted file mode 100644 index 0bb8304b56..0000000000 --- a/ext/standard/tests/strings/str_split_variation2.phpt +++ /dev/null @@ -1,290 +0,0 @@ ---TEST-- -Test str_split() function : usage variations - unexpected values for 'split_length' argument ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); -?> ---FILE-- -<?php -/* Prototype : array str_split(string $str [, int $split_length]) - * Description: Convert a string to an array. If split_length is - specified, break the string down into chunks each - split_length characters long. - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing str_split() : unexpected values for 'split_length' ***\n"; - -// Initialise function arguments -$str = 'variation2:split_length'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'split_length' -$values = array( - - // float data - 10.5, - -10.5, - 10.6E10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - $fp -); - -// loop through each element of $values for 'split_length' -for($count = 0; $count < count($values); $count++) { - echo "--Iteration ".($count+1)." --\n"; - var_dump( str_split($str, $values[$count]) ); -} - -//closing resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing str_split() : unexpected values for 'split_length' *** ---Iteration 1 -- -array(3) { - [0]=> - string(10) "variation2" - [1]=> - string(10) ":split_len" - [2]=> - string(3) "gth" -} ---Iteration 2 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 3 -- - -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL ---Iteration 4 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 5 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 6 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 7 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 8 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 9 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 10 -- - -Warning: str_split() expects parameter 2 to be int, array given in %sstr_split_variation2.php on line %d -NULL ---Iteration 11 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 12 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 13 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 14 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 15 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 16 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 17 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 18 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 19 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 20 -- - -Warning: str_split() expects parameter 2 to be int, string given in %sstr_split_variation2.php on line %d -NULL ---Iteration 21 -- - -Warning: str_split() expects parameter 2 to be int, object given in %sstr_split_variation2.php on line %d -NULL ---Iteration 22 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 23 -- - -Warning: str_split(): The length of each segment must be greater than zero in %sstr_split_variation2.php on line %d -bool(false) ---Iteration 24 -- - -Warning: str_split() expects parameter 2 to be int, resource given in %sstr_split_variation2.php on line %d -NULL -Done diff --git a/ext/standard/tests/strings/str_split_variation2_64bit.phpt b/ext/standard/tests/strings/str_split_variation2_64bit.phpt deleted file mode 100644 index 92a07498a4..0000000000 --- a/ext/standard/tests/strings/str_split_variation2_64bit.phpt +++ /dev/null @@ -1,291 +0,0 @@ ---TEST-- -Test str_split() function : usage variations - unexpected values for 'split_length' argument ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); -?> ---FILE-- -<?php -/* Prototype : array str_split(string $str [, int $split_length]) - * Description: Convert a string to an array. If split_length is - specified, break the string down into chunks each - split_length characters long. - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -echo "*** Testing str_split() : unexpected values for 'split_length' ***\n"; - -// Initialise function arguments -$str = 'variation2:split_length'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//defining class for object variable -class MyClass -{ - public function __toString() - { - return "object"; - } -} - -//resource variable -$fp = fopen(__FILE__, 'r'); - -//different values for 'split_length' -$values = array( - - // float data - 10.5, - -10.5, - 10.6E10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new MyClass(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - //resource data - $fp -); - -// loop through each element of $values for 'split_length' -for($count = 0; $count < count($values); $count++) { - echo "--Iteration ".($count+1)." --\n"; - var_dump( str_split($str, $values[$count]) ); -} - -//closing resource -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing str_split() : unexpected values for 'split_length' *** ---Iteration 1 -- -array(3) { - [0]=> - string(10) "variation2" - [1]=> - string(10) ":split_len" - [2]=> - string(3) "gth" -} ---Iteration 2 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 3 -- -array(1) { - [0]=> - string(23) "variation2:split_length" -} ---Iteration 4 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 5 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 6 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 7 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 8 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 9 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 10 -- - -Warning: str_split() expects parameter 2 to be int, array given in %s on line %d -NULL ---Iteration 11 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 12 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 13 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 14 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 15 -- -array(23) { - [0]=> - string(1) "v" - [1]=> - string(1) "a" - [2]=> - string(1) "r" - [3]=> - string(1) "i" - [4]=> - string(1) "a" - [5]=> - string(1) "t" - [6]=> - string(1) "i" - [7]=> - string(1) "o" - [8]=> - string(1) "n" - [9]=> - string(1) "2" - [10]=> - string(1) ":" - [11]=> - string(1) "s" - [12]=> - string(1) "p" - [13]=> - string(1) "l" - [14]=> - string(1) "i" - [15]=> - string(1) "t" - [16]=> - string(1) "_" - [17]=> - string(1) "l" - [18]=> - string(1) "e" - [19]=> - string(1) "n" - [20]=> - string(1) "g" - [21]=> - string(1) "t" - [22]=> - string(1) "h" -} ---Iteration 16 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 17 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 18 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 19 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 20 -- - -Warning: str_split() expects parameter 2 to be int, string given in %s on line %d -NULL ---Iteration 21 -- - -Warning: str_split() expects parameter 2 to be int, object given in %s on line %d -NULL ---Iteration 22 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 23 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) ---Iteration 24 -- - -Warning: str_split() expects parameter 2 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 9b1898fb35..3086c2be92 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex ef659014a5..397e072c52 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/strcspn_variation1.phpt b/ext/standard/tests/strings/strcspn_variation1.phpt deleted file mode 100644 index 89a4e5cc72..0000000000 --- a/ext/standard/tests/strings/strcspn_variation1.phpt +++ /dev/null @@ -1,273 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with different unexpected values for str argument -*/ - -echo "*** Testing strcspn() : with unexpected values for str argument ***\n"; - -// Initialise function arguments not being substititued (if any) -$mask = 'abons1234567890'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample, - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\n-- Iteration with str value as \"$value\"\n"; - var_dump( strcspn($value,$mask) ); // with default args - var_dump( strcspn($value,$mask,$start) ); // with default len value - var_dump( strcspn($value,$mask,$start,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with unexpected values for str argument *** - --- Iteration with str value as "0" -int(0) -int(0) -int(0) - --- Iteration with str value as "1" -int(0) -int(0) -int(0) - --- Iteration with str value as "12345" -int(0) -int(0) -int(0) - --- Iteration with str value as "-2345" -int(1) -int(0) -int(0) - --- Iteration with str value as "10.5" -int(0) -int(0) -int(0) - --- Iteration with str value as "-10.5" -int(1) -int(0) -int(0) - --- Iteration with str value as "101234567000" -int(0) -int(0) -int(0) - --- Iteration with str value as "1.07654321E-9" -int(0) -int(1) -int(1) - --- Iteration with str value as "0.5" -int(0) -int(1) -int(1) - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(0) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(0) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "object" -int(0) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "Resource id #%d" - -Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcspn_variation2.phpt b/ext/standard/tests/strings/strcspn_variation2.phpt deleted file mode 100644 index d7d25f2ec0..0000000000 --- a/ext/standard/tests/strings/strcspn_variation2.phpt +++ /dev/null @@ -1,272 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values for mask argument ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strcspn() : with different unexpected values for mask argument -*/ - -echo "*** Testing strcspn() : with different unexpected values of mask argument ***\n"; - -$str = 'string_val'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for mask - -foreach($values as $value) { - echo "\n-- Iteration with mask value as \"$value\" --\n"; - var_dump( strcspn($str,$value) ); // with defalut args - var_dump( strcspn($str,$value,$start) ); // with default len value - var_dump( strcspn($str,$value,$start,$len) ); // with all args -}; - -// close the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with different unexpected values of mask argument *** - --- Iteration with mask value as "0" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "12345" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "-2345" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "10.5" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "-10.5" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "101234567000" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1.07654321E-9" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "0.5" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "1" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "object" -- -int(1) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "" -- -int(10) -int(9) -int(9) - --- Iteration with mask value as "Resource id #%d" -- - -Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcspn_variation3.phpt b/ext/standard/tests/strings/strcspn_variation3.phpt deleted file mode 100644 index 745fe88b4c..0000000000 --- a/ext/standard/tests/strings/strcspn_variation3.phpt +++ /dev/null @@ -1,243 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values of start argument ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strcspn() : with unexpected values of start argument -*/ - -echo "*** Testing strcspn() : with unexpected values of start argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$len = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with start value as \"$value\" --\n"; - var_dump( strcspn($str,$mask,$value) ); // with default len value - var_dump( strcspn($str,$mask,$value,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with unexpected values of start argument *** - --- Iteration with start value as "10.5" -- -int(0) -int(0) - --- Iteration with start value as "-10.5" -- -int(0) -int(0) - --- Iteration with start value as "1012345670" -- -bool(false) -bool(false) - --- Iteration with start value as "1.07654321E-7" -- -int(0) -int(0) - --- Iteration with start value as "0.5" -- -int(0) -int(0) - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "1" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "1" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "object" -- - -Warning: strcspn() expects parameter 3 to be int, object given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, object given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "" -- -int(0) -int(0) - --- Iteration with start value as "Resource id #%d" -- - -Warning: strcspn() expects parameter 3 to be int, resource given in %s on line %d -NULL - -Warning: strcspn() expects parameter 3 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strcspn_variation4.phpt b/ext/standard/tests/strings/strcspn_variation4.phpt deleted file mode 100644 index 0af1228293..0000000000 --- a/ext/standard/tests/strings/strcspn_variation4.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test strcspn() function : usage variations - unexpected values of len argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters not found in mask. - If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strcspn() : with unexpected values of len argument -*/ - -echo "*** Testing strcspn() : with unexpected values of len argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$start = 0; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with len value as \"$value\" --\n"; - var_dump( strcspn($str,$mask,$start,$value) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strcspn() : with unexpected values of len argument *** - --- Iteration with len value as "10.5" -- -int(0) - --- Iteration with len value as "-10.5" -- -int(0) - --- Iteration with len value as "101234567000" -- -int(0) - --- Iteration with len value as "1.07654321E-9" -- -int(0) - --- Iteration with len value as "0.5" -- -int(0) - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strcspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strcspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "object" -- - -Warning: strcspn() expects parameter 4 to be int, object given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "Resource id #%d" -- - -Warning: strcspn() expects parameter 4 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strings001.phpt b/ext/standard/tests/strings/strings001.phpt index 70b709295d..4784248212 100644 --- a/ext/standard/tests/strings/strings001.phpt +++ b/ext/standard/tests/strings/strings001.phpt @@ -2,7 +2,6 @@ Test whether strstr() and strrchr() are binary safe. --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $s = "alabala nica".chr(0)."turska panica"; var_dump(strstr($s, "nic")); var_dump(strrchr($s," nic")); diff --git a/ext/standard/tests/strings/strip_tags_array.phpt b/ext/standard/tests/strings/strip_tags_array.phpt new file mode 100644 index 0000000000..5c2e6118e6 --- /dev/null +++ b/ext/standard/tests/strings/strip_tags_array.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test strip_tags() function : basic functionality - with array argument +--FILE-- +<?php + +$string = '<p>foo <b>bar</b> <a href="#">foobar</a></p>'; +var_dump(strip_tags($string)); +var_dump(strip_tags($string, ['a'])); +var_dump(strip_tags($string, ['p', 'a'])); +var_dump(strip_tags($string, [])); +var_dump(strip_tags($string, ['p' => true, 'a' => false])); +var_dump(strip_tags($string, ['p' => 'a'])); + +// Previous tests from strip_tags_variation2.phpt +var_dump(strip_tags($string, [0])); +var_dump(strip_tags($string, [1])); +var_dump(strip_tags($string, [1, 2])); +var_dump(strip_tags($string, ['color' => 'red', 'item' => 'pen'])); +echo "Done"; +?> +--EXPECT-- +string(14) "foo bar foobar" +string(30) "foo bar <a href="#">foobar</a>" +string(37) "<p>foo bar <a href="#">foobar</a></p>" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(30) "foo bar <a href="#">foobar</a>" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +Done diff --git a/ext/standard/tests/strings/strip_tags_variation1.phpt b/ext/standard/tests/strings/strip_tags_variation1.phpt deleted file mode 100644 index cca444c0e0..0000000000 --- a/ext/standard/tests/strings/strip_tags_variation1.phpt +++ /dev/null @@ -1,159 +0,0 @@ ---TEST-- -Test strip_tags() function : usage variations - unexpected values for 'str' argument ---INI-- -set short_open_tag = on ---FILE-- -<?php -/* Prototype : string strip_tags(string $str [, string $allowable_tags]) - * Description: Strips HTML and PHP tags from a string - * Source code: ext/standard/string.c -*/ - -/* - * testing functionality of strip_tags() by giving unexpected input values for $str argument -*/ - -echo "*** Testing strip_tags() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//get a resource variable -$fp = fopen(__FILE__, "r"); - -//get a class -class classA{ - public function __toString(){ - return "Class A object"; - } -} - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new classA(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource variable -/*26*/ $fp - -); - -// loop through each element of the array for allowable_tags -$iterator = 1; -foreach($values as $value) { - echo "-- Iteration $iterator --\n"; - var_dump( strip_tags($value) ); - $iterator++; -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing strip_tags() : usage variations *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(1) "1" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(14) "Class A object" --- Iteration 24 -- -string(0) "" --- Iteration 25 -- -string(0) "" --- Iteration 26 -- - -Warning: strip_tags() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/strip_tags_variation2.phpt b/ext/standard/tests/strings/strip_tags_variation2.phpt index a32e3eccad..c30f29dc3f 100644 --- a/ext/standard/tests/strings/strip_tags_variation2.phpt +++ b/ext/standard/tests/strings/strip_tags_variation2.phpt @@ -48,13 +48,6 @@ $values = array( 10.6E-10, .5, - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - // null data NULL, null, @@ -113,24 +106,14 @@ string(10) "helloworld" -- Iteration 9 -- string(10) "helloworld" -- Iteration 10 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 11 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 12 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 13 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 14 -- - -Notice: Array to string conversion in %s on line %d string(10) "helloworld" -- Iteration 15 -- string(10) "helloworld" @@ -146,14 +129,4 @@ string(10) "helloworld" string(10) "helloworld" -- Iteration 21 -- string(10) "helloworld" --- Iteration 22 -- -string(10) "helloworld" --- Iteration 23 -- -string(10) "helloworld" --- Iteration 24 -- -string(10) "helloworld" --- Iteration 25 -- -string(10) "helloworld" --- Iteration 26 -- -string(10) "helloworld" Done diff --git a/ext/standard/tests/strings/strip_tags_variation3.phpt b/ext/standard/tests/strings/strip_tags_variation3.phpt deleted file mode 100644 index d6dc34a080..0000000000 --- a/ext/standard/tests/strings/strip_tags_variation3.phpt +++ /dev/null @@ -1,159 +0,0 @@ ---TEST-- -Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags' ---INI-- -set short_open_tag = on ---FILE-- -<?php -/* Prototype : string strip_tags(string $str [, string $allowable_tags]) - * Description: Strips HTML and PHP tags from a string - * Source code: ext/standard/string.c -*/ - -/* - * testing functionality of strip_tags() by giving unexpected values for $str and $allowable_tags arguments -*/ - -echo "*** Testing strip_tags() : usage variations ***\n"; - -// get a resource -$fp=fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA{ - public function __toString(){ - return "Class A object"; - } -} - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new classA(), - - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - - // resource variable - $fp - -); - -// loop through each element of the array for allowable_tags -$iterator = 1; -foreach($values as $value) { - echo "-- Iteration $iterator --\n"; - var_dump( strip_tags($value, $value) ); - $iterator++; -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing strip_tags() : usage variations *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strip_tags() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(1) "1" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(14) "Class A object" --- Iteration 24 -- -string(0) "" --- Iteration 25 -- -string(0) "" --- Iteration 26 -- - -Warning: strip_tags() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/strings/stripcslashes_variation1.phpt b/ext/standard/tests/strings/stripcslashes_variation1.phpt deleted file mode 100644 index fe3a786678..0000000000 --- a/ext/standard/tests/strings/stripcslashes_variation1.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test stripcslashes() function : usage variations - non-string type argument ---FILE-- -<?php -/* Prototype : string stripcslashes ( string $str ) - * Description: Returns a string with backslashes stripped off. Recognizes C-like \n, \r ..., - * octal and hexadecimal representation. - * Source code: ext/standard/string.c -*/ - -/* - * Test stripcslashes() with non-string type argument such as int, float, etc -*/ - -echo "*** Testing stripcslashes() : with non-string type argument ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj'ct"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - 12345, - -2345, - - // float values -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*15*/ true, - false, - TRUE, - FALSE, - - // empty string -/*19*/ "", - '', - - // undefined variable -/*21*/ $undefined_var, - - // unset variable -/*22*/ $unset_var, - - // objects -/*23*/ new sample(), - - // resource -/*24*/ $file_handle, - - // null values -/*25*/ NULL, - null -); - - -// loop through each element of the array and check the working of stripcslashes() -// when $str argument is supplied with different values -echo "\n--- Testing stripcslashes() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( stripcslashes($str) ); - - $counter ++; -} - -// closing the file -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing stripcslashes() : with non-string type argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing stripcslashes() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: stripcslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(6) "obj'ct" --- Iteration 24 -- - -Warning: stripcslashes() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" --- Iteration 26 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/stripos_variation14.phpt b/ext/standard/tests/strings/stripos_variation14.phpt deleted file mode 100644 index 10b481fb71..0000000000 --- a/ext/standard/tests/strings/stripos_variation14.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - unexpected inputs for 'offset' argument ---FILE-- -<?php -/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of first occurrence of a case-insensitive string - * Source code: ext/standard/string.c -*/ - -/* Test stripos() function with unexpected inputs for 'offset' argument */ - -echo "*** Testing stripos() function with unexpected values for offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//definition of input args -$haystack = "hello world"; -$needle = "world"; - -// array with different values -$offsets = array ( - - // float values - 1.5, - -1.5, - 1.5e6, - 1.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of stripos() -$counter = 1; -for($index = 0; $index < count($offsets); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needle, $offsets[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing stripos() function with unexpected values for offset *** --- Iteration 1 -- -int(6) --- Iteration 2 -- -bool(false) --- Iteration 3 -- - -Warning: stripos(): Offset not contained in string in %s on line %d -bool(false) --- Iteration 4 -- -int(6) --- Iteration 5 -- -int(6) --- Iteration 6 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 7 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: stripos() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 11 -- -int(6) --- Iteration 12 -- -int(6) --- Iteration 13 -- -int(6) --- Iteration 14 -- -int(6) --- Iteration 15 -- - -Warning: stripos() expects parameter 3 to be int, object given in %s on line %d -NULL --- Iteration 16 -- - -Warning: stripos() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 17 -- - -Warning: stripos() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 18 -- -int(6) --- Iteration 19 -- -int(6) --- Iteration 20 -- - -Warning: stripos() expects parameter 3 to be int, resource given in %s on line %d -NULL --- Iteration 21 -- -int(6) --- Iteration 22 -- -int(6) -*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation9.phpt b/ext/standard/tests/strings/stripos_variation9.phpt deleted file mode 100644 index c0713c57ab..0000000000 --- a/ext/standard/tests/strings/stripos_variation9.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - unexpected inputs for 'haystack' argument ---FILE-- -<?php -/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of first occurrence of a case-insensitive string - * Source code: ext/standard/string.c -*/ - -/* Test stripos() function with unexpected inputs for haystack argument */ - -echo "*** Testing stripos() function with unexpected values for haystack ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$haystacks = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; - -// loop through each element of the array and check the working of stripos() -$counter = 1; -for($index = 0; $index < count($haystacks); $index ++) { - echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystacks[$index], $needle) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing stripos() function with unexpected values for haystack *** - --- Iteration 1 -- -bool(false) - --- Iteration 2 -- -bool(false) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -bool(false) - --- Iteration 6 -- -bool(false) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -bool(false) - --- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 15 -- -bool(false) - --- Iteration 16 -- -bool(false) - --- Iteration 17 -- -bool(false) - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- -bool(false) - --- Iteration 20 -- -bool(false) - --- Iteration 21 -- -bool(false) - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- -bool(false) - --- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - --- Iteration 25 -- -bool(false) - --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/stripslashes_variation1.phpt b/ext/standard/tests/strings/stripslashes_variation1.phpt deleted file mode 100644 index 2f9239ceee..0000000000 --- a/ext/standard/tests/strings/stripslashes_variation1.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test stripslashes() function : usage variations - non-string type argument ---FILE-- -<?php -/* Prototype : string stripslashes ( string $str ) - * Description: Returns an un-quoted string - * Source code: ext/standard/string.c -*/ - -/* - * Test stripslashes() with non-string type argument such as int, float, etc -*/ - -echo "*** Testing stripslashes() : with non-string type argument ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj\'ct"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - 12345, - -2345, - - // float values -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*15*/ true, - false, - TRUE, - FALSE, - - // empty string -/*19*/ "", - '', - - // undefined variable -/*21*/ $undefined_var, - - // unset variable -/*22*/ $unset_var, - - // objects -/*23*/ new sample(), - - // resource -/*24*/ $file_handle, - - // null values -/*25*/ NULL, - null -); - - -// loop through each element of the array and check the working of stripslashes() -// when $str argument is supplied with different values -echo "\n--- Testing stripslashes() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( stripslashes($str) ); - - $counter ++; -} - -// closing the file -fclose($file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing stripslashes() : with non-string type argument *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing stripslashes() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(13) "1.07654321E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: stripslashes() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" --- Iteration 20 -- -string(0) "" --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(6) "obj'ct" --- Iteration 24 -- - -Warning: stripslashes() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" --- Iteration 26 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/stristr_variation1.phpt b/ext/standard/tests/strings/stristr_variation1.phpt deleted file mode 100644 index 795bf09323..0000000000 --- a/ext/standard/tests/strings/stristr_variation1.phpt +++ /dev/null @@ -1,133 +0,0 @@ ---TEST-- -Test stristr() function : usage variations - test values for $haystack argument ---FILE-- -<?php - -/* Prototype: string stristr ( string $haystack, string $needle ); - Description: Case-insensitive strstr(). -*/ - -echo "*** Testing stristr() function: with unexpected inputs for 'string' argument ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - -2, - -PHP_INT_MAX, - - // float values -/*5*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*8*/ array(), - array(0), - array(1, 2), - - // boolean values -/*11*/ true, - false, - TRUE, - FALSE, - - // null values -/*15*/ NULL, - null, - - // objects -/*17*/ new sample(), - - // resource -/*18*/ $file_handle, - - // undefined variable -/*19*/ @$undefined_var, - - // unset variable -/*20*/ @$unset_var -); - -//defining '$pad_length' argument -$pad_length = "20"; - -// loop through with each element of the $inputs array to test stristr() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump( stristr($input, " ") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing stristr() function: with unexpected inputs for 'string' argument *** --- Iteration 1 -- -bool(false) --- Iteration 2 -- -bool(false) --- Iteration 3 -- -bool(false) --- Iteration 4 -- -bool(false) --- Iteration 5 -- -bool(false) --- Iteration 6 -- -bool(false) --- Iteration 7 -- -bool(false) --- Iteration 8 -- - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 -NULL --- Iteration 9 -- - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 -NULL --- Iteration 10 -- - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d2 -NULL --- Iteration 11 -- -bool(false) --- Iteration 12 -- -bool(false) --- Iteration 13 -- -bool(false) --- Iteration 14 -- -bool(false) --- Iteration 15 -- -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -string(7) " object" --- Iteration 18 -- - -Warning: stristr() expects parameter 1 to be string, resource given in %s on line %d2 -NULL --- Iteration 19 -- -bool(false) --- Iteration 20 -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex 8e6f857b74..a546bdb8d2 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_variation10.phpt b/ext/standard/tests/strings/strncasecmp_variation10.phpt deleted file mode 100644 index 1c5708ae69..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation10.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'str1' ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected inputs for 'str1' */ - -echo "*** Testing strncasecmp() function: with unexpected values for 'str1' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncasecmp($str1, "string", $len) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncasecmp() function: with unexpected values for 'str1' *** --- Iteration 1 -- -int(-%d) --- Iteration 2 -- -int(-%d) --- Iteration 3 -- -int(-%d) --- Iteration 4 -- -int(-%d) --- Iteration 5 -- -int(-%d) --- Iteration 6 -- -int(-%d) --- Iteration 7 -- -int(-%d) --- Iteration 8 -- -int(-%d) --- Iteration 9 -- -int(-%d) --- Iteration 10 -- -int(-%d) --- Iteration 11 -- -int(-%d) --- Iteration 12 -- -int(-%d) --- Iteration 13 -- -int(-%d) --- Iteration 14 -- -int(-%d) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line 89 -NULL --- Iteration 20 -- -int(-%d) --- Iteration 21 -- -int(-%d) --- Iteration 22 -- -int(-%d) --- Iteration 23 -- -int(-%d) --- Iteration 24 -- -int(-%d) --- Iteration 25 -- -int(-%d) --- Iteration 26 -- -int(-%d) --- Iteration 27 -- -int(-%d) --- Iteration 28 -- -int(-%d) --- Iteration 29 -- -int(-%d) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line 88 - -Warning: strncasecmp() expects parameter 1 to be string, resource given in %s on line 89 -NULL --- Iteration 31 -- -int(-%d) -*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation11.phpt b/ext/standard/tests/strings/strncasecmp_variation11.phpt deleted file mode 100644 index 362bbf1167..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation11.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'str2' ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected inputs for 'str2' */ - -echo "*** Testing strncasecmp() function: with unexpected values for 'str2' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $str2 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncasecmp("string", $str2, $len) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncasecmp() function: with unexpected values for 'str2' *** --- Iteration 1 -- -int(%d) --- Iteration 2 -- -int(%d) --- Iteration 3 -- -int(%d) --- Iteration 4 -- -int(%d) --- Iteration 5 -- -int(%d) --- Iteration 6 -- -int(%d) --- Iteration 7 -- -int(%d) --- Iteration 8 -- -int(%d) --- Iteration 9 -- -int(%d) --- Iteration 10 -- -int(%d) --- Iteration 11 -- -int(%d) --- Iteration 12 -- -int(%d) --- Iteration 13 -- -int(%d) --- Iteration 14 -- -int(%d) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 20 -- -int(%d) --- Iteration 21 -- -int(%d) --- Iteration 22 -- -int(%d) --- Iteration 23 -- -int(%d) --- Iteration 24 -- -int(%d) --- Iteration 25 -- -int(%d) --- Iteration 26 -- -int(%d) --- Iteration 27 -- -int(%d) --- Iteration 28 -- -int(%d) --- Iteration 29 -- -int(%d) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d - -Warning: strncasecmp() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 31 -- -int(4) -*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation4.phpt b/ext/standard/tests/strings/strncasecmp_variation4.phpt deleted file mode 100644 index 93968db2da..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation4.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'str1' & 'str2' ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected inputs for 'str1' and 'str2' */ - -echo "*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $str2 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncasecmp($str1, $str2, $len) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' *** --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- -int(0) --- Iteration 9 -- -int(0) --- Iteration 10 -- -int(0) --- Iteration 11 -- -int(0) --- Iteration 12 -- -int(0) --- Iteration 13 -- -int(0) --- Iteration 14 -- -int(0) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 20 -- -int(0) --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) --- Iteration 23 -- -int(0) --- Iteration 24 -- -int(0) --- Iteration 25 -- -int(0) --- Iteration 26 -- -int(0) --- Iteration 27 -- -int(0) --- Iteration 28 -- -int(0) --- Iteration 29 -- -int(0) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d - -Warning: strncasecmp() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 31 -- -int(0) -*** Done *** diff --git a/ext/standard/tests/strings/strncasecmp_variation5.phpt b/ext/standard/tests/strings/strncasecmp_variation5.phpt deleted file mode 100644 index 44a58f78e1..0000000000 --- a/ext/standard/tests/strings/strncasecmp_variation5.phpt +++ /dev/null @@ -1,165 +0,0 @@ ---TEST-- -Test strncasecmp() function : usage variations - unexpected values for 'len' ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : int strncasecmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-insensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncasecmp() function with the unexpected values, and giving the same strings for 'str1' and 'str2' */ - -echo "*** Test strncasecmp() function: unexpected values for 'len' ***\n"; - -/* definition of required variables */ -$str1 = "Hello, World\n"; -$str2 = "Hello, World\n"; - -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$lengths = array ( - - /* float values */ - 10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - - /* octal values */ - 012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - @$undefined_var, - - /* unset variable */ - @$unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncasecmp() */ -$counter = 1; -for($index = 0; $index < count($lengths); $index ++) { - $len = $lengths[$index]; - echo "-- Iteration $counter --\n"; - var_dump( strncasecmp($str1, $str2, $len) ); - $counter ++; -} -fclose($file_handle); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Test strncasecmp() function: unexpected values for 'len' *** --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 10 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strncasecmp() expects parameter 3 to be int, array given in %s on line %d -NULL --- Iteration 13 -- -int(0) --- Iteration 14 -- -int(0) --- Iteration 15 -- -int(0) --- Iteration 16 -- -int(0) --- Iteration 17 -- -int(0) --- Iteration 18 -- -int(0) --- Iteration 19 -- - -Warning: strncasecmp() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: strncasecmp() expects parameter 3 to be int, string given in %s on line %d -NULL --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) --- Iteration 23 -- - -Warning: strncasecmp() expects parameter 3 to be int, resource given in %s on line %d -NULL --- Iteration 24 -- - -Warning: strncasecmp() expects parameter 3 to be int, object given in %s on line %d -NULL -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation4.phpt b/ext/standard/tests/strings/strncmp_variation4.phpt deleted file mode 100644 index 5e96e5d16f..0000000000 --- a/ext/standard/tests/strings/strncmp_variation4.phpt +++ /dev/null @@ -1,192 +0,0 @@ ---TEST-- -Test strncmp() function : usage variations - different inputs(all types) ---FILE-- -<?php -/* Prototype : int strncmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-sensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncmp() function with the input strings are of all types */ - -echo "*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' ***\n"; -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$values = array ( - /* integer values */ - 0, - 1, - 12345, - -2345, - - /* float values */ - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - -0x12, - - /* octal values */ - 012, - -012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - $undefined_var, - - /* unset variable */ - $unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncmp() */ -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str1 = $values[$index]; - $str2 = $values[$index]; - $len = strlen($values[$index]) + 1; - var_dump( strncmp($str1, $str2, $len) ); - $counter ++; -} -fclose($file_handle); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- -int(0) --- Iteration 9 -- -int(0) --- Iteration 10 -- -int(0) --- Iteration 11 -- -int(0) --- Iteration 12 -- -int(0) --- Iteration 13 -- -int(0) --- Iteration 14 -- -int(0) --- Iteration 15 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 16 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 20 -- -int(0) --- Iteration 21 -- -int(0) --- Iteration 22 -- -int(0) --- Iteration 23 -- -int(0) --- Iteration 24 -- -int(0) --- Iteration 25 -- -int(0) --- Iteration 26 -- -int(0) --- Iteration 27 -- -int(0) --- Iteration 28 -- -int(0) --- Iteration 29 -- -int(0) --- Iteration 30 -- - -Warning: strlen() expects parameter 1 to be string, resource given in %s on line %d - -Warning: strncmp() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 31 -- -int(0) -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation5.phpt b/ext/standard/tests/strings/strncmp_variation5.phpt deleted file mode 100644 index 85e50f5929..0000000000 --- a/ext/standard/tests/strings/strncmp_variation5.phpt +++ /dev/null @@ -1,179 +0,0 @@ ---TEST-- -Test strncmp() function : usage variations - different lengths(all types) ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); ---FILE-- -<?php -/* Prototype : int strncmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-sensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncmp() function with the length as all types, and giving the same strings for 'str1' and 'str2' */ - -echo "*** Test strncmp() function: by supplying all types for 'len' ***\n"; - -/* definition of required variables */ -$str1 = "Hello, World\n"; -$str2 = "Hello, World\n"; - -/* get an unset variable */ -$unset_var = 'string_val'; -unset($unset_var); - -/* get resource handle */ -$file_handle = fopen(__FILE__, "r"); - -/* declaring a class */ -class sample { - public function __toString() { - return "object"; - } -} - - -/* array with different values */ -$lengths = array ( - /* integer values */ - 0, - 1, - 12345, - - /* float values */ - 10.5, - 10.5e10, - 10.6E-10, - .5, - - /* hexadecimal values */ - 0x12, - - /* octal values */ - 012, - 01.2, - - /* array values */ - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - /* boolean values */ - true, - false, - TRUE, - FALSE, - - /* nulls */ - NULL, - null, - - /* empty string */ - "", - '', - - /* undefined variable */ - $undefined_var, - - /* unset variable */ - $unset_var, - - /* resource */ - $file_handle, - - /* object */ - new sample() -); - -/* loop through each element of the array and check the working of strncmp() */ -$counter = 1; -for($index = 0; $index < count($lengths); $index ++) { - $len = $lengths[$index]; - echo "-- Iteration $counter --\n"; - var_dump( strncmp($str1, $str2, $len) ); - $counter ++; -} -fclose($file_handle); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Test strncmp() function: by supplying all types for 'len' *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d --- Iteration 1 -- -int(0) --- Iteration 2 -- -int(0) --- Iteration 3 -- -int(0) --- Iteration 4 -- -int(0) --- Iteration 5 -- -int(0) --- Iteration 6 -- -int(0) --- Iteration 7 -- -int(0) --- Iteration 8 -- -int(0) --- Iteration 9 -- -int(0) --- Iteration 10 -- -int(0) --- Iteration 11 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 12 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 13 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 14 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 15 -- - -Warning: strncmp() expects parameter 3 to be int, array given in%s on line %d -NULL --- Iteration 16 -- -int(0) --- Iteration 17 -- -int(0) --- Iteration 18 -- -int(0) --- Iteration 19 -- -int(0) --- Iteration 20 -- -int(0) --- Iteration 21 -- -int(0) --- Iteration 22 -- - -Warning: strncmp() expects parameter 3 to be int, string given in%s on line %d -NULL --- Iteration 23 -- - -Warning: strncmp() expects parameter 3 to be int, string given in%s on line %d -NULL --- Iteration 24 -- -int(0) --- Iteration 25 -- -int(0) --- Iteration 26 -- - -Warning: strncmp() expects parameter 3 to be int, resource given in%s on line %d -NULL --- Iteration 27 -- - -Warning: strncmp() expects parameter 3 to be int, object given in%s on line %d -NULL -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation6.phpt b/ext/standard/tests/strings/strncmp_variation6.phpt deleted file mode 100644 index f71119faf5..0000000000 --- a/ext/standard/tests/strings/strncmp_variation6.phpt +++ /dev/null @@ -1,811 +0,0 @@ ---TEST-- -Test strncmp() function : usage variations - binary safe(binary values) ---FILE-- -<?php -/* Prototype : int strncmp ( string $str1, string $str2, int $len ); - * Description: Binary safe case-sensitive string comparison of the first n characters - * Source code: Zend/zend_builtin_functions.c -*/ - -/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */ - -echo "*** Test strncmp() function: with binary inputs ***\n"; - -echo "\n-- Checking with all 256 characters given, in binary format --\n"; -/* A binary function should work with all 256 characters that a character(8-bit) can take */ -/* loop through to get all 256 character's equivalent binary value, and check working of strncmp() */ -$count = 1; -for($ASCII = 0; $ASCII <= 255; $ASCII++) { - $str1 = decbin($ASCII); //ASCII value in binary form - $str2 = decbin( ord( chr($ASCII) ) ); //Getting equivalent ASCII value for the character in binary form - echo "-- Iteration $count --\n"; - var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0) - var_dump( strncmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0) - $count++; -} - -echo "\n-- Checking with out of character's range, given in binary format --\n"; -/* Checking with the out of range ASCII value(given in binary format) */ -$str1 = decbin(256); -$str2 = decbin( ord( chr(256) )); -var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1) - -echo "\n*** Done ***\n"; -?> ---EXPECT-- -*** Test strncmp() function: with binary inputs *** - --- Checking with all 256 characters given, in binary format -- --- Iteration 1 -- -int(0) -int(0) --- Iteration 2 -- -int(0) -int(0) --- Iteration 3 -- -int(0) -int(0) --- Iteration 4 -- -int(0) -int(0) --- Iteration 5 -- -int(0) -int(0) --- Iteration 6 -- -int(0) -int(0) --- Iteration 7 -- -int(0) -int(0) --- Iteration 8 -- -int(0) -int(0) --- Iteration 9 -- -int(0) -int(0) --- Iteration 10 -- -int(0) -int(0) --- Iteration 11 -- -int(0) -int(0) --- Iteration 12 -- -int(0) -int(0) --- Iteration 13 -- -int(0) -int(0) --- Iteration 14 -- -int(0) -int(0) --- Iteration 15 -- -int(0) -int(0) --- Iteration 16 -- -int(0) -int(0) --- Iteration 17 -- -int(0) -int(0) --- Iteration 18 -- -int(0) -int(0) --- Iteration 19 -- -int(0) -int(0) --- Iteration 20 -- -int(0) -int(0) --- Iteration 21 -- -int(0) -int(0) --- Iteration 22 -- -int(0) -int(0) --- Iteration 23 -- -int(0) -int(0) --- Iteration 24 -- -int(0) -int(0) --- Iteration 25 -- -int(0) -int(0) --- Iteration 26 -- -int(0) -int(0) --- Iteration 27 -- -int(0) -int(0) --- Iteration 28 -- -int(0) -int(0) --- Iteration 29 -- -int(0) -int(0) --- Iteration 30 -- -int(0) -int(0) --- Iteration 31 -- -int(0) -int(0) --- Iteration 32 -- -int(0) -int(0) --- Iteration 33 -- -int(0) -int(0) --- Iteration 34 -- -int(0) -int(0) --- Iteration 35 -- -int(0) -int(0) --- Iteration 36 -- -int(0) -int(0) --- Iteration 37 -- -int(0) -int(0) --- Iteration 38 -- -int(0) -int(0) --- Iteration 39 -- -int(0) -int(0) --- Iteration 40 -- -int(0) -int(0) --- Iteration 41 -- -int(0) -int(0) --- Iteration 42 -- -int(0) -int(0) --- Iteration 43 -- -int(0) -int(0) --- Iteration 44 -- -int(0) -int(0) --- Iteration 45 -- -int(0) -int(0) --- Iteration 46 -- -int(0) -int(0) --- Iteration 47 -- -int(0) -int(0) --- Iteration 48 -- -int(0) -int(0) --- Iteration 49 -- -int(0) -int(0) --- Iteration 50 -- -int(0) -int(0) --- Iteration 51 -- -int(0) -int(0) --- Iteration 52 -- -int(0) -int(0) --- Iteration 53 -- -int(0) -int(0) --- Iteration 54 -- -int(0) -int(0) --- Iteration 55 -- -int(0) -int(0) --- Iteration 56 -- -int(0) -int(0) --- Iteration 57 -- -int(0) -int(0) --- Iteration 58 -- -int(0) -int(0) --- Iteration 59 -- -int(0) -int(0) --- Iteration 60 -- -int(0) -int(0) --- Iteration 61 -- -int(0) -int(0) --- Iteration 62 -- -int(0) -int(0) --- Iteration 63 -- -int(0) -int(0) --- Iteration 64 -- -int(0) -int(0) --- Iteration 65 -- -int(0) -int(0) --- Iteration 66 -- -int(0) -int(0) --- Iteration 67 -- -int(0) -int(0) --- Iteration 68 -- -int(0) -int(0) --- Iteration 69 -- -int(0) -int(0) --- Iteration 70 -- -int(0) -int(0) --- Iteration 71 -- -int(0) -int(0) --- Iteration 72 -- -int(0) -int(0) --- Iteration 73 -- -int(0) -int(0) --- Iteration 74 -- -int(0) -int(0) --- Iteration 75 -- -int(0) -int(0) --- Iteration 76 -- -int(0) -int(0) --- Iteration 77 -- -int(0) -int(0) --- Iteration 78 -- -int(0) -int(0) --- Iteration 79 -- -int(0) -int(0) --- Iteration 80 -- -int(0) -int(0) --- Iteration 81 -- -int(0) -int(0) --- Iteration 82 -- -int(0) -int(0) --- Iteration 83 -- -int(0) -int(0) --- Iteration 84 -- -int(0) -int(0) --- Iteration 85 -- -int(0) -int(0) --- Iteration 86 -- -int(0) -int(0) --- Iteration 87 -- -int(0) -int(0) --- Iteration 88 -- -int(0) -int(0) --- Iteration 89 -- -int(0) -int(0) --- Iteration 90 -- -int(0) -int(0) --- Iteration 91 -- -int(0) -int(0) --- Iteration 92 -- -int(0) -int(0) --- Iteration 93 -- -int(0) -int(0) --- Iteration 94 -- -int(0) -int(0) --- Iteration 95 -- -int(0) -int(0) --- Iteration 96 -- -int(0) -int(0) --- Iteration 97 -- -int(0) -int(0) --- Iteration 98 -- -int(0) -int(0) --- Iteration 99 -- -int(0) -int(0) --- Iteration 100 -- -int(0) -int(0) --- Iteration 101 -- -int(0) -int(0) --- Iteration 102 -- -int(0) -int(0) --- Iteration 103 -- -int(0) -int(0) --- Iteration 104 -- -int(0) -int(0) --- Iteration 105 -- -int(0) -int(0) --- Iteration 106 -- -int(0) -int(0) --- Iteration 107 -- -int(0) -int(0) --- Iteration 108 -- -int(0) -int(0) --- Iteration 109 -- -int(0) -int(0) --- Iteration 110 -- -int(0) -int(0) --- Iteration 111 -- -int(0) -int(0) --- Iteration 112 -- -int(0) -int(0) --- Iteration 113 -- -int(0) -int(0) --- Iteration 114 -- -int(0) -int(0) --- Iteration 115 -- -int(0) -int(0) --- Iteration 116 -- -int(0) -int(0) --- Iteration 117 -- -int(0) -int(0) --- Iteration 118 -- -int(0) -int(0) --- Iteration 119 -- -int(0) -int(0) --- Iteration 120 -- -int(0) -int(0) --- Iteration 121 -- -int(0) -int(0) --- Iteration 122 -- -int(0) -int(0) --- Iteration 123 -- -int(0) -int(0) --- Iteration 124 -- -int(0) -int(0) --- Iteration 125 -- -int(0) -int(0) --- Iteration 126 -- -int(0) -int(0) --- Iteration 127 -- -int(0) -int(0) --- Iteration 128 -- -int(0) -int(0) --- Iteration 129 -- -int(0) -int(0) --- Iteration 130 -- -int(0) -int(0) --- Iteration 131 -- -int(0) -int(0) --- Iteration 132 -- -int(0) -int(0) --- Iteration 133 -- -int(0) -int(0) --- Iteration 134 -- -int(0) -int(0) --- Iteration 135 -- -int(0) -int(0) --- Iteration 136 -- -int(0) -int(0) --- Iteration 137 -- -int(0) -int(0) --- Iteration 138 -- -int(0) -int(0) --- Iteration 139 -- -int(0) -int(0) --- Iteration 140 -- -int(0) -int(0) --- Iteration 141 -- -int(0) -int(0) --- Iteration 142 -- -int(0) -int(0) --- Iteration 143 -- -int(0) -int(0) --- Iteration 144 -- -int(0) -int(0) --- Iteration 145 -- -int(0) -int(0) --- Iteration 146 -- -int(0) -int(0) --- Iteration 147 -- -int(0) -int(0) --- Iteration 148 -- -int(0) -int(0) --- Iteration 149 -- -int(0) -int(0) --- Iteration 150 -- -int(0) -int(0) --- Iteration 151 -- -int(0) -int(0) --- Iteration 152 -- -int(0) -int(0) --- Iteration 153 -- -int(0) -int(0) --- Iteration 154 -- -int(0) -int(0) --- Iteration 155 -- -int(0) -int(0) --- Iteration 156 -- -int(0) -int(0) --- Iteration 157 -- -int(0) -int(0) --- Iteration 158 -- -int(0) -int(0) --- Iteration 159 -- -int(0) -int(0) --- Iteration 160 -- -int(0) -int(0) --- Iteration 161 -- -int(0) -int(0) --- Iteration 162 -- -int(0) -int(0) --- Iteration 163 -- -int(0) -int(0) --- Iteration 164 -- -int(0) -int(0) --- Iteration 165 -- -int(0) -int(0) --- Iteration 166 -- -int(0) -int(0) --- Iteration 167 -- -int(0) -int(0) --- Iteration 168 -- -int(0) -int(0) --- Iteration 169 -- -int(0) -int(0) --- Iteration 170 -- -int(0) -int(0) --- Iteration 171 -- -int(0) -int(0) --- Iteration 172 -- -int(0) -int(0) --- Iteration 173 -- -int(0) -int(0) --- Iteration 174 -- -int(0) -int(0) --- Iteration 175 -- -int(0) -int(0) --- Iteration 176 -- -int(0) -int(0) --- Iteration 177 -- -int(0) -int(0) --- Iteration 178 -- -int(0) -int(0) --- Iteration 179 -- -int(0) -int(0) --- Iteration 180 -- -int(0) -int(0) --- Iteration 181 -- -int(0) -int(0) --- Iteration 182 -- -int(0) -int(0) --- Iteration 183 -- -int(0) -int(0) --- Iteration 184 -- -int(0) -int(0) --- Iteration 185 -- -int(0) -int(0) --- Iteration 186 -- -int(0) -int(0) --- Iteration 187 -- -int(0) -int(0) --- Iteration 188 -- -int(0) -int(0) --- Iteration 189 -- -int(0) -int(0) --- Iteration 190 -- -int(0) -int(0) --- Iteration 191 -- -int(0) -int(0) --- Iteration 192 -- -int(0) -int(0) --- Iteration 193 -- -int(0) -int(0) --- Iteration 194 -- -int(0) -int(0) --- Iteration 195 -- -int(0) -int(0) --- Iteration 196 -- -int(0) -int(0) --- Iteration 197 -- -int(0) -int(0) --- Iteration 198 -- -int(0) -int(0) --- Iteration 199 -- -int(0) -int(0) --- Iteration 200 -- -int(0) -int(0) --- Iteration 201 -- -int(0) -int(0) --- Iteration 202 -- -int(0) -int(0) --- Iteration 203 -- -int(0) -int(0) --- Iteration 204 -- -int(0) -int(0) --- Iteration 205 -- -int(0) -int(0) --- Iteration 206 -- -int(0) -int(0) --- Iteration 207 -- -int(0) -int(0) --- Iteration 208 -- -int(0) -int(0) --- Iteration 209 -- -int(0) -int(0) --- Iteration 210 -- -int(0) -int(0) --- Iteration 211 -- -int(0) -int(0) --- Iteration 212 -- -int(0) -int(0) --- Iteration 213 -- -int(0) -int(0) --- Iteration 214 -- -int(0) -int(0) --- Iteration 215 -- -int(0) -int(0) --- Iteration 216 -- -int(0) -int(0) --- Iteration 217 -- -int(0) -int(0) --- Iteration 218 -- -int(0) -int(0) --- Iteration 219 -- -int(0) -int(0) --- Iteration 220 -- -int(0) -int(0) --- Iteration 221 -- -int(0) -int(0) --- Iteration 222 -- -int(0) -int(0) --- Iteration 223 -- -int(0) -int(0) --- Iteration 224 -- -int(0) -int(0) --- Iteration 225 -- -int(0) -int(0) --- Iteration 226 -- -int(0) -int(0) --- Iteration 227 -- -int(0) -int(0) --- Iteration 228 -- -int(0) -int(0) --- Iteration 229 -- -int(0) -int(0) --- Iteration 230 -- -int(0) -int(0) --- Iteration 231 -- -int(0) -int(0) --- Iteration 232 -- -int(0) -int(0) --- Iteration 233 -- -int(0) -int(0) --- Iteration 234 -- -int(0) -int(0) --- Iteration 235 -- -int(0) -int(0) --- Iteration 236 -- -int(0) -int(0) --- Iteration 237 -- -int(0) -int(0) --- Iteration 238 -- -int(0) -int(0) --- Iteration 239 -- -int(0) -int(0) --- Iteration 240 -- -int(0) -int(0) --- Iteration 241 -- -int(0) -int(0) --- Iteration 242 -- -int(0) -int(0) --- Iteration 243 -- -int(0) -int(0) --- Iteration 244 -- -int(0) -int(0) --- Iteration 245 -- -int(0) -int(0) --- Iteration 246 -- -int(0) -int(0) --- Iteration 247 -- -int(0) -int(0) --- Iteration 248 -- -int(0) -int(0) --- Iteration 249 -- -int(0) -int(0) --- Iteration 250 -- -int(0) -int(0) --- Iteration 251 -- -int(0) -int(0) --- Iteration 252 -- -int(0) -int(0) --- Iteration 253 -- -int(0) -int(0) --- Iteration 254 -- -int(0) -int(0) --- Iteration 255 -- -int(0) -int(0) --- Iteration 256 -- -int(0) -int(0) - --- Checking with out of character's range, given in binary format -- -int(1) - -*** Done *** diff --git a/ext/standard/tests/strings/strncmp_variation9.phpt b/ext/standard/tests/strings/strncmp_variation9.phpt index 1c83e80f09..194642fad4 100644 --- a/ext/standard/tests/strings/strncmp_variation9.phpt +++ b/ext/standard/tests/strings/strncmp_variation9.phpt @@ -22,7 +22,7 @@ EOD; $str2 = <<<identifier_str2 Example of heredoc string, whose identifier -having underscore("_") +having underscore("_") & numeric value. identifier_str2; diff --git a/ext/standard/tests/strings/strrchr_variation9.phpt b/ext/standard/tests/strings/strrchr_variation9.phpt deleted file mode 100644 index 760bfa6067..0000000000 --- a/ext/standard/tests/strings/strrchr_variation9.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -Test strrchr() function : usage variations - unexpected inputs for haystack ---FILE-- -<?php -/* Prototype : string strrchr(string $haystack, string $needle); - * Description: Finds the last occurrence of a character in a string. - * Source code: ext/standard/string.c -*/ - -/* Test strrchr() function with unexpected inputs for haystack - * and expected type for 'needle' -*/ - -echo "*** Testing strrchr() function: with unexpected inputs for haystack ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$haystacks = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // null values - NULL, - null, - - // objects - new sample(), - - // empty string - "", - '', - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -$needles = array ( - //integer numeric strings - "0", - "1", - "2", - "-2", - - //float numeric strings - "10.5", - "-10.5", - "10.5e10", - "10.6E-10", - ".5", - - //regular strings - "array", - "a", - "r", - "y", - "ay", - "true", - "false", - "TRUE", - "FALSE", - "NULL", - "null", - "object", - - //empty string - "", - '', - - //resource variable in string form - "\$file_handle", - - //undefined variable in string form - @"$undefined_var", - @"$unset_var" -); - -// loop through each element of the array and check the working of strrchr() -$count = 1; -for($index = 0; $index < count($haystacks); $index++) { - echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrchr() function: with unexpected inputs for haystack *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(4) "2345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(12) "105000000000" --- Iteration 8 -- -string(7) "1.06E-9" --- Iteration 9 -- -string(2) ".5" --- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -bool(false) --- Iteration 20 -- -bool(false) --- Iteration 21 -- -string(6) "object" --- Iteration 22 -- -bool(false) --- Iteration 23 -- -bool(false) --- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -bool(false) --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrev_variation4.phpt b/ext/standard/tests/strings/strrev_variation4.phpt deleted file mode 100644 index b585035c11..0000000000 --- a/ext/standard/tests/strings/strrev_variation4.phpt +++ /dev/null @@ -1,182 +0,0 @@ ---TEST-- -Test strrev() function : usage variations - unexpected inputs ---FILE-- -<?php -/* Prototype : string strrev(string $str); - * Description: Reverse a string - * Source code: ext/standard/string.c -*/ - -/* Testing strrev() function with unexpected inputs for 'str' */ - -echo "*** Testing strrev() : unexpected inputs for 'str' ***\n"; -//class declaration -class sample { - public function __toString(){ - return "object"; - } -} - -//get the resource -$resource = fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // resource - $resource, - - // undefined data - @$undefined_var, - - // unset data - @$unset_var -); - -// loop through each element of the array for str - -$count = 1; -foreach($values as $value) { - echo "\n-- Iterator $count --\n"; - var_dump( strrev($value) ); - $count++; -}; - -fclose($resource); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrev() : unexpected inputs for 'str' *** - --- Iterator 1 -- -string(1) "0" - --- Iterator 2 -- -string(1) "1" - --- Iterator 3 -- -string(5) "54321" - --- Iterator 4 -- -string(5) "5432-" - --- Iterator 5 -- -string(4) "5.01" - --- Iterator 6 -- -string(5) "5.01-" - --- Iterator 7 -- -string(12) "000000000501" - --- Iterator 8 -- -string(7) "9-E60.1" - --- Iterator 9 -- -string(3) "5.0" - --- Iterator 10 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 11 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 12 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 13 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 14 -- - -Warning: strrev() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iterator 15 -- -string(0) "" - --- Iterator 16 -- -string(0) "" - --- Iterator 17 -- -string(1) "1" - --- Iterator 18 -- -string(0) "" - --- Iterator 19 -- -string(1) "1" - --- Iterator 20 -- -string(0) "" - --- Iterator 21 -- -string(0) "" - --- Iterator 22 -- -string(0) "" - --- Iterator 23 -- -string(6) "tcejbo" - --- Iterator 24 -- - -Warning: strrev() expects parameter 1 to be string, resource given in %s on line %d -NULL - --- Iterator 25 -- -string(0) "" - --- Iterator 26 -- -string(0) "" -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt deleted file mode 100644 index db4a0590d0..0000000000 --- a/ext/standard/tests/strings/strrpos_variation14.phpt +++ /dev/null @@ -1,155 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'offset' argument ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for 'offset' argument */ - -echo "*** Testing strrpos() function: with unexpected values for offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//definition of input args -$haystack = "hello world"; -$needle = "world"; - -// array with different values -$offsets = array ( - - // float values - 1.5, - -1.5, - 1.5e10, - 1.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($offsets); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needle, $offsets[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function: with unexpected values for offset *** --- Iteration 1 -- -int(6) --- Iteration 2 -- -int(6) --- Iteration 3 -- - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) --- Iteration 4 -- -int(6) --- Iteration 5 -- -int(6) --- Iteration 6 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 9 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: strrpos() expects parameter 3 to be int, array given in %s on line %d -bool(false) --- Iteration 11 -- -int(6) --- Iteration 12 -- -int(6) --- Iteration 13 -- -int(6) --- Iteration 14 -- -int(6) --- Iteration 15 -- - -Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d -bool(false) --- Iteration 16 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 17 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 18 -- -int(6) --- Iteration 19 -- -int(6) --- Iteration 20 -- - -Warning: strrpos() expects parameter 3 to be int, resource given in %s on line %d -bool(false) --- Iteration 21 -- -int(6) --- Iteration 22 -- -int(6) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation9.phpt b/ext/standard/tests/strings/strrpos_variation9.phpt deleted file mode 100644 index 576d5b41e4..0000000000 --- a/ext/standard/tests/strings/strrpos_variation9.phpt +++ /dev/null @@ -1,184 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack' argument ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for haystack argument */ - -echo "*** Testing strrpos() function with unexpected values for haystack ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$haystacks = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($haystacks); $index ++) { - echo "\n-- Iteration $counter --\n"; - var_dump( strrpos($haystacks[$index], $needle) ); - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function with unexpected values for haystack *** - --- Iteration 1 -- -bool(false) - --- Iteration 2 -- -bool(false) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -bool(false) - --- Iteration 6 -- -bool(false) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -bool(false) - --- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 15 -- -bool(false) - --- Iteration 16 -- -bool(false) - --- Iteration 17 -- -bool(false) - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- -bool(false) - --- Iteration 20 -- -bool(false) - --- Iteration 21 -- -bool(false) - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- -bool(false) - --- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - --- Iteration 25 -- -bool(false) - --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strspn_variation1.phpt b/ext/standard/tests/strings/strspn_variation1.phpt deleted file mode 100644 index db6e8f9a15..0000000000 --- a/ext/standard/tests/strings/strspn_variation1.phpt +++ /dev/null @@ -1,273 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with different unexpected values for str argument -*/ - -echo "*** Testing strspn() : with unexpected values for str argument ***\n"; - -// Initialise function arguments not being substititued (if any) -$mask = 'abons1234567890'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample, - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\n-- Iteration with str value as \"$value\"\n"; - var_dump( strspn($value,$mask) ); // with default args - var_dump( strspn($value,$mask,$start) ); // with default len value - var_dump( strspn($value,$mask,$start,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with unexpected values for str argument *** - --- Iteration with str value as "0" -int(1) -int(0) -int(0) - --- Iteration with str value as "1" -int(1) -int(0) -int(0) - --- Iteration with str value as "12345" -int(5) -int(4) -int(4) - --- Iteration with str value as "-2345" -int(0) -int(4) -int(4) - --- Iteration with str value as "10.5" -int(2) -int(1) -int(1) - --- Iteration with str value as "-10.5" -int(0) -int(2) -int(2) - --- Iteration with str value as "101234567000" -int(12) -int(11) -int(10) - --- Iteration with str value as "1.07654321E-9" -int(1) -int(0) -int(0) - --- Iteration with str value as "0.5" -int(1) -int(0) -int(0) - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "Array" - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(1) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "1" -int(1) -int(0) -int(0) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "object" -int(2) -int(1) -int(1) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "" -int(0) -bool(false) -bool(false) - --- Iteration with str value as "Resource id #%d" - -Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strspn_variation2.phpt b/ext/standard/tests/strings/strspn_variation2.phpt deleted file mode 100644 index 1d31a1c802..0000000000 --- a/ext/standard/tests/strings/strspn_variation2.phpt +++ /dev/null @@ -1,272 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values for mask argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with different unexpected values for mask argument -*/ - -echo "*** Testing strspn() : with different unexpected values of mask argument ***\n"; - -$str = 'string_val'; -$start = 1; -$len = 10; - - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for mask - -foreach($values as $value) { - echo "\n-- Iteration with mask value as \"$value\" --\n"; - var_dump( strspn($str,$value) ); // with defalut args - var_dump( strspn($str,$value,$start) ); // with default len value - var_dump( strspn($str,$value,$start,$len) ); // with all args -}; - -// close the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with different unexpected values of mask argument *** - --- Iteration with mask value as "0" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "12345" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "-2345" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "10.5" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "-10.5" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "101234567000" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1.07654321E-9" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "0.5" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "Array" -- - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, array given in %s on line %d -NULL - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "1" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "object" -- -int(0) -int(1) -int(1) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "" -- -int(0) -int(0) -int(0) - --- Iteration with mask value as "Resource id #%d" -- - -Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strspn_variation3.phpt b/ext/standard/tests/strings/strspn_variation3.phpt deleted file mode 100644 index 76f11acc26..0000000000 --- a/ext/standard/tests/strings/strspn_variation3.phpt +++ /dev/null @@ -1,243 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values of start argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with unexpected values of start argument -*/ - -echo "*** Testing strspn() : with unexpected values of start argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$len = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with start value as \"$value\" --\n"; - var_dump( strspn($str,$mask,$value) ); // with default len value - var_dump( strspn($str,$mask,$value,$len) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with unexpected values of start argument *** - --- Iteration with start value as "10.5" -- -int(0) -int(0) - --- Iteration with start value as "-10.5" -- -int(2) -int(2) - --- Iteration with start value as "1012345670" -- -bool(false) -bool(false) - --- Iteration with start value as "1.07654321E-7" -- -int(2) -int(2) - --- Iteration with start value as "0.5" -- -int(2) -int(2) - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "Array" -- - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, array given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "1" -- -int(1) -int(1) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "1" -- -int(1) -int(1) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "string" -- - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, string given in %s on line %d -NULL - --- Iteration with start value as "object" -- - -Warning: strspn() expects parameter 3 to be int, object given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, object given in %s on line %d -NULL - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "" -- -int(2) -int(2) - --- Iteration with start value as "Resource id #%d" -- - -Warning: strspn() expects parameter 3 to be int, resource given in %s on line %d -NULL - -Warning: strspn() expects parameter 3 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strspn_variation4.phpt b/ext/standard/tests/strings/strspn_variation4.phpt deleted file mode 100644 index 858a4fb608..0000000000 --- a/ext/standard/tests/strings/strspn_variation4.phpt +++ /dev/null @@ -1,196 +0,0 @@ ---TEST-- -Test strspn() function : usage variations - unexpected values of len argument ---FILE-- -<?php -/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) - * Description: Finds length of initial segment consisting entirely of characters found in mask. - If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) - * Source code: ext/standard/string.c - * Alias to functions: none -*/ - -error_reporting(E_ALL & ~E_NOTICE); - -/* -* Testing strspn() : with unexpected values of len argument -*/ - -echo "*** Testing strspn() : with unexpected values of len argument ***\n"; - -// initialing required variables -$str = 'string_val'; -$mask = 'soibtFTf1234567890'; -$start = 0; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample { - public function __toString() { - return "object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e8, - 10.7654321E-8, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new sample(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, - - // resource - $file_handle -); - -// loop through each element of the array for start - -foreach($values as $value) { - echo "\n-- Iteration with len value as \"$value\" --\n"; - var_dump( strspn($str,$mask,$start,$value) ); // with all args -}; - -// closing the resource -fclose($file_handle); - -echo "Done" -?> ---EXPECTF-- -*** Testing strspn() : with unexpected values of len argument *** - --- Iteration with len value as "10.5" -- -int(2) - --- Iteration with len value as "-10.5" -- -int(0) - --- Iteration with len value as "1012345670" -- -int(2) - --- Iteration with len value as "1.07654321E-7" -- -int(0) - --- Iteration with len value as "0.5" -- -int(0) - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "Array" -- - -Warning: strspn() expects parameter 4 to be int, array given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(1) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "1" -- -int(1) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "string" -- - -Warning: strspn() expects parameter 4 to be int, string given in %s on line %d -NULL - --- Iteration with len value as "object" -- - -Warning: strspn() expects parameter 4 to be int, object given in %s on line %d -NULL - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "" -- -int(0) - --- Iteration with len value as "Resource id #%d" -- - -Warning: strspn() expects parameter 4 to be int, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strtok_variation1.phpt b/ext/standard/tests/strings/strtok_variation1.phpt deleted file mode 100644 index 9c46428a65..0000000000 --- a/ext/standard/tests/strings/strtok_variation1.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test strtok() function : usage variations - first argument as non-string ---FILE-- -<?php -/* Prototype : string strtok ( string $str, string $token ) - * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token - * Source code: ext/standard/string.c -*/ - -/* - * Testing strtok() : with first argument as non-string -*/ - -echo "*** Testing strtok() : with first argument as non-string ***\n"; -// initialize all required variables -$token = '-'; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj-ect"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red-color', 'item' => 'pen-color'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var, - - // resource - $file_handle -); - - -// loop through each element of the array and check the working of strtok() -// when $str argument is supplied with different values - -echo "\n--- Testing strtok() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( strtok($str, $token) ); - - $counter ++; -} - -//closing the resource -fclose($file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing strtok() : with first argument as non-string *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing strtok() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(4) "2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(4) "10.5" --- Iteration 7 -- -string(12) "101234567000" --- Iteration 8 -- -string(11) "1.07654321E" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strtok() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(3) "obj" --- Iteration 20 -- -bool(false) --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) --- Iteration 23 -- -bool(false) --- Iteration 24 -- -bool(false) --- Iteration 25 -- -bool(false) --- Iteration 26 -- - -Warning: strtok() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strtok_variation2.phpt b/ext/standard/tests/strings/strtok_variation2.phpt deleted file mode 100644 index 26de1ae0b5..0000000000 --- a/ext/standard/tests/strings/strtok_variation2.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test strtok() function : usage variations - with different token strings ---FILE-- -<?php -/* Prototype : string strtok ( str $str, str $token ) - * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token - * Source code: ext/standard/string.c -*/ - -/* - * Testing strtok() : with different token strings -*/ - -echo "*** Testing strtok() : with different token strings ***\n"; -// initialize all required variables -$str = 'this testcase test strtok() function '; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "obj-ect"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - // undefined variable - $undefined_var, - - // unset variable - $unset_var, - - // resource - $file_handle -); - - -// loop through each element of the array and check the working of strtok() -// when $token argument is supplied with different values - -echo "\n--- Testing strtok() by supplying different values for 'token' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $token = $values [$index]; - - var_dump( strtok($str, $token) ); - - $counter ++; -} - -// closing the resource -fclose($file_handle); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing strtok() : with different token strings *** - -Notice: Undefined variable: undefined_var in %s on line %d - -Notice: Undefined variable: unset_var in %s on line %d - ---- Testing strtok() by supplying different values for 'token' argument --- --- Iteration 1 -- -string(37) "this testcase test strtok() function " --- Iteration 2 -- -string(37) "this testcase test strtok() function " --- Iteration 3 -- -string(37) "this testcase test strtok() function " --- Iteration 4 -- -string(37) "this testcase test strtok() function " --- Iteration 5 -- -string(37) "this testcase test strtok() function " --- Iteration 6 -- -string(37) "this testcase test strtok() function " --- Iteration 7 -- -string(37) "this testcase test strtok() function " --- Iteration 8 -- -string(37) "this testcase test strtok() function " --- Iteration 9 -- -string(37) "this testcase test strtok() function " --- Iteration 10 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: strtok() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(37) "this testcase test strtok() function " --- Iteration 16 -- -string(37) "this testcase test strtok() function " --- Iteration 17 -- -string(37) "this testcase test strtok() function " --- Iteration 18 -- -string(37) "this testcase test strtok() function " --- Iteration 19 -- -string(4) "his " --- Iteration 20 -- -string(37) "this testcase test strtok() function " --- Iteration 21 -- -string(37) "this testcase test strtok() function " --- Iteration 22 -- -string(37) "this testcase test strtok() function " --- Iteration 23 -- -string(37) "this testcase test strtok() function " --- Iteration 24 -- -string(37) "this testcase test strtok() function " --- Iteration 25 -- -string(37) "this testcase test strtok() function " --- Iteration 26 -- - -Warning: strtok() expects parameter 2 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/strtr.phpt b/ext/standard/tests/strings/strtr.phpt index 77666ced8c..1dc1e9c4ef 100644 --- a/ext/standard/tests/strings/strtr.phpt +++ b/ext/standard/tests/strings/strtr.phpt @@ -2,7 +2,6 @@ strtr() function --FILE-- <?php -/* Do not change this test it is a README.TESTING example. */ $trans = array("hello"=>"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet"); var_dump(strtr("# hi all, I said hello world! #", $trans)); ?> diff --git a/ext/standard/tests/strings/strtr_variation5.phpt b/ext/standard/tests/strings/strtr_variation5.phpt deleted file mode 100644 index cb6ad267ad..0000000000 --- a/ext/standard/tests/strings/strtr_variation5.phpt +++ /dev/null @@ -1,139 +0,0 @@ ---TEST-- -Test strtr() function : usage variations - unexpected inputs for 'str' argument ---FILE-- -<?php -/* Prototype : string strtr(string $str, string $from[, string $to]); - string strtr(string $str, array $replace_pairs); - * Description: Translates characters in str using given translation tables - * Source code: ext/standard/string.c -*/ - -/* Test strtr() function: with unexpected inputs for 'str' - * and expected type for 'from' & 'to' arguments -*/ - -echo "*** Testing strtr() function: with unexpected inputs for 'str' ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$strings = array ( - - // integer values -/*1*/ 0, - 1, - -2, - - // float values -/*4*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*7*/ array(), - array(0), - array(1, 2), - - // boolean values -/*10*/ true, - false, - TRUE, - FALSE, - - // null values -/*14*/ NULL, - null, - - // objects -/*16*/ new sample(), - - // resource -/*17*/ $file_handle, - - // undefined variable -/*18*/ @$undefined_var, - - // unset variable -/*19*/ @$unset_var -); - -//defining 'from' argument -$from = "012atm"; - -//defining 'to' argument -$to = "atm012"; - -// loop through with each element of the $strings array to test strtr() function -$count = 1; -for($index = 0; $index < count($strings); $index++) { - echo "-- Iteration $count --\n"; - $str = $strings[$index]; - var_dump( strtr($str, $from, $to) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing strtr() function: with unexpected inputs for 'str' *** --- Iteration 1 -- -string(1) "a" --- Iteration 2 -- -string(1) "t" --- Iteration 3 -- -string(2) "-m" --- Iteration 4 -- -string(4) "ta.5" --- Iteration 5 -- -string(5) "-ma.5" --- Iteration 6 -- -string(12) "tatm34567aaa" --- Iteration 7 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 9 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 10 -- -string(1) "t" --- Iteration 11 -- -string(0) "" --- Iteration 12 -- -string(1) "t" --- Iteration 13 -- -string(0) "" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(0) "" --- Iteration 16 -- -string(13) "s02ple objec1" --- Iteration 17 -- - -Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation7.phpt b/ext/standard/tests/strings/strtr_variation7.phpt deleted file mode 100644 index 9f7cb95371..0000000000 --- a/ext/standard/tests/strings/strtr_variation7.phpt +++ /dev/null @@ -1,158 +0,0 @@ ---TEST-- -Test strtr() function : usage variations - unexpected inputs for 'to' argument ---FILE-- -<?php -/* Prototype : string strtr(string $str, string $from[, string $to]); - string strtr(string $str, array $replace_pairs); - * Description: Translates characters in str using given translation tables - * Source code: ext/standard/string.c -*/ - -/* Test strtr() function: with unexpected inputs for 'to' - * and expected types for 'str' & 'from' arguments -*/ - -echo "*** Testing strtr() function: with unexpected inputs for 'to' ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//defining 'str' argument -$str = "012atm"; - -//defining 'from' argument -$from = "atm012"; - -// array of values for 'to' argument -$to_arr = array ( - - // integer values -/*1*/ 0, - 1, - -2, - - // float values -/*4*/ 10.5, - -20.5, - 10.12345675e10, - - // array values -/*7*/ array(), - array(0), - array(1, 2), - - // boolean values -/*10*/ true, - false, - TRUE, - FALSE, - - // null values -/*14*/ NULL, - null, - - // objects -/*16*/ new sample(), - - // resource -/*17*/ $file_handle, - - // undefined variable -/*18*/ @$undefined_var, - - // unset variable -/*19*/ @$unset_var -); - -// loop through with each element of the $to array to test strtr() function -$count = 1; -for($index = 0; $index < count($to_arr); $index++) { - echo "\n-- Iteration $count --\n"; - $to = $to_arr[$index]; - var_dump( strtr($str, $from, $to) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing strtr() function: with unexpected inputs for 'to' *** - --- Iteration 1 -- -string(6) "0120tm" - --- Iteration 2 -- -string(6) "0121tm" - --- Iteration 3 -- -string(6) "012-2m" - --- Iteration 4 -- -string(6) "51210." - --- Iteration 5 -- -string(6) ".52-20" - --- Iteration 6 -- -string(6) "234101" - --- Iteration 7 -- - -Warning: strtr() expects parameter 3 to be string, array given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: strtr() expects parameter 3 to be string, array given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: strtr() expects parameter 3 to be string, array given in %s on line %d -NULL - --- Iteration 10 -- -string(6) "0121tm" - --- Iteration 11 -- -string(6) "012atm" - --- Iteration 12 -- -string(6) "0121tm" - --- Iteration 13 -- -string(6) "012atm" - --- Iteration 14 -- -string(6) "012atm" - --- Iteration 15 -- -string(6) "012atm" - --- Iteration 16 -- -string(6) "plesam" - --- Iteration 17 -- - -Warning: strtr() expects parameter 3 to be string, resource given in %s on line %d -NULL - --- Iteration 18 -- -string(6) "012atm" - --- Iteration 19 -- -string(6) "012atm" -===DONE=== diff --git a/ext/standard/tests/strings/strtr_variation9.phpt b/ext/standard/tests/strings/strtr_variation9.phpt deleted file mode 100644 index 427fde5f75..0000000000 --- a/ext/standard/tests/strings/strtr_variation9.phpt +++ /dev/null @@ -1,225 +0,0 @@ ---TEST-- -Test strtr() function : usage variations - unexpected inputs for all arguments ---FILE-- -<?php -/* Prototype : string strtr(string $str, string $from[, string $to]); - string strtr(string $str, array $replace_pairs); - * Description: Translates characters in str using given translation tables - * Source code: ext/standard/string.c -*/ - -/* Test strtr() function: with unexpected inputs for 'str', 'from', 'to' & 'replace_pairs' arguments */ - -echo "*** Testing strtr() function: with unexpected inputs for all arguments ***\n"; - -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return "sample object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values -/*1*/ 0, - 1, - -2, - - // float values -/*4*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*7*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values -/*12*/ true, - false, - TRUE, - FALSE, - - // null values -/*16*/ NULL, - null, - - // objects -/*18*/ new sample(), - - // resource -/*19*/ $file_handle, - - // undefined variable -/*20*/ @$undefined_var, - - // unset variable -/*21*/ @$unset_var -); - -// loop through with each element of the $values array to test strtr() function -$count = 1; -for($index = 0; $index < count($values); $index++) { - echo "\n-- Iteration $count --\n"; - var_dump( strtr($values[$index], $values[$index], $values[$index]) ); //fn call with three args - var_dump( strtr($values[$index], $values[$index]) ); //fn call with two args - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing strtr() function: with unexpected inputs for all arguments *** - --- Iteration 1 -- -string(1) "0" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 2 -- -string(1) "1" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 3 -- -string(2) "-2" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 4 -- -string(4) "10.5" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 5 -- -string(5) "-20.5" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 6 -- -string(12) "101234567000" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 7 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, array given in %s on line %d -NULL - --- Iteration 12 -- -string(1) "1" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 13 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 14 -- -string(1) "1" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 15 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 16 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 17 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 18 -- -string(13) "sample object" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 19 -- - -Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: strtr() expects parameter 1 to be string, resource given in %s on line %d -NULL - --- Iteration 20 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) - --- Iteration 21 -- -string(0) "" - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/trim_variation1.phpt b/ext/standard/tests/strings/trim_variation1.phpt deleted file mode 100644 index 56578fb75c..0000000000 --- a/ext/standard/tests/strings/trim_variation1.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test trim() function : usage variations - test values for $str argument ---FILE-- -<?php - -/* Prototype : string trim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning and end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing trim() function: with unexpected inputs for 'str' argument ***\n"; - -//get an unset variable -$unset_var = ' !--string_val--! '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " !---sample object---! "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test trim() function -$count = 1; -foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( trim($input, " !-") ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing trim() function: with unexpected inputs for 'str' argument *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(3) "255" --- Iteration 4 -- -string(3) "256" --- Iteration 5 -- -string(10) "2147483647" --- Iteration 6 -- -string(10) "2147483648" --- Iteration 7 -- -string(4) "10.5" --- Iteration 8 -- -string(4) "20.5" --- Iteration 9 -- -string(12) "101234567000" --- Iteration 10 -- - -Warning: trim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: trim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: trim() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(1) "1" --- Iteration 14 -- -string(0) "" --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -string(0) "" --- Iteration 17 -- -string(0) "" --- Iteration 18 -- -string(0) "" --- Iteration 19 -- -string(13) "sample object" --- Iteration 20 -- - -Warning: trim() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(0) "" --- Iteration 22 -- -string(0) "" -===DONE=== diff --git a/ext/standard/tests/strings/trim_variation2.phpt b/ext/standard/tests/strings/trim_variation2.phpt deleted file mode 100644 index d38f898862..0000000000 --- a/ext/standard/tests/strings/trim_variation2.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -Test trim() function : usage variations - test values for $charlist argument ---FILE-- -<?php - -/* Prototype : string trim ( string $str [, string $charlist ] ) - * Description: Strip whitespace (or other characters) from the beginning and end of a string. - * Source code: ext/standard/string.c -*/ - -echo "*** Testing trim() function: with unexpected inputs for 'charlist' argument ***\n"; - -//get an unset variable -$unset_var = ' string_val '; -unset($unset_var); - -//defining a class -class sample { - public function __toString() { - return " sample object "; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values for $input -$inputs = array ( - - // integer values -/*1*/ 0, - 1, - 255, - 256, - 2147483647, - -2147483648, - - // float values -/*7*/ 10.5, - -20.5, - 10.1234567e10, - - // array values -/*10*/ array(), - array(0), - array(1, 2), - - // boolean values -/*13*/ true, - false, - TRUE, - FALSE, - - // null values -/*17*/ NULL, - null, - - // objects -/*19*/ new sample(), - - // resource -/*20*/ $file_handle, - - // undefined variable -/*21*/ @$undefined_var, - - // unset variable -/*22*/ @$unset_var -); - -// loop through with each element of the $inputs array to test trim() function -$count = 1; -foreach($inputs as $charlist) { - echo "-- Iteration $count --\n"; - // strip white space and any "minus" signs - var_dump( trim("!---Hello World---!", $charlist) ); - $count ++; -} - -fclose($file_handle); //closing the file handle - -?> -===DONE=== ---EXPECTF-- -*** Testing trim() function: with unexpected inputs for 'charlist' argument *** --- Iteration 1 -- -string(19) "!---Hello World---!" --- Iteration 2 -- -string(19) "!---Hello World---!" --- Iteration 3 -- -string(19) "!---Hello World---!" --- Iteration 4 -- -string(19) "!---Hello World---!" --- Iteration 5 -- -string(19) "!---Hello World---!" --- Iteration 6 -- -string(19) "!---Hello World---!" --- Iteration 7 -- -string(19) "!---Hello World---!" --- Iteration 8 -- -string(19) "!---Hello World---!" --- Iteration 9 -- -string(19) "!---Hello World---!" --- Iteration 10 -- - -Warning: trim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: trim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: trim() expects parameter 2 to be string, array given in %s on line %d -NULL --- Iteration 13 -- -string(19) "!---Hello World---!" --- Iteration 14 -- -string(19) "!---Hello World---!" --- Iteration 15 -- -string(19) "!---Hello World---!" --- Iteration 16 -- -string(19) "!---Hello World---!" --- Iteration 17 -- -string(19) "!---Hello World---!" --- Iteration 18 -- -string(19) "!---Hello World---!" --- Iteration 19 -- -string(19) "!---Hello World---!" --- Iteration 20 -- - -Warning: trim() expects parameter 2 to be string, resource given in %s on line %d -NULL --- Iteration 21 -- -string(19) "!---Hello World---!" --- Iteration 22 -- -string(19) "!---Hello World---!" -===DONE=== diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex 66da7a90f3..b524b45e59 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/ucwords_variation1.phpt b/ext/standard/tests/strings/ucwords_variation1.phpt deleted file mode 100644 index 1604402353..0000000000 --- a/ext/standard/tests/strings/ucwords_variation1.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -Test ucwords() function : usage variations - unexpected input values ---FILE-- -<?php -/* Prototype : string ucwords ( string $str ) - * Description: Uppercase the first character of each word in a string - * Source code: ext/standard/string.c -*/ - -/* - * Test ucwords() by passing different values including scalar and non scalar values -*/ - -echo "*** Testing ucwords() : usage variations ***\n"; -// initialize all required variables - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -$fp = fopen(__FILE__, "r"); - -class my -{ - function __toString() { - return "myString"; - } -} - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // hex values - 0x10, - 0X20, - 0xAA, - -0XF5, - - // octal values - 0123, - -0342, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new my(), - - // empty string - "", - '', - - //NULL - NULL, - null, - - // hex in string - "0x123", - '0x123', - "0xFF12", - "-0xFF12", - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var, - - // resource variable - $fp -); - -// loop through each element of the array and check the working of ucwords() -// when $str argument is supplied with different values -echo "\n--- Testing ucwords() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( ucwords($str) ); - - $counter ++; -} - -// close the file handle -fclose($fp); -echo "Done\n"; -?> ---EXPECTF-- -*** Testing ucwords() : usage variations *** - ---- Testing ucwords() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(2) "16" --- Iteration 6 -- -string(2) "32" --- Iteration 7 -- -string(3) "170" --- Iteration 8 -- -string(4) "-245" --- Iteration 9 -- -string(2) "83" --- Iteration 10 -- -string(4) "-226" --- Iteration 11 -- -string(4) "10.5" --- Iteration 12 -- -string(5) "-10.5" --- Iteration 13 -- -string(12) "101234567000" --- Iteration 14 -- -string(13) "1.07654321E-9" --- Iteration 15 -- -string(3) "0.5" --- Iteration 16 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 17 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 18 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 19 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 20 -- - -Warning: ucwords() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 21 -- -string(1) "1" --- Iteration 22 -- -string(0) "" --- Iteration 23 -- -string(1) "1" --- Iteration 24 -- -string(0) "" --- Iteration 25 -- -string(8) "MyString" --- Iteration 26 -- -string(0) "" --- Iteration 27 -- -string(0) "" --- Iteration 28 -- -string(0) "" --- Iteration 29 -- -string(0) "" --- Iteration 30 -- -string(5) "0x123" --- Iteration 31 -- -string(5) "0x123" --- Iteration 32 -- -string(6) "0xFF12" --- Iteration 33 -- -string(7) "-0xFF12" --- Iteration 34 -- -string(0) "" --- Iteration 35 -- -string(0) "" --- Iteration 36 -- - -Warning: ucwords() expects parameter 1 to be string, resource given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/strings/utf8_decode_variation1.phpt b/ext/standard/tests/strings/utf8_decode_variation1.phpt deleted file mode 100644 index 10d4f31ca4..0000000000 --- a/ext/standard/tests/strings/utf8_decode_variation1.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test utf8_decode() function : usage variations - different types for data ---FILE-- -<?php -/* Prototype : proto string utf8_decode(string data) - * Description: Converts a UTF-8 encoded string to ISO-8859-1 - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing utf8_decode() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); - -class aClass { - function __toString() { - return "Some Ascii Data"; - } -} - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new aClass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for data - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( utf8_decode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing utf8_decode() : usage variations *** - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value Some Ascii Data -string(15) "Some Ascii Data" - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/strings/utf8_encode_variation1.phpt b/ext/standard/tests/strings/utf8_encode_variation1.phpt deleted file mode 100644 index a0212ea45e..0000000000 --- a/ext/standard/tests/strings/utf8_encode_variation1.phpt +++ /dev/null @@ -1,169 +0,0 @@ ---TEST-- -Test utf8_encode() function : usage variations - <type here specifics of this variation> ---FILE-- -<?php -/* Prototype : proto string utf8_encode(string data) - * Description: Encodes an ISO-8859-1 string to UTF-8 - * Source code: ext/standard/string.c - * Alias to functions: - */ - -echo "*** Testing utf8_encode() : usage variations ***\n"; -error_reporting(E_ALL & ~E_NOTICE); - -class aClass { - function __toString() { - return "Some Ascii Data"; - } -} - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new aClass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for data - -foreach($values as $value) { - echo @"\nArg value $value \n"; - var_dump( utf8_encode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing utf8_encode() : usage variations *** - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value Array - -Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value Some Ascii Data -string(15) "Some Ascii Data" - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/strings/vfprintf_basic.phpt b/ext/standard/tests/strings/vfprintf_basic.phpt index 2843e33af5..30cd5348bf 100644 --- a/ext/standard/tests/strings/vfprintf_basic.phpt +++ b/ext/standard/tests/strings/vfprintf_basic.phpt @@ -25,7 +25,7 @@ function writeAndDump($fp, $format, $args) echo "*** Testing vfprintf() : basic functionality ***\n"; // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_basic.txt'; $fp = fopen( $file, "a+" ); // Test vfprintf() @@ -46,7 +46,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_basic.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c3c869bb4d..c56631ecd7 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error1.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with more than expected no. of arguments --\n"; @@ -31,7 +31,7 @@ fclose($fp); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error1.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error2.phpt b/ext/standard/tests/strings/vfprintf_error2.phpt index 1eb89694ec..7da28468b3 100644 --- a/ext/standard/tests/strings/vfprintf_error2.phpt +++ b/ext/standard/tests/strings/vfprintf_error2.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error2.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with less than expected no. of arguments --\n"; @@ -30,7 +30,7 @@ fclose($fp); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error2.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error3.phpt b/ext/standard/tests/strings/vfprintf_error3.phpt index dbc0d08897..8be51e1798 100644 --- a/ext/standard/tests/strings/vfprintf_error3.phpt +++ b/ext/standard/tests/strings/vfprintf_error3.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error3.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with wrong variable types as argument --\n"; @@ -39,7 +39,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error3.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 589d82c3d6..2865d42a9e 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -13,7 +13,7 @@ precision=14 */ // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; @@ -28,7 +28,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_error4.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 6358bccd1c..76422011c2 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -15,7 +15,7 @@ precision=14 echo "*** Testing vfprintf() : variation functionality ***\n"; // Open handle -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_variation1.txt'; $fp = fopen( $file, 'a+' ); $funset = fopen( __FILE__, 'r' ); @@ -59,7 +59,7 @@ fclose( $fp ); --CLEAN-- <?php -$file = 'vfprintf_test.txt'; +$file = 'vfprintf_variation1.txt'; unlink( $file ); ?> diff --git a/ext/standard/tests/strings/vprintf_error.phpt b/ext/standard/tests/strings/vprintf_error.phpt index cf25257fc5..070b1b086c 100644 --- a/ext/standard/tests/strings/vprintf_error.phpt +++ b/ext/standard/tests/strings/vprintf_error.phpt @@ -31,16 +31,16 @@ var_dump( vprintf($format, $args, $extra_arg) ); -- Testing vprintf() function with Zero arguments -- -Warning: vprintf() expects at least 1 parameter, 0 given in %s on line %d +Warning: vprintf() expects exactly 2 parameters, 0 given in %s on line %d bool(false) -- Testing vprintf() function with less than expected no. of arguments -- -Warning: Wrong parameter count for vprintf() in %s on line %d +Warning: vprintf() expects exactly 2 parameters, 1 given in %s on line %d bool(false) -- testing vprintf() function with more than expected no. of arguments -- -Warning: Wrong parameter count for vprintf() in %s on line %d +Warning: vprintf() expects exactly 2 parameters, 3 given in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/vsprintf_error.phpt b/ext/standard/tests/strings/vsprintf_error.phpt index 2876eb1334..2fe85f09f4 100644 --- a/ext/standard/tests/strings/vsprintf_error.phpt +++ b/ext/standard/tests/strings/vsprintf_error.phpt @@ -31,16 +31,16 @@ echo "Done"; -- Testing vsprintf() function with Zero arguments -- -Warning: vsprintf() expects at least %d parameter, %d given in %s on line %d +Warning: vsprintf() expects exactly 2 parameters, 0 given in %s on line %d bool(false) -- Testing vsprintf() function with less than expected no. of arguments -- -Warning: Wrong parameter count for vsprintf() in %s on line %d +Warning: vsprintf() expects exactly 2 parameters, 1 given in %s on line %d bool(false) -- testing vsprintf() function with more than expected no. of arguments -- -Warning: Wrong parameter count for vsprintf() in %s on line %d +Warning: vsprintf() expects exactly 2 parameters, 3 given in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/wordwrap_variation1.phpt b/ext/standard/tests/strings/wordwrap_variation1.phpt deleted file mode 100644 index 86f6fac482..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation1.phpt +++ /dev/null @@ -1,335 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexpected values for str argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * testing wordwrap() by providing different values for str argument -*/ - -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$width = 3; -$break = '<br />\n'; -$cut = true; - -// resource variable -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new stdclass(), - - // Null - NULL, - null, - - // empty string - "", - '', - - // resource variable - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop though each element of the array and check the working of wordwrap() -// when $str argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'str' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $str = $values [$index]; - - var_dump( wordwrap($str) ); - var_dump( wordwrap($str, $width) ); - var_dump( wordwrap($str, $width, $break) ); - - // $cut as false - $cut = false; - var_dump( wordwrap($str, $width, $break, $cut) ); - - // $cut as true - $cut = true; - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'str' argument --- --- Iteration 1 -- -string(1) "0" -string(1) "0" -string(1) "0" -string(1) "0" -string(1) "0" --- Iteration 2 -- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" --- Iteration 3 -- -string(5) "12345" -string(5) "12345" -string(5) "12345" -string(5) "12345" -string(13) "123<br />\n45" --- Iteration 4 -- -string(5) "-2345" -string(5) "-2345" -string(5) "-2345" -string(5) "-2345" -string(13) "-23<br />\n45" --- Iteration 5 -- -string(4) "10.5" -string(4) "10.5" -string(4) "10.5" -string(4) "10.5" -string(12) "10.<br />\n5" --- Iteration 6 -- -string(5) "-10.5" -string(5) "-10.5" -string(5) "-10.5" -string(5) "-10.5" -string(13) "-10<br />\n.5" --- Iteration 7 -- -string(12) "101234567000" -string(12) "101234567000" -string(12) "101234567000" -string(12) "101234567000" -string(36) "101<br />\n234<br />\n567<br />\n000" --- Iteration 8 -- -string(13) "1.07654321E-9" -string(13) "1.07654321E-9" -string(13) "1.07654321E-9" -string(13) "1.07654321E-9" -string(45) "1.0<br />\n765<br />\n432<br />\n1E-<br />\n9" --- Iteration 9 -- -string(3) "0.5" -string(3) "0.5" -string(3) "0.5" -string(3) "0.5" -string(3) "0.5" --- Iteration 10 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" --- Iteration 16 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 17 -- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" --- Iteration 18 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 19 -- - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 20 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 21 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 22 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 23 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 24 -- - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 26 -- -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -Done diff --git a/ext/standard/tests/strings/wordwrap_variation2.phpt b/ext/standard/tests/strings/wordwrap_variation2.phpt deleted file mode 100644 index 4756e98674..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation2.phpt +++ /dev/null @@ -1,340 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexpected values for width argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * test wordwrap by passing different values for width argument -*/ -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$str = 'testing wordwrap function'; -$break = '<br />\n'; -$cut = true; - -// resource var -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 10; -unset($unset_var); - - -// array with different values as width -$values = array ( - // zerovalue for width - 0, - - // -ve value for width - -1, - -10, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // Null value - NULL, - null, - - // empty string - "", - '', - - // resource variable - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop though each element of the array and check the working of wordwrap() -// when $width argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'width' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $width = $values [$index]; - - var_dump( wordwrap($str, $width) ); - var_dump( wordwrap($str, $width, $break) ); - - // cut as false - $cut = false; - var_dump( wordwrap($str, $width, $break, $cut) ); - - // cut as true - $cut = true; - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'width' argument --- --- Iteration 1 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 2 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 3 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 4 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 5 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 6 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 7 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 8 -- - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, array given in %s on line %d -NULL --- Iteration 9 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 10 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 11 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn" --- Iteration 12 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 15 -- - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, object given in %s on line %d -NULL --- Iteration 16 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 17 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 18 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 19 -- - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, string given in %s on line %d -NULL --- Iteration 20 -- - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 2 to be int, resource given in %s on line %d -NULL --- Iteration 21 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) --- Iteration 22 -- -string(25) "testing -wordwrap -function" -string(39) "testing<br />\nwordwrap<br />\nfunction" -string(39) "testing<br />\nwordwrap<br />\nfunction" - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/strings/wordwrap_variation3.phpt b/ext/standard/tests/strings/wordwrap_variation3.phpt deleted file mode 100644 index 5774ce3752..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation3.phpt +++ /dev/null @@ -1,301 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexptected values for break argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * test wordwrap by passing different values for break argument -*/ -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$str = 'testing wordwrap function'; -$width = 10; -$cut = true; - -// resource var -$fp = fopen(__FILE__, "r"); - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - - -// array with different values for break arg -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new stdclass(), - - // empty string - "", - '', - - //Null - NULL, - null, - - // resource var - $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop though each element of the array and check the working of wordwrap() -// when $break argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'break' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $break = $values [$index]; - - var_dump( wordwrap($str, $width, $break) ); - - // $cut as false - $cut = false; - var_dump( wordwrap($str, $width, $break, $cut) ); - - // $cut as true - $cut = true; - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource used -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'break' argument --- --- Iteration 1 -- -string(25) "testing0wordwrap0function" -string(25) "testing0wordwrap0function" -string(25) "testing0wordwrap0function" --- Iteration 2 -- -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" --- Iteration 3 -- -string(33) "testing12345wordwrap12345function" -string(33) "testing12345wordwrap12345function" -string(33) "testing12345wordwrap12345function" --- Iteration 4 -- -string(33) "testing-2345wordwrap-2345function" -string(33) "testing-2345wordwrap-2345function" -string(33) "testing-2345wordwrap-2345function" --- Iteration 5 -- -string(31) "testing10.5wordwrap10.5function" -string(31) "testing10.5wordwrap10.5function" -string(31) "testing10.5wordwrap10.5function" --- Iteration 6 -- -string(33) "testing-10.5wordwrap-10.5function" -string(33) "testing-10.5wordwrap-10.5function" -string(33) "testing-10.5wordwrap-10.5function" --- Iteration 7 -- -string(47) "testing101234567000wordwrap101234567000function" -string(47) "testing101234567000wordwrap101234567000function" -string(47) "testing101234567000wordwrap101234567000function" --- Iteration 8 -- -string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" -string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" -string(49) "testing1.07654321E-9wordwrap1.07654321E-9function" --- Iteration 9 -- -string(29) "testing0.5wordwrap0.5function" -string(29) "testing0.5wordwrap0.5function" -string(29) "testing0.5wordwrap0.5function" --- Iteration 10 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d -NULL --- Iteration 15 -- -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" --- Iteration 16 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 17 -- -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" -string(25) "testing1wordwrap1function" --- Iteration 18 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d -NULL --- Iteration 20 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 22 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 23 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 24 -- - -Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d -NULL - -Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d -NULL --- Iteration 25 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) --- Iteration 26 -- - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) - -Warning: wordwrap(): Break string cannot be empty in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/strings/wordwrap_variation4.phpt b/ext/standard/tests/strings/wordwrap_variation4.phpt deleted file mode 100644 index 656db58b15..0000000000 --- a/ext/standard/tests/strings/wordwrap_variation4.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -Test wordwrap() function : usage variations - unexptected value for cut argument ---FILE-- -<?php -/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] ) - * Description: Wraps buffer to selected number of characters using string break char - * Source code: ext/standard/string.c -*/ - -/* - * test wordwrap() by supplying different values for cut argument -*/ - -echo "*** Testing wordwrap() : usage variations ***\n"; -// initialize all required variables -$str = 'testing wordwrap function'; -$width = 10; -$break = '<br />\n'; - -// get an unset variable -$unset_var = true; -unset($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // string values - "string", - 'string', - - // objects - new stdclass(), - - // empty string - "", - '', - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop though each element of the array and check the working of wordwrap() -// when $cut argument is supplied with different values -echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n"; -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $cut = $values [$index]; - - var_dump( wordwrap($str, $width, $break, $cut) ); - - $counter ++; -} - -// close the resource -fclose($fp); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing wordwrap() : usage variations *** - ---- Testing wordwrap() by supplying different values for 'cut' argument --- --- Iteration 1 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 2 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 3 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 4 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 5 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 6 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 7 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 8 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 9 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 10 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 11 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 12 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 13 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 14 -- - -Warning: wordwrap() expects parameter 4 to be bool, array given in %s on line %d -NULL --- Iteration 15 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 16 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 17 -- - -Warning: wordwrap() expects parameter 4 to be bool, object given in %s on line %d -NULL --- Iteration 18 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 19 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 20 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" --- Iteration 21 -- -string(39) "testing<br />\nwordwrap<br />\nfunction" -Done diff --git a/ext/standard/tests/url/base64_decode_variation_001.phpt b/ext/standard/tests/url/base64_decode_variation_001.phpt deleted file mode 100644 index 10e8736846..0000000000 --- a/ext/standard/tests/url/base64_decode_variation_001.phpt +++ /dev/null @@ -1,181 +0,0 @@ ---TEST-- -Test base64_decode() function : usage variations - unexpected types for arg 1 ---FILE-- -<?php -/* Prototype : proto string base64_decode(string str[, bool strict]) - * Description: Decodes string using MIME base64 algorithm - * Source code: ext/standard/base64.c - * Alias to functions: - */ - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing base64_decode() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$strict = true; - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array ( - // int data - "0" => 0, - "1" => 1, - "12345" => 12345, - "-2345" => -2345, - - // float data - "10.5" => 10.5, - "-10.5" => -10.5, - "10.1234567e10" => 10.1234567e10, - "10.7654321E-10" => 10.7654321E-10, - ".5" => .5, - - // array data - "array()" => array(), - "array(0)" => array(0), - "array(1)" => array(1), - "array(1, 2)" => array(1, 2), - "array('color' => 'red', 'item' => 'pen'" => array('color' => 'red', 'item' => 'pen'), - - // null data - "NULL" => NULL, - "null" => null, - - // boolean data - "true" => true, - "false" => false, - "TRUE" => TRUE, - "FALSE" => FALSE, - - // empty data - "\"\"" => "", - "''" => '', - - // object data - "stdClass object" => new stdclass(), - - // undefined data - "undefined variable" => $undefined_var, - - // unset data - "unset variable" => $unset_var, - - // resource data - "resource" => $file_handle -); - -// loop through each element of the array for str argument - -foreach($values as $key=>$value) { - echo "\n-- Arg value $key --\n"; - $output = base64_decode($value, $strict); - - if (is_string($output)) { - var_dump(bin2hex($output)); - } else { - var_dump($output); - } -}; - -?> -===Done=== ---EXPECTF-- -*** Testing base64_decode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(%d) -Error: 8 - Undefined variable: unset_var, %s(%d) - --- Arg value 0 -- -bool(false) - --- Arg value 1 -- -bool(false) - --- Arg value 12345 -- -bool(false) - --- Arg value -2345 -- -bool(false) - --- Arg value 10.5 -- -bool(false) - --- Arg value -10.5 -- -bool(false) - --- Arg value 10.1234567e10 -- -string(18) "d74d76df8e7aef4d34" - --- Arg value 10.7654321E-10 -- -bool(false) - --- Arg value .5 -- -bool(false) - --- Arg value array() -- -Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value array(0) -- -Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value array(1) -- -Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value array(1, 2) -- -Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value array('color' => 'red', 'item' => 'pen' -- -Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(%d) -NULL - --- Arg value NULL -- -string(0) "" - --- Arg value null -- -string(0) "" - --- Arg value true -- -bool(false) - --- Arg value false -- -string(0) "" - --- Arg value TRUE -- -bool(false) - --- Arg value FALSE -- -string(0) "" - --- Arg value "" -- -string(0) "" - --- Arg value '' -- -string(0) "" - --- Arg value stdClass object -- -Error: 2 - base64_decode() expects parameter 1 to be string, object given, %s(%d) -NULL - --- Arg value undefined variable -- -string(0) "" - --- Arg value unset variable -- -string(0) "" - --- Arg value resource -- -Error: 2 - base64_decode() expects parameter 1 to be string, resource given, %s(%d) -NULL -===Done=== diff --git a/ext/standard/tests/url/base64_decode_variation_002.phpt b/ext/standard/tests/url/base64_decode_variation_002.phpt deleted file mode 100644 index 56232f58c4..0000000000 --- a/ext/standard/tests/url/base64_decode_variation_002.phpt +++ /dev/null @@ -1,175 +0,0 @@ ---TEST-- -Test base64_decode() function : usage variations - unexpected types for arg 2 ---FILE-- -<?php -/* Prototype : proto string base64_decode(string str[, bool strict]) - * Description: Decodes string using MIME base64 algorithm - * Source code: ext/standard/base64.c - * Alias to functions: - */ - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing base64_decode() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$str = 'aGVsbG8gd29ybGQh!'; - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array ( - // int data - "0" => 0, - "1" => 1, - "12345" => 12345, - "-2345" => -2345, - - // float data - "10.5" => 10.5, - "-10.5" => -10.5, - "10.1234567e10" => 10.1234567e10, - "10.7654321E-10" => 10.7654321E-10, - ".5" => .5, - - // array data - "array()" => array(), - "array(0)" => array(0), - "array(1)" => array(1), - "array(1, 2)" => array(1, 2), - "array('color' => 'red', 'item' => 'pen'" => array('color' => 'red', 'item' => 'pen'), - - // null data - "NULL" => NULL, - "null" => null, - - // boolean data - "true" => true, - "false" => false, - "TRUE" => TRUE, - "FALSE" => FALSE, - - // empty data - "\"\"" => "", - "''" => '', - - // object data - "stdClass object" => new stdclass(), - - // undefined data - "undefined variable" => $undefined_var, - - // unset data - "unset variable" => $unset_var, - - // resource data - "resource" => $file_handle -); - -// loop through each element of the array for strict argument - -foreach($values as $key=>$value) { - echo "\n-- Arg value $key --\n"; - var_dump(base64_decode($str, $value)); -}; - -?> -===Done=== ---EXPECTF-- -*** Testing base64_decode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(%d) -Error: 8 - Undefined variable: unset_var, %s(%d) - --- Arg value 0 -- -string(12) "hello world!" - --- Arg value 1 -- -bool(false) - --- Arg value 12345 -- -bool(false) - --- Arg value -2345 -- -bool(false) - --- Arg value 10.5 -- -bool(false) - --- Arg value -10.5 -- -bool(false) - --- Arg value 10.1234567e10 -- -bool(false) - --- Arg value 10.7654321E-10 -- -bool(false) - --- Arg value .5 -- -bool(false) - --- Arg value array() -- -Error: 2 - base64_decode() expects parameter 2 to be bool, array given, %s(%d) -NULL - --- Arg value array(0) -- -Error: 2 - base64_decode() expects parameter 2 to be bool, array given, %s(%d) -NULL - --- Arg value array(1) -- -Error: 2 - base64_decode() expects parameter 2 to be bool, array given, %s(%d) -NULL - --- Arg value array(1, 2) -- -Error: 2 - base64_decode() expects parameter 2 to be bool, array given, %s(%d) -NULL - --- Arg value array('color' => 'red', 'item' => 'pen' -- -Error: 2 - base64_decode() expects parameter 2 to be bool, array given, %s(%d) -NULL - --- Arg value NULL -- -string(12) "hello world!" - --- Arg value null -- -string(12) "hello world!" - --- Arg value true -- -bool(false) - --- Arg value false -- -string(12) "hello world!" - --- Arg value TRUE -- -bool(false) - --- Arg value FALSE -- -string(12) "hello world!" - --- Arg value "" -- -string(12) "hello world!" - --- Arg value '' -- -string(12) "hello world!" - --- Arg value stdClass object -- -Error: 2 - base64_decode() expects parameter 2 to be bool, object given, %s(%d) -NULL - --- Arg value undefined variable -- -string(12) "hello world!" - --- Arg value unset variable -- -string(12) "hello world!" - --- Arg value resource -- -Error: 2 - base64_decode() expects parameter 2 to be bool, resource given, %s(%d) -NULL -===Done=== diff --git a/ext/standard/tests/url/base64_encode_variation_001.phpt b/ext/standard/tests/url/base64_encode_variation_001.phpt deleted file mode 100644 index bdf2bc0dd4..0000000000 --- a/ext/standard/tests/url/base64_encode_variation_001.phpt +++ /dev/null @@ -1,172 +0,0 @@ ---TEST-- -Test base64_encode() function : usage variations - unexpected types for argument 1 ---FILE-- -<?php -/* Prototype : proto string base64_encode(string str) - * Description: Encodes string using MIME base64 algorithm - * Source code: ext/standard/base64.c - * Alias to functions: - */ - -echo "*** Testing base64_encode() : usage variations ***\n"; - - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( base64_encode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing base64_encode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(63) -Error: 8 - Undefined variable: unset_var, %s(66) - -Arg value 0 -string(4) "MA==" - -Arg value 1 -string(4) "MQ==" - -Arg value 12345 -string(8) "MTIzNDU=" - -Arg value -2345 -string(8) "LTIzNDU=" - -Arg value 10.5 -string(8) "MTAuNQ==" - -Arg value -10.5 -string(8) "LTEwLjU=" - -Arg value 101234567000 -string(16) "MTAxMjM0NTY3MDAw" - -Arg value 1.07654321E-9 -string(20) "MS4wNzY1NDMyMUUtOQ==" - -Arg value 0.5 -string(4) "MC41" -Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) - -Arg value Array -Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) -NULL -Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) - -Arg value Array -Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) -NULL -Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) - -Arg value Array -Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) -NULL -Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) - -Arg value Array -Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) -NULL -Error: 8 - Array to string conversion, %sbase64_encode_variation_001.php(%d) - -Arg value Array -Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(4) "MQ==" - -Arg value -string(0) "" - -Arg value 1 -string(4) "MQ==" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" -Error: 4096 - Object of class stdClass could not be converted to string, %s(72) - -Arg value -Error: 2 - base64_encode() expects parameter 1 to be string, object given, %s(73) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/url/get_headers_error_003.phpt b/ext/standard/tests/url/get_headers_error_003.phpt index c65305af2c..8a50e3bc8a 100644 --- a/ext/standard/tests/url/get_headers_error_003.phpt +++ b/ext/standard/tests/url/get_headers_error_003.phpt @@ -1,5 +1,7 @@ --TEST-- Test get_headers() function : test with context +--CONFLICTS-- +server --FILE-- <?php diff --git a/ext/standard/tests/url/parse_url_variation_001.phpt b/ext/standard/tests/url/parse_url_variation_001.phpt deleted file mode 100644 index 6c492e36f1..0000000000 --- a/ext/standard/tests/url/parse_url_variation_001.phpt +++ /dev/null @@ -1,226 +0,0 @@ ---TEST-- -Test parse_url() function : usage variations - unexpected type for arg 1. ---FILE-- -<?php -/* Prototype : proto mixed parse_url(string url, [int url_component]) - * Description: Parse a URL and return its components - * Source code: ext/standard/url.c - * Alias to functions: - */ - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing parse_url() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for url - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( parse_url($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing parse_url() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(60) -Error: 8 - Undefined variable: unset_var, %s(63) - -Arg value 0 -array(1) { - ["path"]=> - string(1) "0" -} - -Arg value 1 -array(1) { - ["path"]=> - string(1) "1" -} - -Arg value 12345 -array(1) { - ["path"]=> - string(5) "12345" -} - -Arg value -2345 -array(1) { - ["path"]=> - string(5) "-2345" -} - -Arg value 10.5 -array(1) { - ["path"]=> - string(4) "10.5" -} - -Arg value -10.5 -array(1) { - ["path"]=> - string(5) "-10.5" -} - -Arg value 101234567000 -array(1) { - ["path"]=> - string(12) "101234567000" -} - -Arg value 1.07654321E-9 -array(1) { - ["path"]=> - string(13) "1.07654321E-9" -} - -Arg value 0.5 -array(1) { - ["path"]=> - string(3) "0.5" -} -Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_001.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70) -NULL - -Arg value -array(1) { - ["path"]=> - string(0) "" -} - -Arg value -array(1) { - ["path"]=> - string(0) "" -} - -Arg value 1 -array(1) { - ["path"]=> - string(1) "1" -} - -Arg value -array(1) { - ["path"]=> - string(0) "" -} - -Arg value 1 -array(1) { - ["path"]=> - string(1) "1" -} - -Arg value -array(1) { - ["path"]=> - string(0) "" -} - -Arg value -array(1) { - ["path"]=> - string(0) "" -} - -Arg value -array(1) { - ["path"]=> - string(0) "" -} -Error: 4096 - Object of class stdClass could not be converted to string, %s(69) - -Arg value -Error: 2 - parse_url() expects parameter 1 to be string, object given, %s(70) -NULL - -Arg value -array(1) { - ["path"]=> - string(0) "" -} - -Arg value -array(1) { - ["path"]=> - string(0) "" -} -Done diff --git a/ext/standard/tests/url/parse_url_variation_002_32bit.phpt b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt deleted file mode 100644 index 70138ffe77..0000000000 --- a/ext/standard/tests/url/parse_url_variation_002_32bit.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test parse_url() function : usage variations - unexpected type for arg 2. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); ?> ---FILE-- -<?php -/* Prototype : proto mixed parse_url(string url, [int url_component]) - * Description: Parse a URL and return its components - * Source code: ext/standard/url.c - * Alias to functions: - */ - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing parse_url() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for url_component - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( parse_url($url, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing parse_url() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(%d) -Error: 8 - Undefined variable: unset_var, %s(%d) - -Arg value 10.5 -Error: 2 - parse_url(): Invalid URL component identifier 10, %s(%d) -bool(false) - -Arg value -10.5 -array(8) { - ["scheme"]=> - string(4) "http" - ["host"]=> - string(11) "www.php.net" - ["port"]=> - int(80) - ["user"]=> - string(6) "secret" - ["pass"]=> - string(7) "hideout" - ["path"]=> - string(10) "/index.php" - ["query"]=> - string(31) "test=1&test2=char&test3=mixesCI" - ["fragment"]=> - string(16) "some_page_ref123" -} - -Arg value 101234567000 -Error: 2 - parse_url() expects parameter 2 to be int, float given, %s(%d) -NULL - -Arg value 1.07654321E-9 -string(4) "http" - -Arg value 0.5 -string(4) "http" -Error: 8 - Array to string conversion, %s(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %s(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %s(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %s(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(%d) -NULL -Error: 8 - Array to string conversion, %s(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(%d) -NULL - -Arg value -string(4) "http" - -Arg value -string(4) "http" - -Arg value 1 -string(%d) "www.php.net" - -Arg value -string(4) "http" - -Arg value 1 -string(%d) "www.php.net" - -Arg value -string(4) "http" - -Arg value -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(%d) -NULL - -Arg value -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(%d) -NULL - -Arg value string -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(%d) -NULL - -Arg value string -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(%d) -NULL -Error: 4096 - Object of class stdClass could not be converted to string, %s(%d) - -Arg value -Error: 2 - parse_url() expects parameter 2 to be int, object given, %s(%d) -NULL - -Arg value -string(4) "http" - -Arg value -string(4) "http" -Done diff --git a/ext/standard/tests/url/parse_url_variation_002_64bit.phpt b/ext/standard/tests/url/parse_url_variation_002_64bit.phpt deleted file mode 100644 index 69ebe274b5..0000000000 --- a/ext/standard/tests/url/parse_url_variation_002_64bit.phpt +++ /dev/null @@ -1,189 +0,0 @@ ---TEST-- -Test parse_url() function : usage variations - unexpected type for arg 2. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?> ---FILE-- -<?php -/* Prototype : proto mixed parse_url(string url, [int url_component]) - * Description: Parse a URL and return its components - * Source code: ext/standard/url.c - * Alias to functions: - */ - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing parse_url() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // string data - "string", - 'string', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for url_component - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( parse_url($url, $value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing parse_url() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(61) -Error: 8 - Undefined variable: unset_var, %s(64) - -Arg value 10.5 -Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) -bool(false) - -Arg value -10.5 -array(8) { - ["scheme"]=> - string(4) "http" - ["host"]=> - string(11) "www.php.net" - ["port"]=> - int(80) - ["user"]=> - string(6) "secret" - ["pass"]=> - string(7) "hideout" - ["path"]=> - string(10) "/index.php" - ["query"]=> - string(31) "test=1&test2=char&test3=mixesCI" - ["fragment"]=> - string(16) "some_page_ref123" -} - -Arg value 101234567000 -Error: 2 - parse_url(): Invalid URL component identifier %d, %s(71) -bool(false) - -Arg value 1.07654321E-9 -string(4) "http" - -Arg value 0.5 -string(4) "http" -Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) -NULL -Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d) - -Arg value Array -Error: 2 - parse_url() expects parameter 2 to be int, array given, %s(71) -NULL - -Arg value -string(4) "http" - -Arg value -string(4) "http" - -Arg value 1 -string(11) "www.php.net" - -Arg value -string(4) "http" - -Arg value 1 -string(11) "www.php.net" - -Arg value -string(4) "http" - -Arg value -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) -NULL - -Arg value -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) -NULL - -Arg value string -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) -NULL - -Arg value string -Error: 2 - parse_url() expects parameter 2 to be int, string given, %s(71) -NULL -Error: 4096 - Object of class stdClass could not be converted to string, %s(70) - -Arg value -Error: 2 - parse_url() expects parameter 2 to be int, object given, %s(71) -NULL - -Arg value -string(4) "http" - -Arg value -string(4) "http" -Done diff --git a/ext/standard/tests/url/rawurldecode_variation_001.phpt b/ext/standard/tests/url/rawurldecode_variation_001.phpt deleted file mode 100644 index 40b96c775d..0000000000 --- a/ext/standard/tests/url/rawurldecode_variation_001.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test rawurldecode() function : usage variations - unexpected type for arg 1. ---FILE-- -<?php -/* Prototype : proto string rawurldecode(string str) - * Description: Decodes URL-encodes string - * Source code: ext/standard/url.c - * Alias to functions: - */ - -// NB: basic functionality tested in tests/strings/001.phpt - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing rawurldecode() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( rawurldecode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing rawurldecode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(64) -Error: 8 - Undefined variable: unset_var, %s(67) - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" -Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" -Error: 4096 - Object of class stdClass could not be converted to string, %s(73) - -Arg value -Error: 2 - rawurldecode() expects parameter 1 to be string, object given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/url/rawurlencode_variation_001.phpt b/ext/standard/tests/url/rawurlencode_variation_001.phpt deleted file mode 100644 index 105eec6887..0000000000 --- a/ext/standard/tests/url/rawurlencode_variation_001.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test rawurlencode() function : usage variations - unexpected type for arg 1. ---FILE-- -<?php -/* Prototype : proto string rawurlencode(string str) - * Description: URL-encodes string - * Source code: ext/standard/url.c - * Alias to functions: - */ - -// NB: basic functionality tested in tests/strings/001.phpt - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing rawurlencode() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( rawurlencode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing rawurlencode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(64) -Error: 8 - Undefined variable: unset_var, %s(67) - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" -Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %srawurlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" -Error: 4096 - Object of class stdClass could not be converted to string, %s(73) - -Arg value -Error: 2 - rawurlencode() expects parameter 1 to be string, object given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/url/urldecode_variation_001.phpt b/ext/standard/tests/url/urldecode_variation_001.phpt deleted file mode 100644 index 617648b9e4..0000000000 --- a/ext/standard/tests/url/urldecode_variation_001.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test urldecode() function : usage variations - <type here specifics of this variation> ---FILE-- -<?php -/* Prototype : proto string urldecode(string str) - * Description: Decodes URL-encoded string - * Source code: ext/standard/url.c - * Alias to functions: - */ - -// NB: basic functionality tested in tests/strings/001.phpt - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing urldecode() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( urldecode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing urldecode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(64) -Error: 8 - Undefined variable: unset_var, %s(67) - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" -Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surldecode_variation_001.php(%d) - -Arg value Array -Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" -Error: 4096 - Object of class stdClass could not be converted to string, %s(73) - -Arg value -Error: 2 - urldecode() expects parameter 1 to be string, object given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/url/urlencode_variation_001.phpt b/ext/standard/tests/url/urlencode_variation_001.phpt deleted file mode 100644 index 9c5296f1c5..0000000000 --- a/ext/standard/tests/url/urlencode_variation_001.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test urlencode() function : usage variations - <type here specifics of this variation> ---FILE-- -<?php -/* Prototype : proto string urlencode(string str) - * Description: URL-encodes string - * Source code: ext/standard/url.c - * Alias to functions: - */ - -// NB: basic functionality tested in tests/strings/001.phpt - -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; -} -set_error_handler('test_error_handler'); - -echo "*** Testing urlencode() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//array of values to iterate over -$values = array( - - // int data - 0, - 1, - 12345, - -2345, - - // float data - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data - NULL, - null, - - // boolean data - true, - false, - TRUE, - FALSE, - - // empty data - "", - '', - - // object data - new stdclass(), - - // undefined data - $undefined_var, - - // unset data - $unset_var, -); - -// loop through each element of the array for str - -foreach($values as $value) { - echo "\nArg value $value \n"; - var_dump( urlencode($value) ); -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing urlencode() : usage variations *** -Error: 8 - Undefined variable: undefined_var, %s(64) -Error: 8 - Undefined variable: unset_var, %s(67) - -Arg value 0 -string(1) "0" - -Arg value 1 -string(1) "1" - -Arg value 12345 -string(5) "12345" - -Arg value -2345 -string(5) "-2345" - -Arg value 10.5 -string(4) "10.5" - -Arg value -10.5 -string(5) "-10.5" - -Arg value 101234567000 -string(12) "101234567000" - -Arg value 1.07654321E-9 -string(13) "1.07654321E-9" - -Arg value 0.5 -string(3) "0.5" -Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) -NULL -Error: 8 - Array to string conversion, %surlencode_variation_001.php(%d) - -Arg value Array -Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value 1 -string(1) "1" - -Arg value -string(0) "" - -Arg value -string(0) "" - -Arg value -string(0) "" -Error: 4096 - Object of class stdClass could not be converted to string, %s(73) - -Arg value -Error: 2 - urlencode() expects parameter 1 to be string, object given, %s(74) -NULL - -Arg value -string(0) "" - -Arg value -string(0) "" -Done diff --git a/ext/standard/tests/versioning/version_compare_invalid_operator.phpt b/ext/standard/tests/versioning/version_compare_invalid_operator.phpt new file mode 100644 index 0000000000..2d5bdb6247 --- /dev/null +++ b/ext/standard/tests/versioning/version_compare_invalid_operator.phpt @@ -0,0 +1,12 @@ +--TEST-- +Ensures null is returned if versions are compared with invalid operator +--CREDITS-- +David Stockton - <dave@davidstockton.com> - i3logix PHP Testfest 2017 +--SKIPIF-- + +--FILE-- +<?php +var_dump(version_compare('1.2', '2.1', '??')); +?> +--EXPECT-- +NULL |