diff options
Diffstat (limited to 'ext/standard/tests')
98 files changed, 1584 insertions, 1758 deletions
diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt index efd3c81cc2..89d7f37b1f 100644 --- a/ext/standard/tests/array/array_count_values_variation.phpt +++ b/ext/standard/tests/array/array_count_values_variation.phpt @@ -33,6 +33,10 @@ echo "\n"; echo "Done"; ?> +--CLEAN-- +<?php +unlink("array_count_file"); +?> --EXPECTF-- *** Testing array_count_values() : parameter variations *** array(3) { @@ -44,4 +48,4 @@ array(3) { int(1) } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt index 7d8e09eb2d..b85dd7cee9 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt @@ -20,6 +20,17 @@ echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr1 $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 = <<<EOT Hello world @@ -50,18 +61,18 @@ $arrays = array ( array("hello", $heredoc => "string"), // heredoc // array with object, unset variable and resource variable -/*10*/ array(@$unset_var => "hello"), +/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, "fruit" => 2.2, - 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); // array to be passsed to $arr2 argument $arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", "\tHello" => 111, 2.2, 'color', "Hello world" => "string", - "pen\n" => 33, 133 => "int"); + "pen\n" => 33, new classA() => 11, 133 => "int"); // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; @@ -77,10 +88,23 @@ foreach($arrays as $arr1) { $iterator++; } +// close the file resource used +fclose($fp); + echo "Done"; ?> --EXPECTF-- *** Testing array_intersect_assoc() : assoc array with diff keys to $arr1 argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d -- Iteration 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt index 75806225ca..ed96d3276f 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt @@ -20,6 +20,17 @@ echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr2 $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 = <<<EOT Hello world @@ -49,19 +60,19 @@ $arrays = array ( "\v\fworld" => 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with unset variable -/*10*/ array( @$unset_var => "hello"), + // array with object, unset variable and resource variable +/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, "fruit" => 2.2, - 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); // array to be passsed to $arr1 argument $arr1 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", "\tHello" => 111, 2.2, 'color', "Hello world" => "string", - "pen\n" => 33, 133 => "int"); + "pen\n" => 33, new classA() => 11, 133 => "int"); // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; @@ -77,10 +88,23 @@ foreach($arrays as $arr2) { $iterator++; } +// close the file resource used +fclose($fp); + echo "Done"; ?> --EXPECTF-- *** Testing array_intersect_assoc() : assoc array with diff keys to $arr2 argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d -- Iteration 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt index 9aaedeb382..7f36ee3f2e 100644 --- a/ext/standard/tests/array/array_intersect_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_variation5.phpt @@ -19,6 +19,17 @@ echo "*** Testing array_intersect() : assoc array with diff keys to \$arr1 argum $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 = <<<EOT Hello world @@ -48,12 +59,12 @@ $arrays = array ( "\v\fworld" => 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with unset variable -/*10*/ array( @$unset_var => "hello"), + // array with object, unset variable and resource variable +/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, "fruit" => 2.2, - 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -74,10 +85,21 @@ foreach($arrays as $arr1) { $iterator++; } +// close the file resource used +fclose($fp); + echo "Done"; ?> --EXPECTF-- *** Testing array_intersect() : assoc array with diff keys to $arr1 argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d -- Iterator 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt index 48d01f7d54..cecde34db8 100644 --- a/ext/standard/tests/array/array_intersect_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_variation6.phpt @@ -19,6 +19,17 @@ echo "*** Testing array_intersect() : assoc array with diff keys to \$arr2 argum $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 = <<<EOT Hello world @@ -48,12 +59,12 @@ $arrays = array ( "\v\fworld" => 2.2, "pen\n" => 33), array("hello", $heredoc => "string"), // heredoc - // array with unset variable -/*10*/ array( @$unset_var => "hello"), + // array with object, unset variable and resource variable +/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), // array with mixed keys -/*11*/ array('hello' => 1, "fruit" => 2.2, - 133 => "int", 444.432 => "float", +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc") ); @@ -74,10 +85,21 @@ foreach($arrays as $arr2) { $iterator++; } +// close the file resource used +fclose($fp); + echo "Done"; ?> --EXPECTF-- *** Testing array_intersect() : assoc array with diff keys to $arr2 argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d -- Iterator 1 -- array(0) { } diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index f433e12562..40bd54fd94 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -280,13 +280,23 @@ Warning: array_key_exists(): The first argument should be either a string or an bool(false) *** Testing operation on objects *** -bool(false) -bool(false) -bool(true) -bool(false) -bool(true) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL bool(true) -Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d -bool(false) +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL Done diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt index 3b263df474..8a6120599c 100644 --- a/ext/standard/tests/array/array_key_exists_object1.phpt +++ b/ext/standard/tests/array/array_key_exists_object1.phpt @@ -52,11 +52,15 @@ echo "Done"; -- Do not assign a value to $class1->var3 -- $key = var1: -bool(true) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $key = var3: -bool(true) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $class1: -object(myClass)#1 (3) { +object(myClass)#%d (3) { ["var1"]=> string(1) "a" ["var2"]=> @@ -67,9 +71,11 @@ object(myClass)#1 (3) { -- Assign a value to $class2->var3 -- $key = var3: -bool(true) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $class2: -object(myClass)#2 (3) { +object(myClass)#%d (3) { ["var1"]=> string(1) "x" ["var2"]=> diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt index 4a790e9d37..c810f868f2 100644 --- a/ext/standard/tests/array/array_key_exists_object2.phpt +++ b/ext/standard/tests/array/array_key_exists_object2.phpt @@ -54,13 +54,19 @@ echo "Done"; -- Do not assign a value to $class1->var3 -- $key = var1: -bool(true) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $key = var2: -bool(false) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $key = var3: -bool(false) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $class1: -object(myClass)#1 (3) { +object(myClass)#%d (3) { ["var1"]=> string(1) "a" ["var2":protected]=> @@ -71,9 +77,11 @@ object(myClass)#1 (3) { -- Assign a value to $class2->var3 -- $key = var3: -bool(false) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL $class2: -object(myClass)#2 (3) { +object(myClass)#%d (3) { ["var1"]=> string(1) "x" ["var2":protected]=> diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt index a6e9cd2bbf..9d26d37640 100644 --- a/ext/standard/tests/array/array_key_exists_variation2.phpt +++ b/ext/standard/tests/array/array_key_exists_variation2.phpt @@ -206,7 +206,9 @@ Warning: array_key_exists() expects parameter 2 to be array, string given in %s NULL -- Iteration 22 -- -bool(false) + +Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d +NULL -- Iteration 23 -- diff --git a/ext/standard/tests/array/array_rand_variation4.phpt b/ext/standard/tests/array/array_rand_variation4.phpt index be4302d33f..72b6c55cf3 100644 --- a/ext/standard/tests/array/array_rand_variation4.phpt +++ b/ext/standard/tests/array/array_rand_variation4.phpt @@ -38,7 +38,7 @@ $asso_arrays = array( // array with special chars as keys /*6*/ array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4', - "NULL" => 'key5', + "NULL" => 'key5', "\n" => 'newline as key', "\t" => "tab as key", "'" => 'single quote as key', '"' => 'double quote as key', "\0" => "null char as key") ); @@ -165,3 +165,4 @@ array\(2\) { string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*" } Done + diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index 4c7a148c88..daed1d84fc 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -1,227 +1,61 @@ --TEST-- -Test array_slice() function : usage variations - Pass different data types as $input arg +Test array_slice() - Third parameter (NULL vs 0) --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 arguments as $input argument to array_slice() to test behaviour - */ +var_dump(array_slice(range(1, 3), 0, NULL, 1)); +var_dump(array_slice(range(1, 3), 0, 0, 1)); +var_dump(array_slice(range(1, 3), 0, NULL)); +var_dump(array_slice(range(1, 3), 0, 0)); -echo "*** Testing array_slice() : usage variations ***\n"; +var_dump(array_slice(range(1, 3), -1, 0)); +var_dump(array_slice(range(1, 3), -1, 0, 1)); +var_dump(array_slice(range(1, 3), -1, NULL)); +var_dump(array_slice(range(1, 3), -1, NULL, 1)); -// Initialise function arguments not being substituted -$offset = 2; -//get an unset variable -$unset_var = 10; -unset ($unset_var); +$a = 'foo'; +var_dump(array_slice(range(1, 3), 0, $a)); +var_dump(array_slice(range(1, 3), 0, $a)); +var_dump($a); -// 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_slice() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_slice($input, $offset) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; ?> --EXPECTF-- -*** Testing array_slice() : usage variations *** - --- Iteration 1 -- - -Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 18 -- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} array(0) { } - --- Iteration 19 -- - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d -NULL -Done
\ No newline at end of file +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + int(3) +} +array(1) { + [2]=> + int(3) +} +array(0) { +} +array(0) { +} +string(3) "foo" diff --git a/ext/standard/tests/array/array_unshift_variation1.phpt b/ext/standard/tests/array/array_unshift_variation1.phpt index 4d0c8c2069..f75bf6055f 100644 --- a/ext/standard/tests/array/array_unshift_variation1.phpt +++ b/ext/standard/tests/array/array_unshift_variation1.phpt @@ -330,9 +330,9 @@ 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) +resource(5) 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) +resource(5) of type (stream) Done diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt Binary files differindex 9a76410c62..f6cbce018f 100644 --- a/ext/standard/tests/array/array_walk_object1.phpt +++ b/ext/standard/tests/array/array_walk_object1.phpt diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt Binary files differindex 83915af7c3..a90e3e2829 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt Binary files differindex 8a819bc03e..efee37c3d5 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt Binary files differindex cc1b51ca78..16a56d37d0 100644 --- a/ext/standard/tests/array/array_walk_recursive_object1.phpt +++ b/ext/standard/tests/array/array_walk_recursive_object1.phpt diff --git a/ext/standard/tests/array/arsort_variation3.phpt b/ext/standard/tests/array/arsort_variation3.phpt index eab3b45f62..609155ca73 100644 --- a/ext/standard/tests/array/arsort_variation3.phpt +++ b/ext/standard/tests/array/arsort_variation3.phpt @@ -1,9 +1,5 @@ --TEST-- Test arsort() function : usage variations - sort integer/float values ---SKIPIF-- -<?php -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); -?> --FILE-- <?php /* Prototype : bool arsort ( array &$array [, int $sort_flags] ) @@ -63,7 +59,7 @@ foreach ($various_arrays as $array) { echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- *** Testing arsort() : usage variations *** -- Testing arsort() by supplying various integer/float arrays -- @@ -277,7 +273,7 @@ array(11) { bool(true) array(7) { [2]=> - float(2147483648) + %s(2147483648) [1]=> int(2147483647) [6]=> @@ -287,15 +283,15 @@ array(7) { [3]=> int(-2147483647) [4]=> - float(-2147483648) + %s(-2147483648) [7]=> - float(-2147483649) + %s(-2147483649) } - Sort_flag = SORT_REGULAR - bool(true) array(7) { [2]=> - float(2147483648) + %s(2147483648) [1]=> int(2147483647) [6]=> @@ -305,15 +301,15 @@ array(7) { [3]=> int(-2147483647) [4]=> - float(-2147483648) + %s(-2147483648) [7]=> - float(-2147483649) + %s(-2147483649) } - Sort_flag = SORT_NUMERIC - bool(true) array(7) { [2]=> - float(2147483648) + %s(2147483648) [1]=> int(2147483647) [6]=> @@ -323,8 +319,8 @@ array(7) { [3]=> int(-2147483647) [4]=> - float(-2147483648) + %s(-2147483648) [7]=> - float(-2147483649) + %s(-2147483649) } Done
\ No newline at end of file diff --git a/ext/standard/tests/array/current_variation1.phpt b/ext/standard/tests/array/current_variation1.phpt index 111b8de4f7..6afed34d45 100644 --- a/ext/standard/tests/array/current_variation1.phpt +++ b/ext/standard/tests/array/current_variation1.phpt @@ -198,6 +198,8 @@ Warning: current() expects parameter 1 to be array, string given in %s on line % NULL -- Iteration 21 -- + +Warning: current() expects parameter 1 to be array, object given in %s on line %d NULL -- Iteration 22 -- diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt index 0806bee674..0834435610 100644 --- a/ext/standard/tests/array/each_error.phpt +++ b/ext/standard/tests/array/each_error.phpt @@ -39,5 +39,4 @@ NULL Warning: each() expects exactly 1 parameter, 2 given in %s on line %d NULL -Done - +Done
\ No newline at end of file diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt index 16b6096396..6ac57a736e 100644 --- a/ext/standard/tests/array/each_variation4.phpt +++ b/ext/standard/tests/array/each_variation4.phpt @@ -1,5 +1,7 @@ --TEST-- Test each() function : usage variations - Referenced variables +--INI-- +allow_call_time_pass_reference=on --FILE-- <?php /* Prototype : array each(array $arr) @@ -85,4 +87,4 @@ array(3) { [2]=> string(3) "two" } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/end_variation1.phpt b/ext/standard/tests/array/end_variation1.phpt index 79354aba4f..eb10b5e583 100644 --- a/ext/standard/tests/array/end_variation1.phpt +++ b/ext/standard/tests/array/end_variation1.phpt @@ -201,7 +201,9 @@ Warning: end() expects parameter 1 to be array, string given in %s on line %d NULL -- Iteration 22 -- -string(12) "hello, world" + +Warning: end() expects parameter 1 to be array, object given in %s on line %d +NULL -- Iteration 23 -- diff --git a/ext/standard/tests/array/key_variation1.phpt b/ext/standard/tests/array/key_variation1.phpt index a0c59b4956..9aade55f1b 100644 --- a/ext/standard/tests/array/key_variation1.phpt +++ b/ext/standard/tests/array/key_variation1.phpt @@ -201,7 +201,9 @@ Warning: key() expects parameter 1 to be array, string given in %s on line %d NULL -- Iteration 22 -- -string(4) "var1" + +Warning: key() expects parameter 1 to be array, object given in %s on line %d +NULL -- Iteration 23 -- diff --git a/ext/standard/tests/array/natcasesort_variation1.phpt b/ext/standard/tests/array/natcasesort_variation1.phpt index 59eadedf66..04e3c05da6 100644 --- a/ext/standard/tests/array/natcasesort_variation1.phpt +++ b/ext/standard/tests/array/natcasesort_variation1.phpt @@ -220,4 +220,3 @@ NULL Warning: natcasesort() expects parameter 1 to be array, resource given in %s on line %d NULL Done - diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt index 77f83e1d09..f151508433 100644 --- a/ext/standard/tests/array/natcasesort_variation3.phpt +++ b/ext/standard/tests/array/natcasesort_variation3.phpt @@ -132,4 +132,4 @@ array(7) { [1]=> float(2147483648) } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/next_variation1.phpt b/ext/standard/tests/array/next_variation1.phpt index 5f477b442e..313add035a 100644 --- a/ext/standard/tests/array/next_variation1.phpt +++ b/ext/standard/tests/array/next_variation1.phpt @@ -200,7 +200,9 @@ Warning: next() expects parameter 1 to be array, string given in %s on line %d NULL -- Iteration 22 -- -bool(false) + +Warning: next() expects parameter 1 to be array, object given in %s on line %d +NULL -- Iteration 23 -- diff --git a/ext/standard/tests/array/reset_variation1.phpt b/ext/standard/tests/array/reset_variation1.phpt index b6cddf0cb5..1c19c95de7 100644 --- a/ext/standard/tests/array/reset_variation1.phpt +++ b/ext/standard/tests/array/reset_variation1.phpt @@ -200,7 +200,9 @@ Warning: reset() expects parameter 1 to be array, string given in %s on line %d NULL -- Iteration 22 -- -bool(false) + +Warning: reset() expects parameter 1 to be array, object given in %s on line %d +NULL -- Iteration 23 -- diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt index f8c002a6f7..798e148c7b 100644 --- a/ext/standard/tests/array/rsort_variation3.phpt +++ b/ext/standard/tests/array/rsort_variation3.phpt @@ -322,4 +322,4 @@ array(7) { [6]=> float(-2147483649) } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt index abbed35bad..4cab1a9334 100644 --- a/ext/standard/tests/array/rsort_variation4.phpt +++ b/ext/standard/tests/array/rsort_variation4.phpt @@ -1,5 +1,7 @@ --TEST-- Test rsort() function : usage variations - referenced variables +--INI-- +allow_call_time_pass_reference=on --FILE-- <?php /* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) @@ -75,4 +77,4 @@ array(3) { [2]=> &int(33) } -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/file/001-win32.phpt b/ext/standard/tests/file/001-win32.phpt index ee520940e4..d6709e8d04 100644 --- a/ext/standard/tests/file/001-win32.phpt +++ b/ext/standard/tests/file/001-win32.phpt @@ -1,7 +1,5 @@ --TEST-- File type functions ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) != 'WIN') { @@ -12,6 +10,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { <?php chdir(dirname(__FILE__)); @unlink('test.file'); +@unlink('test.link'); if (file_exists('test.file')) { echo "test.file exists\n"; } else { @@ -24,11 +23,22 @@ if (file_exists('test.file')) { } else { echo "test.file does not exist\n"; } +sleep (2); +if (file_exists('test.link')) { + echo "test.link exists\n"; +} else { + echo "test.link does not exist\n"; +} if (is_link('test.file')) { echo "test.file is a symlink\n"; } else { echo "test.file is not a symlink\n"; } +if (is_link('test.link')) { + echo "test.link is a symlink\n"; +} else { + echo "test.link is not a symlink\n"; +} if (file_exists('test.file')) { echo "test.file exists\n"; } else { @@ -42,6 +52,7 @@ for ($i = 0; $i <= 12; $i++) { } } echo "test.file is " . filetype('test.file') . "\n"; +echo "test.link is <" . filetype('test.link') . ">\n"; printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file')); echo "test.file size is " . filesize('test.file') . "\n"; if (is_writeable('test.file')) { @@ -59,6 +70,16 @@ if (is_file('test.file')) { } else { echo "test.file is not a regular file\n"; } +if (is_file('test.link')) { + echo "test.link is a regular file\n"; +} else { + echo "test.link is not a regular file\n"; +} +if (is_dir('test.link')) { + echo "test.link is a directory\n"; +} else { + echo "test.link is not a directory\n"; +} if (is_dir('../file')) { echo "../file is a directory\n"; } else { @@ -82,19 +103,25 @@ if (file_exists('test.file')) { echo "test.file does not exist\n"; } ?> ---EXPECT-- +--EXPECTF-- test.file does not exist test.file exists +test.link does not exist test.file is not a symlink +test.link is not a symlink test.file exists test.file is file + +Warning: filetype(): Lstat failed for test.link in %s +test.link is <> test.file permissions are 0666 test.file size is 0 test.file is writeable test.file is readable test.file is a regular file +test.link is not a regular file +test.link is not a directory ../file is a directory test.file is not a directory test.file does not exist test.file does not exist - diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt index bef7a89f44..04cc274ecc 100644 --- a/ext/standard/tests/file/006_error.phpt +++ b/ext/standard/tests/file/006_error.phpt @@ -11,7 +11,7 @@ $fp = fopen($filename, 'w'); fclose($fp); if(fileowner($filename) == 0) { unlink ($filename); - die('skip...cannot be run as root\n'); + die('skip cannot be run as root'); } unlink($filename); @@ -68,13 +68,13 @@ unlink( dirname(__FILE__)."/006_error.tmp"); --EXPECTF-- *** Testing error conditions for fileperms(), chmod() *** -Warning: chmod(): Operation not permitted in %s on line %d +Warning: chmod(): %s in %s on line %d bool(false) -%d +100%d44 -Warning: chmod(): Operation not permitted in %s on line %d +Warning: chmod(): %s in %s on line %d bool(false) -%d +40755 Warning: chmod(): No such file or directory in %s on line %d bool(false) @@ -105,4 +105,3 @@ Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d NULL *** Done *** - diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index 9c9707664e..d56207a349 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -11,7 +11,7 @@ $fp = fopen($filename, 'w'); fclose($fp); if(fileowner($filename) == 0) { unlink ($filename); - die('skip...cannot be run as root\n'); + die('skip cannot be run as root'); } unlink($filename); @@ -94,94 +94,93 @@ rmdir(dirname(__FILE__)."/006_variation2"); *** Testing fileperms(), chmod() with miscellaneous permissions *** -- Iteration 1 -- bool(true) -%d +107777 bool(true) -%d +47777 -- Iteration 2 -- bool(true) -%d +100000 bool(true) -%d +40000 -- Iteration 3 -- bool(true) -%d +101000 bool(true) -%d +41000 -- Iteration 4 -- bool(true) -%d +101111 bool(true) -%d +41111 -- Iteration 5 -- bool(true) -%d +107001 bool(true) -%d +47001 -- Iteration 6 -- bool(true) -%d +100001 bool(true) -%d +40001 -- Iteration 7 -- bool(true) -%d +101411 bool(true) -%d +41411 -- Iteration 8 -- bool(true) -%d +107141 bool(true) -%d +47141 -- Iteration 9 -- bool(true) -%d +100637 bool(true) -%d +40637 -- Iteration 10 -- bool(true) -%d +103567 bool(true) -%d +43567 -- Iteration 11 -- bool(true) -%d +103567 bool(true) -%d +43567 -- Iteration 12 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +103567 Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +43567 -- Iteration 13 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +103567 Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +43567 -- Iteration 14 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +103567 Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +43567 -- Iteration 15 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +103567 Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -%d +43567 *** Done *** - diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt index ecec336f84..cc986ebdae 100644 --- a/ext/standard/tests/file/007_error.phpt +++ b/ext/standard/tests/file/007_error.phpt @@ -1,7 +1,5 @@ --TEST-- Test fopen, fclose() & feof() functions: error conditions ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> --FILE-- <?php /* @@ -46,6 +44,7 @@ var_dump( feof($fp, "handle")); fclose($fp); /* test invalid arguments : non-resources */ +chdir(dirname(__FILE__)); echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n"; $invalid_args = array ( "string", @@ -79,7 +78,7 @@ bool(false) Warning: fclose(): 5 is not a valid stream resource in %s on line %d bool(false) -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d +Warning: fclose() expects parameter 1 to be resource, string given %s on line %d bool(false) Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d @@ -88,7 +87,7 @@ bool(false) Warning: feof(): 5 is not a valid stream resource in %s on line %d bool(false) -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d +Warning: feof() expects parameter 1 to be resource, string given %s on line %d bool(false) Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d @@ -179,4 +178,3 @@ bool(false) Warning: feof() expects parameter 1 to be resource, string given in %s on line %d bool(false) - diff --git a/ext/standard/tests/file/bug41655_1.phpt b/ext/standard/tests/file/bug41655_1.phpt index 62d64dfb1e..d02de7066a 100644 --- a/ext/standard/tests/file/bug41655_1.phpt +++ b/ext/standard/tests/file/bug41655_1.phpt @@ -1,15 +1,12 @@ --TEST-- Bug #41655 (open_basedir bypass via glob()) 1/2 ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> --INI-- open_basedir=/tmp --FILE-- <?php -$a=glob("./*.jpeg"); -var_dump($a); + $a=glob("./*.jpeg"); + echo "Done\n"; ?> --EXPECT-- -bool(false) Done
\ No newline at end of file diff --git a/ext/standard/tests/file/copy_variation13.phpt b/ext/standard/tests/file/copy_variation13.phpt index 779f82b6f6..a71c597e41 100644 --- a/ext/standard/tests/file/copy_variation13.phpt +++ b/ext/standard/tests/file/copy_variation13.phpt @@ -1,5 +1,5 @@ --TEST-- -Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243) +Test copy() function: usage variations - src as dir and dest as an existing file (Bug #42243) --FILE-- <?php /* Prototype: bool copy ( string $source, string $dest ); diff --git a/ext/standard/tests/file/copy_variation15.phpt b/ext/standard/tests/file/copy_variation15.phpt index fbf5e7bf9e..a6404fcd8d 100644 --- a/ext/standard/tests/file/copy_variation15.phpt +++ b/ext/standard/tests/file/copy_variation15.phpt @@ -2,8 +2,8 @@ Test copy() function: usage variations - destination dir access perms --SKIPIF-- <?php -if(substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); +if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) ) + die("skip do not run on MacOS/Windows"); // Skip if being run by root (files are always readable, writeable and executable) $filename = dirname(__FILE__)."/copy_variation15_root_check.tmp"; $fp = fopen($filename, 'w'); diff --git a/ext/standard/tests/file/copy_variation18.phpt b/ext/standard/tests/file/copy_variation18.phpt index 53467af8a3..65c1dc2ef6 100644 --- a/ext/standard/tests/file/copy_variation18.phpt +++ b/ext/standard/tests/file/copy_variation18.phpt @@ -16,7 +16,7 @@ require($file_path."/file.inc"); echo "*** Test copy() function: stat of file before and after copy ***\n"; $src_file_name = $file_path."/copy_variation18.tmp"; $file_handle = fopen($src_file_name, "w"); -fwrite($file_handle, str_repeat("Hello2world...\n", 100)); +fwrite($file_handle, str_repeat(b"Hello2world...\n", 100)); fclose($file_handle); $dest_file_name = $file_path."/copy_copy_variation18.tmp"; @@ -32,13 +32,8 @@ var_dump( copy($src_file_name, $dest_file_name) ); $stat_after_copy = stat($src_file_name); clearstatcache(); -// compare all stat fields except access time -$stat_keys_to_compare = array("dev", "ino", "mode", "nlink", "uid", "gid", - "rdev", "size", "mtime", "ctime", - "blksize", "blocks"); - echo "Comparing the stats of file before and after copy operation => "; -var_dump( compare_stats($stat_before_copy, $stat_after_copy, $stat_keys_to_compare) ); +var_dump( compare_stats($stat_before_copy, $stat_after_copy, $all_stat_keys) ); echo "*** Done ***\n"; ?> @@ -48,7 +43,6 @@ echo "*** Done ***\n"; unlink(dirname(__FILE__)."/copy_copy_variation18.tmp"); unlink(dirname(__FILE__)."/copy_variation18.tmp"); ?> - --EXPECTF-- *** Test copy() function: stat of file before and after copy *** Copy operation => bool(true) diff --git a/ext/standard/tests/file/copy_variation9.phpt b/ext/standard/tests/file/copy_variation9.phpt index 824bed0c76..d5a0587de4 100644 --- a/ext/standard/tests/file/copy_variation9.phpt +++ b/ext/standard/tests/file/copy_variation9.phpt @@ -2,8 +2,8 @@ Test copy() function: usage variations - destination file access perms --SKIPIF-- <?php -if(substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); +if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) ) + die("skip do not run on MacOS/Windows"); // Skip if being run by root (files are always readable, writeable and executable) $filename = dirname(__FILE__)."/copy_variation9_root_check.tmp"; diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt index e1a74fc984..6eef4b4a77 100644 --- a/ext/standard/tests/file/disk.phpt +++ b/ext/standard/tests/file/disk.phpt @@ -37,8 +37,8 @@ bool(false) Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) -float(%f) -float(%f) +float(%d) +float(%d) Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt b/ext/standard/tests/file/disk_free_space_basic.phpt index cae37bad59..f8684e92a9 100644 --- a/ext/standard/tests/file/disk_free_space_basic.phpt +++ b/ext/standard/tests/file/disk_free_space_basic.phpt @@ -7,26 +7,27 @@ memory_limit=32M /* * Prototype: float disk_free_space( string directory ) * Description: Given a string containing a directory, this function - * will return the number of bytes available on the corresponding - * filesystem or disk partition + * will return the number of bytes available on the corresponding + * filesystem or disk partition */ $file_path = dirname(__FILE__); -include($file_path."/file.inc"); echo "*** Testing with existing directory ***\n"; var_dump( disk_free_space($file_path) ); var_dump( diskfreespace($file_path) ); -$dir = "/disk_free_space"; echo "*** Testing with newly created directory ***\n"; +$dir = "/disk_free_space"; mkdir($file_path.$dir); echo" \n Free Space before writing to a file\n"; $space1 = disk_free_space($file_path.$dir); -var_dump($space1); +var_dump( $space1 ); -fill_buffer($buffer, "text", 3000000); -file_put_contents($file_path.$dir."/disk_free_space.tmp", $buffer); +$fh = fopen($file_path.$dir."/disk_free_space.tmp", "a"); +for( $i=1; $i<=1000; $i++) +fwrite($fh, (binary)"x"); +fclose($fh); echo "\n Free Space after writing to a file\n"; $space2 = disk_free_space($file_path.$dir); @@ -37,29 +38,33 @@ if( $space1 > $space2 ) else echo "\n Free Space Value Is Incorrect\n"; -echo"\n-- Done --"; +echo "*** Testing with Binary Input ***\n"; +var_dump( disk_free_space(b"$file_path") ); + +echo"\n--- Done ---"; ?> --CLEAN-- <?php $file_path = dirname(__FILE__); -$dir = "/disk_free_space"; -unlink($file_path.$dir."/disk_free_space.tmp"); -rmdir($file_path.$dir); +unlink($file_path."/disk_free_space/disk_free_space.tmp"); +rmdir($file_path."/disk_free_space"); ?> --EXPECTF-- *** Testing with existing directory *** -float(%f) -float(%f) +float(%d) +float(%d) *** Testing with newly created directory *** Free Space before writing to a file -float(%f) +float(%d) Free Space after writing to a file -float(%f) +float(%d) Free Space Value Is Correct +*** Testing with Binary Input *** +float(%d) --- Done -- +--- Done --- diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt index 945b7b9c84..ddd25a35db 100644 --- a/ext/standard/tests/file/disk_free_space_error.phpt +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -1,15 +1,15 @@ --TEST-- -Test disk_free_space and its alias diskfreespace() functions : error conditions +Test disk_free_space and its alias diskfreespace() functions : error conditions. --SKIPIF-- <?php -if(substr(PHP_OS, 0, 3) == 'WIN' ) - die("skip Not Valid for Windows"); +if(substr(PHP_OS, 0, 3) == 'WIN') + die("skip Not valid on Windows"); ?> --FILE-- <?php /* * Prototype: float disk_free_space( string directory ) - * Description: Given a string containing a directory, this function will + * Description: Given a string containing a directory, this function will * return the number of bytes available on the corresponding * filesystem or disk partition */ @@ -27,7 +27,7 @@ var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); $fh = fopen( $file_path."/disk_free_space.tmp", "w" ); -fwrite( $fh, " Garbage data for the temporary file" ); +fwrite( $fh, (binary)" Garbage data for the temporary file" ); var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory var_dump( diskfreespace( $file_path."/disk_free_space.tmp" )); fclose($fh); @@ -55,12 +55,13 @@ NULL Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d NULL -Warning: disk_free_space(): %s in %s on line %d +Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) -Warning: diskfreespace(): %s in %s on line %d +Warning: diskfreespace(): No such file or directory in %s on line %d bool(false) -float(%f) -float(%f) +float(%d) +float(%d) -- Done -- + diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index 01fa183735..c1809986fd 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -1,5 +1,5 @@ --TEST-- -Test disk_free_space and its alias diskfreespace() functions : usage variations +Test disk_free_space and its alias diskfreespace() functions : Usage Variations --FILE-- <?php /* @@ -11,16 +11,15 @@ Test disk_free_space and its alias diskfreespace() functions : usage variations $file_path = dirname(__FILE__); -echo "*** Testing disk_free_space() function with a directory ***\n"; +echo "*** Testing with a directory ***\n"; var_dump( disk_free_space($file_path."/..") ); var_dump( diskfreespace($file_path."/..") ); -echo "\n*** Testing for the return type ***\n"; +echo "\nTesting for the return type ***\n"; $return_value = disk_free_space($file_path); var_dump( is_float($return_value) ); -echo "\n*** Testing disk_free_space() function with different styles of file and directory ***"; - +echo "\n*** Testing with different directory combinations ***"; $dir = "/disk_free_space"; mkdir($file_path.$dir); @@ -42,15 +41,15 @@ $dirs_arr = array( $file_path.$dir.chr(0), $file_path."/.".$dir.chr(0), ".".chr(0).$file_path.$dir, - ".".chr(0).$file_path.$dir.chr(0) + ".".chr(0).$file_path.$dir.chr(0) ); $count = 1; /* loop through to test each element the above array */ -foreach($dirs_arr as $dir) { +foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_free_space( $dir ) ); - var_dump( diskfreespace( $dir ) ); + var_dump( disk_free_space( $dir1 ) ); + var_dump( diskfreespace( $dir1 ) ); $count++; } @@ -59,65 +58,66 @@ echo"\n--- Done ---"; --CLEAN-- <?php -$file_path = dirname(__FILE__)."/disk_free_space"; -rmdir($file_path); +$file_path = dirname(__FILE__); +rmdir($file_path."/disk_free_space"); ?> + --EXPECTF-- -*** Testing disk_free_space() function with a directory *** -float(%f) -float(%f) +*** Testing with a directory *** +float(%d) +float(%d) -*** Testing for the return type *** +Testing for the return type *** bool(true) -*** Testing disk_free_space() function with different styles of file and directory *** +*** Testing with different directory combinations *** -- Iteration 1 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 2 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 3 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 4 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 5 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 6 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 7 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 8 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 9 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 10 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 11 -- -float(%f) -float(%f) +float(%d) +float(%d) -- Iteration 12 -- -float(%f) -float(%f) +float(%d) +float(%d) --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_basic.phpt b/ext/standard/tests/file/disk_total_space_basic.phpt index 8f3a2f21c3..d211f39437 100644 --- a/ext/standard/tests/file/disk_total_space_basic.phpt +++ b/ext/standard/tests/file/disk_total_space_basic.phpt @@ -4,31 +4,31 @@ Test disk_total_space() function : basic functionality <?php /* * Prototype: float disk_total_space( string $directory ); - * Description: given a string containing a directory, this - * function will return the total number of bytes - * on the corresponding filesyatem or disk partition. + * Description: given a string containing a directory, this function will + * return the total number of bytes on the corresponding filesyatem + * or disk partition. */ $file_path = dirname(__FILE__); -echo "*** Testing with existing directory ***\n"; +echo "*** Testing with normal directory ***\n"; var_dump( disk_total_space($file_path) ); echo "*** Testing with newly created directory ***\n"; -mkdir($file_path."/disk_total_space"); -var_dump( disk_total_space($file_path."/disk_total_space") ); +$dir = "/disk_total_space"; -$fh = fopen($file_path."/disk_total_space/disk_total_space.tmp", "w"); -fwrite($fh, "Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data"); +mkdir($file_path.$dir); +var_dump( disk_total_space($file_path.$dir) ); +$fh = fopen($file_path.$dir."/disk_total_space.tmp", "w"); +fwrite($fh, (binary)"Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data"); fclose($fh); -echo" \n Total Space after writing to a file\n"; -var_dump( disk_total_space($file_path."/disk_total_space") ); +echo"\nTotal Space after writing to a file\n"; +var_dump( disk_total_space($file_path.$dir) ); -echo"\n--- Done ---"; +echo"\n-- Done --"; ?> - --CLEAN-- <?php $file_path = dirname(__FILE__); @@ -37,12 +37,12 @@ rmdir($file_path."/disk_total_space"); ?> --EXPECTF-- -*** Testing with existing directory *** -float(%f) +*** Testing with normal directory *** +float(%d) *** Testing with newly created directory *** -float(%f) - - Total Space after writing to a file -float(%f) +float(%d) + +Total Space after writing to a file +float(%d) ---- Done --- +-- Done -- diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt index 196028007e..d986f779ba 100644 --- a/ext/standard/tests/file/disk_total_space_error.phpt +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -2,14 +2,14 @@ Test disk_total_space() function : error conditions --SKIPIF-- <?php -if(substr(PHP_OS, 0, 3) == 'WIN' ) - die("skip Not Valid for Windows"); +if(substr(PHP_OS, 0, 3) == 'WIN') + die("skip Not valid on Windows"); ?> --FILE-- <?php /* * Prototype: float disk_total_space( string $directory ); - * Description: given a string containing a directory, this function + * Description: given a string containing a directory, this function * will return the total number of bytes on the corresponding * filesystem or disk partition */ @@ -24,7 +24,7 @@ var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory $fh = fopen( $file_path."/disk_total_space.tmp", "w" ); -fwrite( $fh, " Garbage data for the temporary file" ); +fwrite( $fh, (binary)" Garbage data for the temporary file" ); var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory fclose($fh); @@ -46,6 +46,7 @@ NULL Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) -float(%f) +float(%d) --- Done --- + diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index 6cd96cd872..c03ba594bd 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -1,5 +1,5 @@ --TEST-- -Test disk_total_space() functions : usage variations +Testing disk_total_space() functions : Usage Variations. --FILE-- <?php /* @@ -18,9 +18,9 @@ echo "\nTesting for the return type ***\n"; $return_value = disk_total_space($file_path); var_dump( is_float($return_value) ); -echo "\n*** Testing disk_total_space() function with different directory combinations ***"; - +echo "\n*** Testing with different directory combinations ***"; $dir = "/disk_total_space"; + mkdir($file_path.$dir); $dirs_arr = array( @@ -29,7 +29,7 @@ $dirs_arr = array( $file_path."/.".$dir, /* Testing a file trailing slash */ - $file_path.$dir."/", + $file_path."".$dir."/", $file_path."/.".$dir."/", /* Testing file with double trailing slashes */ @@ -44,6 +44,7 @@ $dirs_arr = array( ".".chr(0).$file_path.$dir.chr(0) ); + $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { @@ -52,57 +53,63 @@ foreach($dirs_arr as $dir1) { $count++; } +echo "*** Testing with Binary Input ***\n"; +var_dump( disk_total_space(b"$file_path") ); + echo"\n--- Done ---"; ?> --CLEAN-- <?php $file_path = dirname(__FILE__); -$dir = "/disk_total_space"; -rmdir($file_path.$dir); +rmdir($file_path."/disk_total_space"); ?> + + --EXPECTF-- *** Testing with a directory *** -float(%f) +float(%d) Testing for the return type *** bool(true) -*** Testing disk_total_space() function with different directory combinations *** +*** Testing with different directory combinations *** -- Iteration 1 -- -float(%f) +float(%d) -- Iteration 2 -- -float(%f) +float(%d) -- Iteration 3 -- -float(%f) +float(%d) -- Iteration 4 -- -float(%f) +float(%d) -- Iteration 5 -- -float(%f) +float(%d) -- Iteration 6 -- -float(%f) +float(%d) -- Iteration 7 -- -float(%f) +float(%d) -- Iteration 8 -- -float(%f) +float(%d) -- Iteration 9 -- -float(%f) +float(%d) -- Iteration 10 -- -float(%f) +float(%d) -- Iteration 11 -- -float(%f) +float(%d) -- Iteration 12 -- -float(%f) +float(%d) +*** Testing with Binary Input *** +float(%d) --- Done --- diff --git a/ext/standard/tests/file/fflush_error.phpt b/ext/standard/tests/file/fflush_error.phpt index 9f745e5202..6d7f731763 100644 --- a/ext/standard/tests/file/fflush_error.phpt +++ b/ext/standard/tests/file/fflush_error.phpt @@ -24,10 +24,9 @@ if($file_handle == false) var_dump( fflush($file_handle, $file_handle) ); fclose($file_handle); -fflush($file_handle); // test invalid arguments : non-resources -echo "\n-- Testing fflush(): with invalid arguments --\n"; +echo "-- Testing fflush(): with invalid arguments --\n"; $invalid_args = array ( "string", 10, @@ -42,7 +41,7 @@ for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { echo "-- Iteration $loop_counter --\n"; var_dump( fflush($invalid_args[$loop_counter - 1]) ); } -echo "Done\n"; +echo "\n*** Done ***"; ?> --CLEAN-- @@ -61,9 +60,6 @@ bool(false) Warning: fflush() expects exactly 1 parameter, 2 given in %s on line %d bool(false) - -Warning: fflush(): %d is not a valid stream resource in %s on line %d - -- Testing fflush(): with invalid arguments -- -- Iteration 1 -- @@ -89,5 +85,6 @@ bool(false) Warning: fflush() expects parameter 1 to be resource, object given in %s on line %d bool(false) -Done + +*** Done *** diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt index 51ae3c6a37..a55c53f9bf 100644 --- a/ext/standard/tests/file/fgets_error.phpt +++ b/ext/standard/tests/file/fgets_error.phpt @@ -99,10 +99,9 @@ bool(false) Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing fgets() with closed/unset file handle -- -Warning: fgets(): %d is not a valid stream resource in %s on line %d +Warning: fgets(): 5 is not a valid stream resource in %s on line %d bool(false) Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index 964216bf8c..b24956a59d 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -43,10 +43,10 @@ echo "Done"; *** Testing fgets() : usage variations *** -- Testing fgets() with closed handle -- -Warning: fgets(): %d is not a valid stream resource in %s on line %d +Warning: fgets(): 6 is not a valid stream resource in %s on line %d bool(false) -Warning: fgets(): %d is not a valid stream resource in %s on line %d +Warning: fgets(): 6 is not a valid stream resource in %s on line %d bool(false) -- Testing fgets() with unset handle -- @@ -60,4 +60,3 @@ Notice: Undefined variable: file_handle in %s on line %d Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index efb425ca42..a18fd2ceb4 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -7,7 +7,7 @@ delete_links() : delete links fill_files() : fill file with specified contents change_file_perms() : Change permission of files - fill_buffer() : fills buffer with specified contents + fill_buffer() : fill buffer with specified contents compare_self_stat() : compares the first 13 elements of the stat with the corresponding named key values of the same stat. @@ -80,7 +80,7 @@ function fill_buffer(&$buffer, $fill_type, $fill_size) { } /* - Function : bool fill_file(resource $file_handle, string $fill_type, string $file_size); + Function : bool fill_file(resource $file_handle, string $fill_type, int $file_size); Description: Fills the file with data as specified with requested size. $file_handle = file handle, opened with write options, $fill_type: @@ -638,6 +638,8 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) { // if the result is false(i.e values are not as expected), // dump the stat array so that easy to figure out the error if ( $result == false ) { + echo "\n Dumping diff between stat array 1 and 2...\n"; + var_dump(array_diff($stat1, $stat2)); echo "\n Dumping stat array 1...\n"; var_dump($stat1); echo "\n Dumping stat array 2...\n"; diff --git a/ext/standard/tests/file/filesize_variation1.phpt b/ext/standard/tests/file/filesize_variation1.phpt index 0a490cd7e6..a8a4d4e7f5 100644 --- a/ext/standard/tests/file/filesize_variation1.phpt +++ b/ext/standard/tests/file/filesize_variation1.phpt @@ -3,7 +3,7 @@ Test filesize() function: usage variations - size of files --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip Not valid on Windows'); + die('skip only valid for Linux'); } --FILE-- <?php @@ -32,14 +32,14 @@ echo "Done\n"; --EXPECTF-- *** Testing filesize(): usage variations *** *** Checking filesize() with different size of files *** -int(%d) -int(%d) -int(%d) -int(%d) -int(%d) -int(%d) -int(%d) -int(%d) -int(%d) -int(%d) +int(1024) +int(1025024) +int(2049024) +int(3073024) +int(4097024) +int(5121024) +int(6145024) +int(7169024) +int(8193024) +int(9217024) Done diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index fe61e2a173..077e5430ba 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -94,7 +94,7 @@ NULL Warning: flock() expects parameter 2 to be long, string given in %s on line %d NULL -Warning: flock(): %d is not a valid stream resource in %s on line %d +Warning: flock(): 6 is not a valid stream resource in %s on line %d bool(false) Warning: flock() expects parameter 1 to be resource, string given in %s on line %d diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt index 339f10cb9f..af67ab402a 100644 --- a/ext/standard/tests/file/flock_variation.phpt +++ b/ext/standard/tests/file/flock_variation.phpt @@ -1,45 +1,371 @@ --TEST-- -Test flock() function: usage variations +Test flock() function: Variations --FILE-- <?php /* Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]); -Description: PHP supports a portable way of locking complete files in an advisory way +Description: PHP supports a portable way of locking complete files + in an advisory way */ -echo "*** Test flock() function: with the operations given as numeric values ***\n"; +echo "*** Testing flock() fun with the various operation and + wouldblock values ***\n"; +$file = dirname(__FILE__)."/flock.tmp"; +$fp = fopen($file, "w"); -$filename = dirname(__FILE__)."/flock_variation.tmp"; -$file_handle = fopen($filename, "w"); - -/* array of operations */ +/* array of operatons */ $operations = array( - 1, //nothing but LOCK_SH - 2, //nothing but LOCK_EX - 2.234, //nothing but LOCK_EX - TRUE //nothing but LOCK_SH + LOCK_SH, + LOCK_EX, + LOCK_SH|LOCK_NB, + LOCK_EX|LOCK_NB, + LOCK_SH|LOCK_EX, + LOCK_UN, + 1, + 2, + 2.234, + TRUE +); + +/* array of wouldblocks */ +$wouldblocks = array( + 0, + 1, + 2, + 1.234, + TRUE, + FALSE, + NULL, + array(1,2,3), + array(), + "string", + "", + /* binary input */ + b"string", + b"", + "\0" ); $i = 0; foreach($operations as $operation) { - var_dump(flock($file_handle, $operation)); - var_dump(flock($file_handle, 3)); //nothing but LOCK_UN + echo "--- Outer iteration $i ---\n"; + var_dump(flock($fp, $operation)); + $j = 0; + foreach($wouldblocks as $wouldblock) { + echo "-- Inner iteration $j in $i --\n"; + var_dump(flock($fp, $operation, $wouldblock)); + $j++; + } $i++; } -fclose($file_handle); -unlink($filename); +fclose($fp); +@unlink($file); -echo "*** Done ***\n"; +echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Test flock() function: with the operations given as numeric values *** +*** Testing flock() fun with the various operation and + wouldblock values *** +--- Outer iteration 0 --- +bool(true) +-- Inner iteration 0 in 0 -- +bool(true) +-- Inner iteration 1 in 0 -- +bool(true) +-- Inner iteration 2 in 0 -- +bool(true) +-- Inner iteration 3 in 0 -- +bool(true) +-- Inner iteration 4 in 0 -- +bool(true) +-- Inner iteration 5 in 0 -- +bool(true) +-- Inner iteration 6 in 0 -- +bool(true) +-- Inner iteration 7 in 0 -- +bool(true) +-- Inner iteration 8 in 0 -- +bool(true) +-- Inner iteration 9 in 0 -- +bool(true) +-- Inner iteration 10 in 0 -- +bool(true) +-- Inner iteration 11 in 0 -- +bool(true) +-- Inner iteration 12 in 0 -- +bool(true) +-- Inner iteration 13 in 0 -- +bool(true) +--- Outer iteration 1 --- +bool(true) +-- Inner iteration 0 in 1 -- +bool(true) +-- Inner iteration 1 in 1 -- +bool(true) +-- Inner iteration 2 in 1 -- +bool(true) +-- Inner iteration 3 in 1 -- +bool(true) +-- Inner iteration 4 in 1 -- +bool(true) +-- Inner iteration 5 in 1 -- +bool(true) +-- Inner iteration 6 in 1 -- +bool(true) +-- Inner iteration 7 in 1 -- +bool(true) +-- Inner iteration 8 in 1 -- +bool(true) +-- Inner iteration 9 in 1 -- +bool(true) +-- Inner iteration 10 in 1 -- +bool(true) +-- Inner iteration 11 in 1 -- +bool(true) +-- Inner iteration 12 in 1 -- +bool(true) +-- Inner iteration 13 in 1 -- +bool(true) +--- Outer iteration 2 --- +bool(true) +-- Inner iteration 0 in 2 -- +bool(true) +-- Inner iteration 1 in 2 -- +bool(true) +-- Inner iteration 2 in 2 -- +bool(true) +-- Inner iteration 3 in 2 -- +bool(true) +-- Inner iteration 4 in 2 -- +bool(true) +-- Inner iteration 5 in 2 -- +bool(true) +-- Inner iteration 6 in 2 -- +bool(true) +-- Inner iteration 7 in 2 -- +bool(true) +-- Inner iteration 8 in 2 -- +bool(true) +-- Inner iteration 9 in 2 -- +bool(true) +-- Inner iteration 10 in 2 -- +bool(true) +-- Inner iteration 11 in 2 -- +bool(true) +-- Inner iteration 12 in 2 -- +bool(true) +-- Inner iteration 13 in 2 -- +bool(true) +--- Outer iteration 3 --- +bool(true) +-- Inner iteration 0 in 3 -- +bool(true) +-- Inner iteration 1 in 3 -- +bool(true) +-- Inner iteration 2 in 3 -- +bool(true) +-- Inner iteration 3 in 3 -- +bool(true) +-- Inner iteration 4 in 3 -- +bool(true) +-- Inner iteration 5 in 3 -- +bool(true) +-- Inner iteration 6 in 3 -- +bool(true) +-- Inner iteration 7 in 3 -- +bool(true) +-- Inner iteration 8 in 3 -- +bool(true) +-- Inner iteration 9 in 3 -- +bool(true) +-- Inner iteration 10 in 3 -- +bool(true) +-- Inner iteration 11 in 3 -- +bool(true) +-- Inner iteration 12 in 3 -- +bool(true) +-- Inner iteration 13 in 3 -- +bool(true) +--- Outer iteration 4 --- +bool(true) +-- Inner iteration 0 in 4 -- +bool(true) +-- Inner iteration 1 in 4 -- +bool(true) +-- Inner iteration 2 in 4 -- +bool(true) +-- Inner iteration 3 in 4 -- +bool(true) +-- Inner iteration 4 in 4 -- +bool(true) +-- Inner iteration 5 in 4 -- +bool(true) +-- Inner iteration 6 in 4 -- +bool(true) +-- Inner iteration 7 in 4 -- +bool(true) +-- Inner iteration 8 in 4 -- +bool(true) +-- Inner iteration 9 in 4 -- bool(true) +-- Inner iteration 10 in 4 -- bool(true) +-- Inner iteration 11 in 4 -- bool(true) +-- Inner iteration 12 in 4 -- bool(true) +-- Inner iteration 13 in 4 -- bool(true) +--- Outer iteration 5 --- bool(true) +-- Inner iteration 0 in 5 -- bool(true) +-- Inner iteration 1 in 5 -- bool(true) +-- Inner iteration 2 in 5 -- +bool(true) +-- Inner iteration 3 in 5 -- +bool(true) +-- Inner iteration 4 in 5 -- +bool(true) +-- Inner iteration 5 in 5 -- +bool(true) +-- Inner iteration 6 in 5 -- +bool(true) +-- Inner iteration 7 in 5 -- +bool(true) +-- Inner iteration 8 in 5 -- +bool(true) +-- Inner iteration 9 in 5 -- +bool(true) +-- Inner iteration 10 in 5 -- +bool(true) +-- Inner iteration 11 in 5 -- +bool(true) +-- Inner iteration 12 in 5 -- +bool(true) +-- Inner iteration 13 in 5 -- +bool(true) +--- Outer iteration 6 --- +bool(true) +-- Inner iteration 0 in 6 -- +bool(true) +-- Inner iteration 1 in 6 -- +bool(true) +-- Inner iteration 2 in 6 -- +bool(true) +-- Inner iteration 3 in 6 -- +bool(true) +-- Inner iteration 4 in 6 -- +bool(true) +-- Inner iteration 5 in 6 -- +bool(true) +-- Inner iteration 6 in 6 -- +bool(true) +-- Inner iteration 7 in 6 -- +bool(true) +-- Inner iteration 8 in 6 -- +bool(true) +-- Inner iteration 9 in 6 -- +bool(true) +-- Inner iteration 10 in 6 -- +bool(true) +-- Inner iteration 11 in 6 -- +bool(true) +-- Inner iteration 12 in 6 -- +bool(true) +-- Inner iteration 13 in 6 -- +bool(true) +--- Outer iteration 7 --- +bool(true) +-- Inner iteration 0 in 7 -- +bool(true) +-- Inner iteration 1 in 7 -- +bool(true) +-- Inner iteration 2 in 7 -- +bool(true) +-- Inner iteration 3 in 7 -- +bool(true) +-- Inner iteration 4 in 7 -- +bool(true) +-- Inner iteration 5 in 7 -- +bool(true) +-- Inner iteration 6 in 7 -- +bool(true) +-- Inner iteration 7 in 7 -- +bool(true) +-- Inner iteration 8 in 7 -- +bool(true) +-- Inner iteration 9 in 7 -- +bool(true) +-- Inner iteration 10 in 7 -- +bool(true) +-- Inner iteration 11 in 7 -- +bool(true) +-- Inner iteration 12 in 7 -- +bool(true) +-- Inner iteration 13 in 7 -- +bool(true) +--- Outer iteration 8 --- +bool(true) +-- Inner iteration 0 in 8 -- +bool(true) +-- Inner iteration 1 in 8 -- +bool(true) +-- Inner iteration 2 in 8 -- +bool(true) +-- Inner iteration 3 in 8 -- +bool(true) +-- Inner iteration 4 in 8 -- +bool(true) +-- Inner iteration 5 in 8 -- +bool(true) +-- Inner iteration 6 in 8 -- +bool(true) +-- Inner iteration 7 in 8 -- +bool(true) +-- Inner iteration 8 in 8 -- +bool(true) +-- Inner iteration 9 in 8 -- +bool(true) +-- Inner iteration 10 in 8 -- +bool(true) +-- Inner iteration 11 in 8 -- +bool(true) +-- Inner iteration 12 in 8 -- +bool(true) +-- Inner iteration 13 in 8 -- +bool(true) +--- Outer iteration 9 --- +bool(true) +-- Inner iteration 0 in 9 -- +bool(true) +-- Inner iteration 1 in 9 -- +bool(true) +-- Inner iteration 2 in 9 -- +bool(true) +-- Inner iteration 3 in 9 -- +bool(true) +-- Inner iteration 4 in 9 -- +bool(true) +-- Inner iteration 5 in 9 -- +bool(true) +-- Inner iteration 6 in 9 -- +bool(true) +-- Inner iteration 7 in 9 -- +bool(true) +-- Inner iteration 8 in 9 -- +bool(true) +-- Inner iteration 9 in 9 -- +bool(true) +-- Inner iteration 10 in 9 -- +bool(true) +-- Inner iteration 11 in 9 -- +bool(true) +-- Inner iteration 12 in 9 -- +bool(true) +-- Inner iteration 13 in 9 -- +bool(true) + *** Done *** diff --git a/ext/standard/tests/file/fnmatch_basic.phpt b/ext/standard/tests/file/fnmatch_basic.phpt index 4eb567c392..322362e8bf 100644 --- a/ext/standard/tests/file/fnmatch_basic.phpt +++ b/ext/standard/tests/file/fnmatch_basic.phpt @@ -2,11 +2,8 @@ Test fnmatch() function: Basic functionality --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); - -if (!function_exists('fnmatch')) - die("skip fnmatch() function is not available"); +if( (stristr(PHP_OS, "Mac")) || (stristr(PHP_OS, "Win")) ) + die("skip do not run on MacOS/Windows"); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/fnmatch_error.phpt b/ext/standard/tests/file/fnmatch_error.phpt index d139064115..9876133169 100644 --- a/ext/standard/tests/file/fnmatch_error.phpt +++ b/ext/standard/tests/file/fnmatch_error.phpt @@ -2,11 +2,8 @@ Test fnmatch() function: Error conditions --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); - -if (!function_exists('fnmatch')) - die("skip fnmatch() function is not available"); +if( (stristr(PHP_OS, "Mac")) || (stristr(PHP_OS, "Win")) ) + die("skip do not run on MacOS/Windows"); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 0e82e37430..c2d9932dd3 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -2,11 +2,8 @@ Test fnmatch() function: Variations --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); - -if (!function_exists('fnmatch')) - die("skip fnmatch() function is not available"); +if( (stristr(PHP_OS, "Mac")) || (stristr(PHP_OS, "Win")) ) + die("skip do not run on MacOS/Windows"); ?> --FILE-- <?php diff --git a/ext/standard/tests/file/fpassthru_error.phpt b/ext/standard/tests/file/fpassthru_error.phpt index 16dacfada9..958397b0e5 100644 --- a/ext/standard/tests/file/fpassthru_error.phpt +++ b/ext/standard/tests/file/fpassthru_error.phpt @@ -20,11 +20,6 @@ var_dump( fpassthru() ); /* No.of args greaer than expected */ var_dump( fpassthru("", "") ); -/* fpassthru on a closed file */ -$h = fopen(__FILE__,'r'); -fclose($h); -fpassthru($h); - echo "\n*** Done ***\n"; ?> @@ -42,7 +37,4 @@ bool(false) Warning: fpassthru() expects exactly 1 parameter, 2 given in %s on line %d bool(false) -Warning: fpassthru(): 5 is not a valid stream resource in %s on line %d - *** Done *** - diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt index c6259b6642..4bba8ecd7a 100644 --- a/ext/standard/tests/file/fread_error.phpt +++ b/ext/standard/tests/file/fread_error.phpt @@ -103,7 +103,7 @@ bool(false) Notice: Undefined variable: file_content_type in %s on line %d -Warning: fread(): %d is not a valid stream resource in %s on line %d +Warning: fread(): 5 is not a valid stream resource in %s on line %d bool(false) Warning: fread() expects parameter 1 to be resource, null given in %s on line %d @@ -112,4 +112,3 @@ bool(false) Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/fseek_dir_basic.phpt b/ext/standard/tests/file/fseek_dir_basic.phpt index cde0bf2579..c6d0816e91 100644 --- a/ext/standard/tests/file/fseek_dir_basic.phpt +++ b/ext/standard/tests/file/fseek_dir_basic.phpt @@ -42,7 +42,7 @@ var_dump(rmdir($path)); ?> --EXPECTF-- call readdir(): -resource(%d) of type (stream) +resource(12) of type (stream) array(6) { [0]=> bool(false) diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index 23eb991ebe..0af71e65fc 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -91,10 +91,9 @@ bool(false) Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing fseek() with closed/unset file handle -- -Warning: fseek(): %d is not a valid stream resource in %s on line %d +Warning: fseek(): 5 is not a valid stream resource in %s on line %d bool(false) Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index af14dbb270..31c9be70be 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -87,10 +87,9 @@ bool(false) Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing ftell with closed/unset file handle -- -Warning: ftell(): %d is not a valid stream resource in %s on line %d +Warning: ftell(): 5 is not a valid stream resource in %s on line %d bool(false) Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index 2d8f52768e..09ed54374d 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -87,10 +87,9 @@ bool(false) Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing rewind() with closed/unset file handle -- -Warning: rewind(): %d is not a valid stream resource in %s on line %d +Warning: rewind(): 5 is not a valid stream resource in %s on line %d bool(false) Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index 2f22d4e25f..a28095bc2d 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -11,7 +11,7 @@ echo "*** Testing ftruncate() : error conditions ***\n"; $filename = dirname(__FILE__)."/ftruncate_error.tmp"; $file_handle = fopen($filename, "w" ); -fwrite($file_handle, "Testing ftruncate error conditions \n"); +fwrite($file_handle, (binary)"Testing ftruncate error conditions \n"); fflush($file_handle); echo "\n Initial file size = ".filesize($filename)."\n"; @@ -23,14 +23,12 @@ var_dump( ftruncate() ); // arguments less than expected numbers var_dump( ftruncate( $file_handle ) ); // check the first size -clearstatcache(); var_dump( filesize($filename) ); echo "-- Testing ftruncate() with more than expected number of arguments --\n"; // more than expected number of arguments var_dump( ftruncate($file_handle, 10, 20) ); -// check the first size -clearstatcache(); +// check the first size var_dump( filesize($filename) ); // test invalid arguments : non-resources @@ -55,16 +53,14 @@ echo "-- Testing ftruncate() with closed/unset file handle --\n"; // ftruncate on close file handle fclose($file_handle); var_dump( ftruncate($file_handle,10) ); -// check the first size -clearstatcache(); +// check the first size var_dump( filesize($filename) ); // ftruncate on a file handle which is unset $fp = fopen($filename, "w"); unset($fp); //unset file handle var_dump( ftruncate(@$fp,10)); -// check the first size -clearstatcache(); +// check the first size var_dump( filesize($filename) ); echo "Done\n"; @@ -118,12 +114,11 @@ Warning: ftruncate() expects parameter 1 to be resource, object given in %s on l bool(false) -- Testing ftruncate() with closed/unset file handle -- -Warning: ftruncate(): %d is not a valid stream resource in %s on line %d +Warning: ftruncate(): 5 is not a valid stream resource in %s on line %d bool(false) int(36) Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d bool(false) -int(0) +int(36) Done - diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index 988d618c66..2177c94b25 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -112,10 +112,9 @@ Warning: fwrite() expects parameter 1 to be resource, object given in %s on line bool(false) -- Testing fwrite() with closed/unset file handle -- -Warning: fwrite(): %d is not a valid stream resource in %s on line %d +Warning: fwrite(): 6 is not a valid stream resource in %s on line %d bool(false) Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/file/glob_basic.phpt b/ext/standard/tests/file/glob_basic.phpt index fc269c442f..68e1bc74b1 100755 --- a/ext/standard/tests/file/glob_basic.phpt +++ b/ext/standard/tests/file/glob_basic.phpt @@ -25,19 +25,14 @@ $fp = fopen("$dirname/file.text", "w"); fclose($fp); // glob() with default arguments -sort_var_dump( glob($dirname."/*") ); -sort_var_dump( glob($dirname."/*.txt") ); -sort_var_dump( glob($dirname."/*.t?t") ); -sort_var_dump( glob($dirname."/*.t*t") ); -sort_var_dump( glob($dirname."/*.?") ); -sort_var_dump( glob($dirname."/*.*") ); +var_dump( glob($dirname."/*") ); +var_dump( glob($dirname."/*.txt") ); +var_dump( glob($dirname."/*.t?t") ); +var_dump( glob($dirname."/*.t*t") ); +var_dump( glob($dirname."/*.?") ); +var_dump( glob($dirname."/*.*") ); echo "Done\n"; - -function sort_var_dump($results) { - sort($results); - var_dump($results); -} ?> --CLEAN-- <?php diff --git a/ext/standard/tests/file/is_dir_variation2.phpt b/ext/standard/tests/file/is_dir_variation2.phpt index 8817256793..022e06bb40 100644 --- a/ext/standard/tests/file/is_dir_variation2.phpt +++ b/ext/standard/tests/file/is_dir_variation2.phpt @@ -14,7 +14,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { /* Testing is_dir() with dir, soft & hard link to dir, and with file, soft & hard link to file */ - + $file_path = dirname(__FILE__); echo "*** Testing is_dir() with dir and links to dir ***\n"; @@ -70,7 +70,7 @@ bool(true) -- With symlink -- bool(true) -- With hardlink -- -Warning: link(): %s +Warning: link(): %s in %s on line %d bool(false) *** Testing is_dir() with file and links to a file *** diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index 2df297843b..9c2cdf885a 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test is_dir() function: usage variations - invalid arguments +Test is_dir() function: usage variations - invalid arguments --FILE-- <?php /* Prototype: bool is_dir ( string $dirname ); @@ -18,10 +18,9 @@ $dirnames = array( TRUE, FALSE, NULL, - " ", $dir_handle, - /* scalars */ + /* Non-existing dirnames */ 0, 1234 ); @@ -40,7 +39,6 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Warning: is_dir() expects parameter 1 to be string, resource given in %s on line %d NULL @@ -48,4 +46,3 @@ bool(false) bool(false) *** Done *** - diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index 634ce1f40c..4ec53a5ab2 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -5,16 +5,6 @@ Test is_executable() function: usage variations - invalid file names if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip not for windows'); } -// Skip if being run by root (files are always readable, writeable and executable) -$filename = dirname(__FILE__)."/is_executable_root_check.tmp"; -$fp = fopen($filename, 'w'); -fclose($fp); -if(fileowner($filename) == 0) { - unlink ($filename); - die('skip cannot be run as root'); -} - -unlink($filename); ?> --FILE-- <?php @@ -37,7 +27,6 @@ $invalid_files = array( TRUE, FALSE, NULL, - " ", @array(), @$file_handle ); @@ -60,10 +49,8 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Warning: is_executable() expects parameter 1 to be string, array given in %s on line %d NULL bool(false) Done - diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt index 917fa5acc8..fd952fa096 100644 --- a/ext/standard/tests/file/is_file_variation3.phpt +++ b/ext/standard/tests/file/is_file_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test is_file() function: usage variations - invalid filenames +Test is_file() function: usage variations - invalid arguments --FILE-- <?php /* Prototype: bool is_file ( string $filename ); @@ -16,18 +16,17 @@ echo "*** Testing Invalid file types ***\n"; $filenames = array( /* Invalid filenames */ -2.34555, - " ", "", TRUE, FALSE, NULL, $file_handle, - + /* scalars */ 1234, 0 ); - + /* loop through to test each element the above array */ foreach( $filenames as $filename ) { var_dump( is_file($filename) ); @@ -49,7 +48,6 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Warning: is_file() expects parameter 1 to be string, resource given in %s on line %d NULL @@ -57,4 +55,3 @@ bool(false) bool(false) *** Done *** - diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 55aeedfaad..fc0cab85cc 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -1,5 +1,5 @@ --TEST-- -Test is_file() function: usage variations - diff. path notations (Bug #42027) +Test is_file() function: usage variations - diff. path notations (Bug #42027, #42638) --FILE-- <?php /* Prototype: bool is_file ( string $filename ); diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index a1310327b8..76eafd0b5a 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -2,16 +2,8 @@ Test is_readable() function: usage variations - diff. file notations --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - // Skip if being run by root (files are always readable, writeable and executable) - $filename = dirname(__FILE__)."/is_readable_root_check.tmp"; - $fp = fopen($filename, 'w'); - fclose($fp); - if(fileowner($filename) == 0) { - unlink ($filename); - die('skip cannot be run as root'); - } - unlink($filename); +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip not for windows'); } ?> --FILE-- diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index dde47cc3b5..fefd7a2c4c 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -2,17 +2,8 @@ Test is_readable() function: usage variations - invalid file names --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - - // Skip if being run by root (files are always readable, writeable and executable) - $filename = dirname(__FILE__)."/is_readable_root_check.tmp"; - $fp = fopen($filename, 'w'); - fclose($fp); - if(fileowner($filename) == 0) { - unlink ($filename); - die('skip cannot be run as root'); - } - unlink($filename); +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip not for windows'); } ?> --FILE-- @@ -36,7 +27,6 @@ $misc_files = array( TRUE, FALSE, NULL, - " ", @array(), @$file_handle ); @@ -59,10 +49,8 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Warning: is_readable() expects parameter 1 to be string, array given in %s on line %d NULL bool(false) Done - diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index bf3e7e1171..97232b4320 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -2,18 +2,8 @@ Test is_writable() and its alias is_writeable() function: usage variations - diff. path notations --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - - // Skip if being run by root (files are always readable, writeable and executable) - $filename = dirname(__FILE__)."/is_writable_root_check.tmp"; - $fp = fopen($filename, 'w'); - fclose($fp); - if(fileowner($filename) == 0) { - unlink ($filename); - die('skip cannot be run as root'); - } - - unlink($filename); +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. only on LINUX'); } ?> --FILE-- @@ -110,4 +100,4 @@ bool(true) -- Iteration 11 -- bool(true) bool(true) -Done
\ No newline at end of file +Done diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 4c5bfa9082..e2cc13c33a 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -2,16 +2,8 @@ Test is_writable() and its alias is_writeable() function: usage variations - invalid file names --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - // Skip if being run by root (files are always readable, writeable and executable) - $filename = dirname(__FILE__)."/is_writable_root_check.tmp"; - $fp = fopen($filename, 'w'); - fclose($fp); - if(fileowner($filename) == 0) { - unlink ($filename); - die('skip cannot be run as root'); - } - unlink($filename); +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. only on LINUX'); } ?> --FILE-- @@ -34,7 +26,6 @@ $misc_files = array( TRUE, FALSE, NULL, - " ", @array(), @$file_handle ); @@ -64,8 +55,6 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) Warning: is_writable() expects parameter 1 to be string, array given in %s on line %d NULL @@ -75,4 +64,3 @@ NULL bool(false) bool(false) Done - diff --git a/ext/standard/tests/file/lstat_stat_variation2.phpt b/ext/standard/tests/file/lstat_stat_variation2.phpt index e7d704a20b..c845bb478a 100755 --- a/ext/standard/tests/file/lstat_stat_variation2.phpt +++ b/ext/standard/tests/file/lstat_stat_variation2.phpt @@ -21,12 +21,13 @@ $file_path = dirname(__FILE__); require("file.inc"); /* create temp directory */ -mkdir("$file_path/lstat_stat_variation1/"); // temp dir +@rmdir("$file_path/lstat_stat_variation2/"); //ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation2/"); // temp dir // renaming a directory and check stat echo "*** Testing stat() for directory after being renamed ***\n"; -$old_dirname = "$file_path/lstat_stat_variation1"; -$new_dirname = "$file_path/lstat_stat_variation1a"; +$old_dirname = "$file_path/lstat_stat_variation2"; +$new_dirname = "$file_path/lstat_stat_variation2a"; $old_stat = stat($old_dirname); clearstatcache(); var_dump( rename($old_dirname, $new_dirname) ); @@ -36,11 +37,8 @@ $new_stat = stat($new_dirname); var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the two stats - all except ctime -$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, - "dev", "ino", "mode", "nlink", "uid", "gid", - "rdev", "size", "atime", "mtime", "blksize", "blocks"); -var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) ); +// compare the two stats +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); // clear the cache clearstatcache(); @@ -50,7 +48,7 @@ echo "\n--- Done ---"; --CLEAN-- <?php $file_path = dirname(__FILE__); -rmdir("$file_path/lstat_stat_variation1a"); +rmdir("$file_path/lstat_stat_variation2a"); ?> --EXPECTF-- *** Testing stat() for directory after being renamed *** diff --git a/ext/standard/tests/file/popen_pclose_error-sunos.phpt b/ext/standard/tests/file/popen_pclose_error-sunos.phpt index b63dbeb7ea..4c85c9e494 100644 --- a/ext/standard/tests/file/popen_pclose_error-sunos.phpt +++ b/ext/standard/tests/file/popen_pclose_error-sunos.phpt @@ -2,8 +2,8 @@ Test popen() and pclose function: error conditions --SKIPIF-- <?php -if( substr(PHP_OS, 0, 3) != 'Sun') - die("skip Only valid for Sun Solaris"); +if(substr(PHP_OS, 0, 3) != 'Sun' ) + die("skip Only Valid for Sun Solaris"); ?> --FILE-- @@ -35,13 +35,13 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: Wrong parameter count for popen() in %s on line %d +Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d NULL -Warning: Wrong parameter count for popen() in %s on line %d +Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d NULL -sh: abc.txt: not found resource(%d) of type (stream) +sh: abc.txt: not found Warning: Wrong parameter count for pclose() in %s on line %d NULL diff --git a/ext/standard/tests/file/readlink_realpath_basic1.phpt b/ext/standard/tests/file/readlink_realpath_basic1.phpt index 99195e2b24..e2a076c947 100644 --- a/ext/standard/tests/file/readlink_realpath_basic1.phpt +++ b/ext/standard/tests/file/readlink_realpath_basic1.phpt @@ -39,6 +39,9 @@ $linknames = array ( "$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1_link.tmp", "$file_path/readlink_realpath_basic1//home/test//../test/./readlink_realpath_basic1_link.tmp", + // checking for binary safe + b"$file_path/readlink_realpath_basic1/home/readlink_realpath_basic1_link.tmp", + /* linknames with invalid linkpath */ "$file_path///readlink_realpath_basic1/home//..//././test//readlink_realpath_basic1_link.tmp", "$file_path/readlink_realpath_basic1/home/../home/../test/../readlink_realpath_basic1_link.tmp", @@ -86,24 +89,28 @@ string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp" string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp" -- Iteration 4 -- +string(%d) "%s/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp" +string(%d) "%s/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp" + +-- Iteration 5 -- Warning: readlink(): No such file or directory in %s on line %d bool(false) bool(false) --- Iteration 5 -- +-- Iteration 6 -- Warning: readlink(): No such file or directory in %s on line %d bool(false) bool(false) --- Iteration 6 -- +-- Iteration 7 -- Warning: readlink(): No such file or directory in %s on line %d bool(false) %s --- Iteration 7 -- +-- Iteration 8 -- Warning: readlink(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/readlink_realpath_basic2.phpt b/ext/standard/tests/file/readlink_realpath_basic2.phpt index 91955cd4f5..7a9e741ef0 100644 --- a/ext/standard/tests/file/readlink_realpath_basic2.phpt +++ b/ext/standard/tests/file/readlink_realpath_basic2.phpt @@ -34,6 +34,9 @@ $filenames = array ( "$file_path/readlink_realpath_basic2//home/test//../test/./readlink_realpath_basic2.tmp", "$file_path/readlink_realpath_basic2/home//../././readlink_realpath_basic2.tmp", + // checking for binary safe + b"$file_path/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp", + /* filenames with invalid path */ "$file_path///readlink_realpath_basic2/home//..//././test//readlink_realpath_basic2.tmp", "$file_path/readlink_realpath_basic2/home/../home/../test/../readlink_realpath_basic2.tmp", @@ -76,11 +79,14 @@ string(%d) "%s/readlink_realpath_basic2/home/test/readlink_realpath_basic2.tmp" string(%d) "%s/readlink_realpath_basic2/readlink_realpath_basic2.tmp" -- Iteration 5 -- -bool(false) +string(%d) "%s/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp" -- Iteration 6 -- bool(false) -- Iteration 7 -- +bool(false) + +-- Iteration 8 -- %s Done diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index 98ce6211da..3bee688d87 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -5,7 +5,7 @@ Test symlink(), linkinfo(), link() and is_link() functions : error conditions - if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip no symlinks on Windows'); } -if (PHP_INT_SIZE != 4) { +if (PHP_INT_SIZE != 4 ) { die("skip this test is for 32bit platform only"); } ?> @@ -42,7 +42,6 @@ var_dump( link($filename, $linkname, false) ); //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename var_dump( link('', $linkname) ); // empty string as filename -var_dump( link(' ', $linkname) ); // space as filename var_dump( link(false, $linkname) ); // boolean false as filename var_dump( link($filename, NULL) ); // NULL as linkname var_dump( link($filename, '') ); // '' as linkname @@ -58,7 +57,6 @@ var_dump( is_link($linkname, "/") ); //invalid arguments var_dump( is_link(NULL) ); // NULL as linkname var_dump( is_link('') ); // empty string as linkname -var_dump( is_link(' ') ); // space as linkname var_dump( is_link(false) ); // boolean false as linkname var_dump( is_link($filename) ); // file given to is_link @@ -77,25 +75,22 @@ NULL Warning: link() expects exactly 2 parameters, 3 given in %s on line %d NULL -Warning: link(): No such file or directory in %s on line %d +Warning: link(): %s in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d +Warning: link(): %s in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d +Warning: link(): %s in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d +Warning: link(): %s in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d +Warning: link(): %s in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d -bool(false) - -Warning: link(): No such file or directory in %s on line %d +Warning: link(): %s in %s on line %d bool(false) *** Testing is_link() for error conditions *** @@ -109,6 +104,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Done - diff --git a/ext/standard/tests/file/tempnam_variation1-win32.phpt b/ext/standard/tests/file/tempnam_variation1-win32.phpt index a3dd7e9d62..9075950330 100644 --- a/ext/standard/tests/file/tempnam_variation1-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation1-win32.phpt @@ -3,7 +3,7 @@ Test tempnam() function: usage variations - creating files --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Only valid for Windows"); + die("skip Run only on Windows"); ?> --FILE-- <?php @@ -13,8 +13,7 @@ if(substr(PHP_OS, 0, 3) != "WIN") /* Creating number of unique files by passing a file name as prefix */ -$file_path = dirname(__FILE__)."/tempnamVar1"; -mkdir($file_path); +$file_path = dirname(__FILE__); echo "*** Testing tempnam() in creation of unique files ***\n"; for($i=1; $i<=10; $i++) { @@ -32,19 +31,6 @@ for($i=1; $i<=10; $i++) { echo "\n"; clearstatcache(); - echo "File created in => "; - $file_dir = dirname($files[$i]); - - if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } - else if (realpath($file_dir) == realpath($file_path) || realpath($file_dir."\\") == realpath($file_path)) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } - clearstatcache(); } else { print("- File is not created -"); @@ -53,51 +39,39 @@ for($i=1; $i<=10; $i++) { for($i=1; $i<=10; $i++) { unlink($files[$i]); } -rmdir($file_path); - echo "*** Done ***\n"; ?> --EXPECTF-- *** Testing tempnam() in creation of unique files *** -- Iteration 1 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 2 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 3 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 4 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 5 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 6 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 7 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 8 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 9 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 10 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => directory specified *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation1.phpt b/ext/standard/tests/file/tempnam_variation1.phpt index 0745f5397c..c94a65ba21 100644 --- a/ext/standard/tests/file/tempnam_variation1.phpt +++ b/ext/standard/tests/file/tempnam_variation1.phpt @@ -13,8 +13,7 @@ if(substr(PHP_OS, 0, 3) == "WIN") /* Creating number of unique files by passing a file name as prefix */ -$file_path = dirname(__FILE__)."/tempnamVar1"; -mkdir($file_path); +$file_path = dirname(__FILE__); echo "*** Testing tempnam() in creation of unique files ***\n"; for($i=1; $i<=10; $i++) { @@ -35,19 +34,6 @@ for($i=1; $i<=10; $i++) { echo "File inode is => "; print_r( fileinode($files[$i]) ); //checking inodes echo "\n"; - - echo "File created in => "; - $file_dir = dirname($files[$i]); - - if ($file_dir == sys_get_temp_dir()) { - echo "temp dir\n"; - } - else if ($file_dir == $file_path) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } clearstatcache(); } else { @@ -58,59 +44,48 @@ for($i=1; $i<=10; $i++) { unlink($files[$i]); } -rmdir($file_path); echo "*** Done ***\n"; ?> --EXPECTF-- *** Testing tempnam() in creation of unique files *** -- Iteration 1 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 2 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 3 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 4 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 5 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 6 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 7 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 8 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 9 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified -- Iteration 10 -- -File name is => %s%etempnam_variation1.tmp%s +File name is => %s File permissions are => 100600 File inode is => %d -File created in => directory specified *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation2-win32.phpt b/ext/standard/tests/file/tempnam_variation2-win32.phpt index 4224966daf..a9fe4fd2d6 100644 --- a/ext/standard/tests/file/tempnam_variation2-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation2-win32.phpt @@ -1,9 +1,9 @@ --TEST-- -Test tempnam() function: usage variations - various absolute and relative paths +Test tempnam() function: usage variations - relative paths --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Only valid for Windows"); + die("skip Run only on Windows"); ?> --FILE-- <?php @@ -13,7 +13,7 @@ if(substr(PHP_OS, 0, 3) != "WIN") /* Creating unique files in various dirs by passing relative paths to $dir arg */ -echo "*** Testing tempnam() with absolute and relative paths ***\n"; +echo "*** Testing tempnam() with relative paths ***\n"; $dir_name = dirname(__FILE__)."/tempnam_variation2"; mkdir($dir_name); $dir_path = $dir_name."/tempnam_variation2_sub"; @@ -23,24 +23,14 @@ $old_dir_path = getcwd(); chdir(dirname(__FILE__)); $dir_paths = array( - // absolute paths "$dir_path", "$dir_path/", "$dir_path/..", "$dir_path//../", "$dir_path/../.././tempnam_variation2", "$dir_path/..///tempnam_variation2_sub//..//../tempnam_variation2", - "$dir_path/BADDIR", - - - // relative paths ".", - "tempname_variation2", - "tempname_variation2/", - "tempnam_variation2/tempnam_variation2_sub", - "tempnam_variation2//tempnam_variation2_sub", - "./tempnam_variation2/../tempnam_variation2/tempnam_variation2_sub", - "BADDIR", + "./tempnam_variation2/../tempnam_variation2/tempnam_variation2_sub" ); for($i = 0; $i<count($dir_paths); $i++) { @@ -57,28 +47,10 @@ for($i = 0; $i<count($dir_paths); $i++) { echo "File permissions are => "; printf("%o", fileperms($file_name) ); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - $dir_req = $dir_paths[$i]; - - if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } - else if (realpath($file_dir) == realpath($dir_req) || realpath($file_dir."\\") == realpath($dir_req)) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } - - } - else { + else echo "-- File is not created --"; - } - - unlink($file_name); + unlink($file_name); } chdir($old_dir_path); @@ -88,76 +60,38 @@ rmdir($dir_name); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with absolute and relative paths *** +*** Testing tempnam() with relative paths *** -- Iteration 1 -- -File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 2 -- -File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 3 -- -File name is => %s\tempnam_variation2\t%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 4 -- -File name is => %s\tempnam_variation2\t%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 5 -- -File name is => %s\tempnam_variation2\t%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 6 -- -File name is => %s\tempnam_variation2\t%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 7 -- -File name is => %s\t%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 8 -- -File name is => %s\t%s -File permissions are => 100666 -File created in => directory specified - --- Iteration 9 -- -File name is => %s\t%s -File permissions are => 100666 -File created in => temp dir - --- Iteration 10 -- -File name is => %s\t%s -File permissions are => 100666 -File created in => temp dir - --- Iteration 11 -- -File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s -File permissions are => 100666 -File created in => directory specified - --- Iteration 12 -- -File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s -File permissions are => 100666 -File created in => directory specified - --- Iteration 13 -- -File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s -File permissions are => 100666 -File created in => directory specified - --- Iteration 14 -- -File name is => %s\t%s +File name is => %s File permissions are => 100666 -File created in => temp dir -*** Done ***
\ No newline at end of file +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation2.phpt b/ext/standard/tests/file/tempnam_variation2.phpt index b7e5cdc058..6d85e25628 100644 --- a/ext/standard/tests/file/tempnam_variation2.phpt +++ b/ext/standard/tests/file/tempnam_variation2.phpt @@ -1,5 +1,5 @@ --TEST-- -Test tempnam() function: usage variations - various absolute and relative paths +Test tempnam() function: usage variations - relative paths --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) == "WIN") @@ -13,7 +13,7 @@ if(substr(PHP_OS, 0, 3) == "WIN") /* Creating unique files in various dirs by passing relative paths to $dir arg */ -echo "*** Testing tempnam() with absolute and relative paths ***\n"; +echo "*** Testing tempnam() with relative paths ***\n"; $dir_name = dirname(__FILE__)."/tempnam_variation2"; mkdir($dir_name); $dir_path = $dir_name."/tempnam_variation2_sub"; @@ -23,24 +23,14 @@ $old_dir_path = getcwd(); chdir(dirname(__FILE__)); $dir_paths = array( - // absolute paths "$dir_path", "$dir_path/", "$dir_path/..", "$dir_path//../", "$dir_path/../.././tempnam_variation2", "$dir_path/..///tempnam_variation2_sub//..//../tempnam_variation2", - "$dir_path/BADDIR", - - - // relative paths ".", - "tempname_variation2", - "tempname_variation2/", - "tempnam_variation2/tempnam_variation2_sub", - "tempnam_variation2//tempnam_variation2_sub", - "./tempnam_variation2/../tempnam_variation2/tempnam_variation2_sub", - "BADDIR", + "./tempnam_variation2/../tempnam_variation2/tempnam_variation2_sub" ); for($i = 0; $i<count($dir_paths); $i++) { @@ -57,28 +47,10 @@ for($i = 0; $i<count($dir_paths); $i++) { echo "File permissions are => "; printf("%o", fileperms($file_name) ); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - $dir_req = $dir_paths[$i]; - - if (realpath($file_dir) == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } - else if ($file_dir == realpath($dir_req)) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } - - } - else { + else echo "-- File is not created --"; - } - - unlink($file_name); + unlink($file_name); } chdir($old_dir_path); @@ -88,76 +60,38 @@ rmdir($dir_name); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with absolute and relative paths *** +*** Testing tempnam() with relative paths *** -- Iteration 1 -- -File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 2 -- -File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 3 -- -File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 4 -- -File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 5 -- -File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 6 -- -File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 7 -- -File name is => %s/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 8 -- -File name is => %s/tempnam_variation2.tmp%s -File permissions are => 100600 -File created in => directory specified - --- Iteration 9 -- -File name is => %s/tempnam_variation2.tmp%s -File permissions are => 100600 -File created in => temp dir - --- Iteration 10 -- -File name is => %s/tempnam_variation2.tmp%s -File permissions are => 100600 -File created in => temp dir - --- Iteration 11 -- -File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s -File permissions are => 100600 -File created in => directory specified - --- Iteration 12 -- -File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s -File permissions are => 100600 -File created in => directory specified - --- Iteration 13 -- -File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s -File permissions are => 100600 -File created in => directory specified - --- Iteration 14 -- -File name is => %s/tempnam_variation2.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -*** Done ***
\ No newline at end of file +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index ec7718f970..4e9eb76b5c 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -1,9 +1,9 @@ --TEST-- -Test tempnam() function: usage variations - obscure prefixes +Test tempnam() function: usage variations - invalid/non-existing file --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != "WIN") - die("skip run only on Windows"); + die("skip Run only on Windows"); ?> --FILE-- <?php @@ -13,11 +13,10 @@ if(substr(PHP_OS, 0, 3) != "WIN") /* Passing invalid/non-existing args for $prefix */ -echo "*** Testing tempnam() with obscure prefixes ***\n"; -$file_path = dirname(__FILE__)."/tempnamVar3"; -mkdir($file_path); +echo "*** Testing tempnam() with invalid/non-existing file names ***\n"; +$file_path = dirname(__FILE__); -/* An array of prefixes */ +/* An array of names, which will be passed as a file name */ $names_arr = array( /* Invalid args */ -1, @@ -26,16 +25,16 @@ $names_arr = array( NULL, "", " ", - "\0", + "/0", array(), - /* prefix with path separator of a non existing directory*/ + /* Non-existing dirs */ "/no/such/file/dir", - "php/php" + "php" ); -for( $i=0; $i<count($names_arr); $i++ ) { +for( $i=1; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; $file_name = tempnam("$file_path", $names_arr[$i]); @@ -48,73 +47,46 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "File permissions are => "; printf("%o", fileperms($file_name) ); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } - else if (realpath($file_dir) == realpath($file_path) || realpath($file_dir."\\") == realpath($file_path)) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } } - else { + else echo "-- File is not created --\n"; - } unlink($file_name); } -rmdir($file_path); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with obscure prefixes *** --- Iteration 0 -- -File name is => %s\%s -File permissions are => 100666 -File created in => directory specified +*** Testing tempnam() with invalid/non-existing file names *** -- Iteration 1 -- -File name is => %s\%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 2 -- -File name is => %s\%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 3 -- -File name is => %s\%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 4 -- -File name is => %s\%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 5 -- -File name is => %s\%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 6 -- -File name is => %s\%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 7 -- Warning: tempnam() expects parameter 2 to be string, array given in %s on line %d -- File is not created -- -Warning: unlink(): No such file or directory in %s on line %d +Warning: unlink(): %s in %s on line %d -- Iteration 8 -- -File name is => %s\di%s +File name is => %s File permissions are => 100666 -File created in => directory specified -- Iteration 9 -- -File name is => %s\ph%s +File name is => %s File permissions are => 100666 -File created in => directory specified *** Done *** - diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index a0b9511b63..cbc8e85239 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test tempnam() function: usage variations - obscure prefixes +Test tempnam() function: usage variations - invalid/non-existing file --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) == "WIN") @@ -13,11 +13,10 @@ if(substr(PHP_OS, 0, 3) == "WIN") /* Passing invalid/non-existing args for $prefix */ -echo "*** Testing tempnam() with obscure prefixes ***\n"; -$file_path = dirname(__FILE__)."/tempnamVar3"; -mkdir($file_path); +echo "*** Testing tempnam() with invalid/non-existing file names ***\n"; +$file_path = dirname(__FILE__); -/* An array of prefixes */ +/* An array of names, which will be passed as a file name */ $names_arr = array( /* Invalid args */ -1, @@ -26,16 +25,16 @@ $names_arr = array( NULL, "", " ", - "\0", + "/0", array(), - /* prefix with path separator of a non existing directory*/ + /* Non-existing dirs */ "/no/such/file/dir", - "php/php" + "php" ); -for( $i=0; $i<count($names_arr); $i++ ) { +for( $i=1; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; $file_name = tempnam("$file_path", $names_arr[$i]); @@ -48,75 +47,46 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "File permissions are => "; printf("%o", fileperms($file_name) ); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - - if ($file_dir == sys_get_temp_dir()) { - echo "temp dir\n"; - } - else if ($file_dir == $file_path) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } - } - else { + else echo "-- File is not created --\n"; - } unlink($file_name); } -rmdir($file_path); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with obscure prefixes *** --- Iteration 0 -- -File name is => %s/%s -File permissions are => 100600 -File created in => directory specified +*** Testing tempnam() with invalid/non-existing file names *** -- Iteration 1 -- -File name is => %s/%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 2 -- -File name is => %s/%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 3 -- -File name is => %s/%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 4 -- -File name is => %s/%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 5 -- -File name is => %s/%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 6 -- -File name is => %s/%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 7 -- Warning: tempnam() expects parameter 2 to be string, array given in %s on line %d -- File is not created -- -Warning: unlink(): No such file or directory in %s on line %d +Warning: unlink(): %s in %s on line %d -- Iteration 8 -- -File name is => %s/dir%s +File name is => %s File permissions are => 100600 -File created in => directory specified -- Iteration 9 -- -File name is => %s/php%s +File name is => %s File permissions are => 100600 -File created in => directory specified *** Done *** - diff --git a/ext/standard/tests/file/tempnam_variation4.phpt b/ext/standard/tests/file/tempnam_variation4.phpt index 8fec4019fc..491eae7343 100644 --- a/ext/standard/tests/file/tempnam_variation4.phpt +++ b/ext/standard/tests/file/tempnam_variation4.phpt @@ -20,34 +20,22 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing tempnam() with dir of permissions from 0000 to 0777 ***\n"; $file_path = dirname(__FILE__); $dir_name = $file_path."/tempnam_variation4"; -$prefix = "tempnamVar4."; - mkdir($dir_name); -for($mode = 0000; $mode <= 0777; $mode++) { +for($mode = 0000; $mode<=0777; $mode++) { echo "-- dir perms "; printf("%o", $mode); echo " --\n"; chmod($dir_name, $mode); - $file_name = tempnam($dir_name, $prefix); + $file_name = tempnam($dir_name, "tempnam_variation4.tmp"); if(file_exists($file_name) ) { - if (realpath(dirname($file_name)) == realpath(sys_get_temp_dir())) { - $msg = " created in temp directory"; - } - else if (dirname($file_name) == $dir_name) { - $msg = " created in requested directory"; - } - else { - $msg = " created in unexpected directory"; - } - - echo basename($file_name).$msg."\n"; - unlink($file_name); - } - else { - print("FAILED: File is not created\n"); + print($file_name); + echo "\n"; } + else + print("-- File is not created --"); + unlink($file_name); } rmdir($dir_name); @@ -57,1027 +45,1027 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing tempnam() with dir of permissions from 0000 to 0777 *** -- dir perms 0 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 1 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 2 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 3 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 4 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 5 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 6 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 7 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 10 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 11 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 12 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 13 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 14 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 15 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 16 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 17 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 20 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 21 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 22 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 23 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 24 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 25 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 26 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 27 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 30 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 31 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 32 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 33 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 34 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 35 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 36 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 37 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 40 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 41 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 42 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 43 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 44 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 45 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 46 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 47 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 50 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 51 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 52 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 53 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 54 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 55 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 56 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 57 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 60 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 61 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 62 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 63 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 64 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 65 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 66 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 67 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 70 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 71 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 72 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 73 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 74 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 75 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 76 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 77 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 100 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 101 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 102 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 103 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 104 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 105 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 106 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 107 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 110 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 111 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 112 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 113 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 114 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 115 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 116 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 117 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 120 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 121 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 122 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 123 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 124 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 125 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 126 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 127 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 130 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 131 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 132 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 133 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 134 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 135 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 136 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 137 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 140 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 141 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 142 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 143 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 144 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 145 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 146 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 147 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 150 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 151 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 152 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 153 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 154 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 155 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 156 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 157 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 160 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 161 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 162 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 163 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 164 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 165 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 166 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 167 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 170 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 171 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 172 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 173 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 174 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 175 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 176 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 177 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 200 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 201 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 202 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 203 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 204 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 205 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 206 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 207 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 210 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 211 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 212 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 213 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 214 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 215 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 216 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 217 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 220 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 221 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 222 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 223 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 224 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 225 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 226 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 227 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 230 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 231 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 232 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 233 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 234 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 235 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 236 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 237 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 240 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 241 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 242 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 243 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 244 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 245 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 246 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 247 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 250 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 251 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 252 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 253 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 254 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 255 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 256 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 257 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 260 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 261 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 262 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 263 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 264 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 265 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 266 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 267 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 270 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 271 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 272 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 273 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 274 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 275 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 276 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 277 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 300 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 301 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 302 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 303 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 304 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 305 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 306 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 307 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 310 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 311 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 312 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 313 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 314 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 315 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 316 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 317 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 320 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 321 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 322 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 323 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 324 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 325 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 326 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 327 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 330 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 331 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 332 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 333 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 334 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 335 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 336 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 337 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 340 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 341 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 342 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 343 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 344 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 345 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 346 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 347 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 350 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 351 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 352 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 353 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 354 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 355 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 356 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 357 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 360 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 361 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 362 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 363 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 364 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 365 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 366 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 367 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 370 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 371 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 372 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 373 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 374 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 375 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 376 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 377 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 400 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 401 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 402 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 403 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 404 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 405 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 406 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 407 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 410 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 411 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 412 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 413 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 414 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 415 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 416 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 417 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 420 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 421 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 422 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 423 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 424 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 425 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 426 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 427 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 430 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 431 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 432 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 433 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 434 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 435 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 436 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 437 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 440 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 441 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 442 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 443 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 444 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 445 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 446 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 447 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 450 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 451 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 452 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 453 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 454 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 455 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 456 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 457 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 460 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 461 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 462 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 463 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 464 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 465 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 466 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 467 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 470 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 471 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 472 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 473 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 474 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 475 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 476 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 477 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 500 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 501 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 502 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 503 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 504 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 505 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 506 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 507 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 510 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 511 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 512 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 513 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 514 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 515 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 516 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 517 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 520 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 521 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 522 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 523 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 524 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 525 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 526 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 527 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 530 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 531 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 532 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 533 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 534 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 535 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 536 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 537 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 540 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 541 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 542 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 543 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 544 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 545 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 546 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 547 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 550 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 551 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 552 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 553 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 554 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 555 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 556 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 557 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 560 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 561 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 562 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 563 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 564 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 565 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 566 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 567 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 570 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 571 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 572 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 573 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 574 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 575 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 576 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 577 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 600 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 601 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 602 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 603 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 604 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 605 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 606 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 607 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 610 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 611 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 612 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 613 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 614 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 615 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 616 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 617 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 620 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 621 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 622 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 623 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 624 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 625 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 626 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 627 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 630 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 631 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 632 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 633 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 634 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 635 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 636 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 637 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 640 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 641 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 642 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 643 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 644 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 645 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 646 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 647 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 650 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 651 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 652 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 653 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 654 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 655 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 656 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 657 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 660 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 661 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 662 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 663 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 664 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 665 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 666 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 667 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 670 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 671 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 672 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 673 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 674 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 675 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 676 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 677 -- -tempnamVar4.%s created in temp directory +%s -- dir perms 700 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 701 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 702 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 703 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 704 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 705 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 706 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 707 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 710 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 711 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 712 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 713 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 714 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 715 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 716 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 717 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 720 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 721 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 722 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 723 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 724 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 725 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 726 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 727 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 730 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 731 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 732 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 733 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 734 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 735 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 736 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 737 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 740 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 741 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 742 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 743 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 744 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 745 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 746 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 747 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 750 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 751 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 752 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 753 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 754 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 755 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 756 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 757 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 760 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 761 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 762 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 763 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 764 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 765 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 766 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 767 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 770 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 771 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 772 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 773 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 774 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 775 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 776 -- -tempnamVar4.%s created in requested directory +%s -- dir perms 777 -- -tempnamVar4.%s created in requested directory -*** Done ***
\ No newline at end of file +%s +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation5.phpt b/ext/standard/tests/file/tempnam_variation5.phpt index 26c3f91f1f..2d5f53dcd3 100644 --- a/ext/standard/tests/file/tempnam_variation5.phpt +++ b/ext/standard/tests/file/tempnam_variation5.phpt @@ -1,10 +1,5 @@ --TEST-- Test tempnam() function: usage variations - existing file ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Do not run on Windows"); -?> --FILE-- <?php /* Prototype: string tempnam ( string $dir, string $prefix ); @@ -18,7 +13,7 @@ $file_path = dirname(__FILE__); echo "*** Test tempnam() function: by passing an existing filename as prefix ***\n"; $dir_name = $file_path."/tempnam_variation6"; mkdir($dir_name); -$h = fopen($dir_name."/tempnam_variation6.tmp", "w"); +fopen($dir_name."/tempnam_variation6.tmp", "w"); for($i=1; $i<=3; $i++) { echo "-- Iteration $i --\n"; @@ -34,7 +29,6 @@ for($i=1; $i<=3; $i++) { unlink($created_file); } -fclose($h); unlink($dir_name."/tempnam_variation6.tmp"); rmdir($dir_name); @@ -43,10 +37,10 @@ echo "\n*** Done ***\n"; --EXPECTF-- *** Test tempnam() function: by passing an existing filename as prefix *** -- Iteration 1 -- -File name is => %stempnam_variation6%etempnam_variation6.tmp%s +File name is => %s -- Iteration 2 -- -File name is => %stempnam_variation6%etempnam_variation6.tmp%s +File name is => %s -- Iteration 3 -- -File name is => %stempnam_variation6%etempnam_variation6.tmp%s +File name is => %s *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation6.phpt b/ext/standard/tests/file/tempnam_variation6.phpt index 5eb6e6fc86..51ecde9a73 100644 --- a/ext/standard/tests/file/tempnam_variation6.phpt +++ b/ext/standard/tests/file/tempnam_variation6.phpt @@ -1,10 +1,5 @@ --TEST-- -Test tempnam() function: usage variations - Using previous unique filename ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Do not run on Windows"); -?> +Test tempnam() function: usage variations - Using previous unique filename --FILE-- <?php /* Prototype: string tempnam ( string $dir, string $prefix ); @@ -25,20 +20,7 @@ for($i=1; $i<=3; $i++) { echo "File name is => "; print($file_name); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - - if ($file_dir == sys_get_temp_dir()) { - echo "temp dir\n"; - } - else if ($file_dir == $file_path) { - echo "directory specified\n"; - } - else { - echo "unknown location\n"; - } - } + } unlink($file_name); } @@ -48,13 +30,10 @@ echo "\n*** Done ***\n"; --EXPECTF-- *** Test tempnam(): by passing previously created filenames *** -- Iteration 1 -- -File name is => %s%etempnam_variation6.tmp%s -File created in => directory specified +File name is => %s -- Iteration 2 -- -File name is => %s%etempnam_variation6.tmp%s -File created in => directory specified +File name is => %s -- Iteration 3 -- -File name is => %s%etempnam_variation6.tmp%s -File created in => directory specified +File name is => %s *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5096934e03..486240146f 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -3,7 +3,7 @@ Test tempnam() function: usage variations - invalid/non-existing dir --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != "WIN") - die("skip Only run on Windows"); + die("skip Run only on Windows"); ?> --FILE-- <?php @@ -15,6 +15,8 @@ if(substr(PHP_OS, 0, 3) != "WIN") hence the unique files will be created in temporary dir */ echo "*** Testing tempnam() with invalid/non-existing directory names ***\n"; +$file_path = dirname(__FILE__); + /* An array of names, which will be passed as a dir name */ $names_arr = array( /* Invalid args */ @@ -24,7 +26,7 @@ $names_arr = array( NULL, "", " ", - "\0", + "/0", array(), /* Non-existing dirs */ @@ -33,7 +35,7 @@ $names_arr = array( ); -for( $i=0; $i<count($names_arr); $i++ ) { +for( $i=1; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); @@ -46,19 +48,9 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "File permissions are => "; printf("%o", fileperms($file_name) ); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } - else { - echo "unknown location\n"; - } } - else { + else echo "-- File is not created --\n"; - } unlink($file_name); } @@ -67,34 +59,24 @@ echo "\n*** Done ***\n"; ?> --EXPECTF-- *** Testing tempnam() with invalid/non-existing directory names *** --- Iteration 0 -- -File name is => %s%et%s -File permissions are => 100666 -File created in => temp dir -- Iteration 1 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 2 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 3 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 4 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 5 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 6 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 7 -- Warning: tempnam() expects parameter 1 to be string, array given in %s on line %d @@ -102,13 +84,10 @@ Warning: tempnam() expects parameter 1 to be string, array given in %s on line % Warning: unlink(): No such file or directory in %s on line %d -- Iteration 8 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir -- Iteration 9 -- -File name is => %s%et%s +File name is => %s File permissions are => 100666 -File created in => temp dir *** Done *** - diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 0e314dabe3..ebecd1601f 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -3,7 +3,7 @@ Test tempnam() function: usage variations - invalid/non-existing dir --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) == "WIN") - die("skip Do not run on Windows"); + die("skip DO not run on Windows"); ?> --FILE-- <?php @@ -15,6 +15,8 @@ if(substr(PHP_OS, 0, 3) == "WIN") hence the unique files will be created in temporary dir */ echo "*** Testing tempnam() with invalid/non-existing directory names ***\n"; +$file_path = dirname(__FILE__); + /* An array of names, which will be passed as a dir name */ $names_arr = array( /* Invalid args */ @@ -24,7 +26,7 @@ $names_arr = array( NULL, "", " ", - "\0", + "/0", array(), /* Non-existing dirs */ @@ -33,7 +35,7 @@ $names_arr = array( ); -for( $i=0; $i<count($names_arr); $i++ ) { +for( $i=1; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); @@ -46,21 +48,9 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "File permissions are => "; printf("%o", fileperms($file_name) ); echo "\n"; - - echo "File created in => "; - $file_dir = dirname($file_name); - - if (realpath($file_dir) == realpath(sys_get_temp_dir())) { - echo "temp dir\n"; - } - else { - echo "unknown location\n"; - } - } - else { + else echo "-- File is not created --\n"; - } unlink($file_name); } @@ -69,34 +59,24 @@ echo "\n*** Done ***\n"; ?> --EXPECTF-- *** Testing tempnam() with invalid/non-existing directory names *** --- Iteration 0 -- -File name is => %s%etempnam_variation3.tmp%s -File permissions are => 100600 -File created in => temp dir -- Iteration 1 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 2 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 3 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 4 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 5 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 6 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 7 -- Warning: tempnam() expects parameter 1 to be string, array given in %s on line %d @@ -104,13 +84,10 @@ Warning: tempnam() expects parameter 1 to be string, array given in %s on line % Warning: unlink(): No such file or directory in %s on line %d -- Iteration 8 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir -- Iteration 9 -- -File name is => %s%etempnam_variation3.tmp%s +File name is => %s File permissions are => 100600 -File created in => temp dir *** Done *** - diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt index c6c270d065..aea68b0d44 100644 --- a/ext/standard/tests/file/touch.phpt +++ b/ext/standard/tests/file/touch.phpt @@ -1,16 +1,8 @@ --TEST-- touch() tests ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. only for Non Windows.'); -} -?> --FILE-- <?php -// This doesn't work for windows, time, atime usage results in very different -// output to linux. This could be a php.net bug on windows or a windows querk. $filename = dirname(__FILE__)."/touch.dat"; var_dump(touch()); @@ -52,7 +44,6 @@ int(100) bool(true) int(100) -Warning: touch(): Unable to create file /no/such/file/or/directory because %s in %s on line %d +Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d bool(false) Done - diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt index f76c73572b..bb633c334d 100644 --- a/ext/standard/tests/general_functions/008.phpt +++ b/ext/standard/tests/general_functions/008.phpt @@ -34,7 +34,7 @@ array(14) { [11]=> float(123456789012) [12]=> - float(1.23456789012E+12) + float(1234567890120) [13]=> float(1.23456789012E+19) }
\ No newline at end of file diff --git a/ext/standard/tests/general_functions/parse_ini_basic.data b/ext/standard/tests/general_functions/parse_ini_basic.data index fdbd55cbf9..05b515ee60 100644 --- a/ext/standard/tests/general_functions/parse_ini_basic.data +++ b/ext/standard/tests/general_functions/parse_ini_basic.data @@ -127,6 +127,3 @@ ini_with-hyphen = with hyphen and underscore ini.with-hyphen = dot and hyphen ini-with.hyphen = hyphen and dot -[windows paths] -winpath1="c:\some windows\path\test\new\r\quote \" here\single ' quote\some more" -winpath2="special case\" diff --git a/ext/standard/tests/general_functions/parse_ini_basic.phpt b/ext/standard/tests/general_functions/parse_ini_basic.phpt index bdd44e0a2f..23fcefa491 100644 --- a/ext/standard/tests/general_functions/parse_ini_basic.phpt +++ b/ext/standard/tests/general_functions/parse_ini_basic.phpt @@ -15,7 +15,7 @@ var_dump(parse_ini_file($ini_file, 1)); echo "Done.\n"; ?> --EXPECTF-- -array(26) { +array(25) { ["basic"]=> array(15) { ["basicval"]=> @@ -272,12 +272,5 @@ array(26) { ["ini-with.hyphen"]=> string(14) "hyphen and dot" } - ["windows paths"]=> - array(2) { - ["winpath1"]=> - string(69) "c:\some windows\path\test\new\r\quote " here\single ' quote\some more" - ["winpath2"]=> - string(13) "special case\" - } } Done. diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index 8523c83cf0..65a29e0022 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -105,18 +105,6 @@ INI; file_put_contents($filename, $ini); var_dump(parse_ini_file($filename, true)); -/* #44575, comments starting with '#' */ -$ini = <<<'INI' -foo=bar1 -; comment -_foo=bar2 -# comment -foo_=bar3 -INI; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - - @unlink($filename); echo "Done\n"; ?> @@ -205,14 +193,4 @@ array(3) { ["foo_"]=> string(4) "bar3" } - -Deprecated: Comments starting with '#' are deprecated in %s -array(3) { - ["foo"]=> - string(4) "bar1" - ["_foo"]=> - string(4) "bar2" - ["foo_"]=> - string(4) "bar3" -} Done diff --git a/ext/standard/tests/serialize/bug42919.phpt b/ext/standard/tests/serialize/bug42919.phpt index 0a3d0b2e07..11cb81de6c 100755 --- a/ext/standard/tests/serialize/bug42919.phpt +++ b/ext/standard/tests/serialize/bug42919.phpt @@ -10,5 +10,5 @@ $x = unserialize(serialize(new Bar)); echo get_class($x) . "\n"; ?> --EXPECT-- -O:7:"Foo\Bar":0:{} -Foo\Bar +O:8:"Foo::Bar":0:{} +Foo::Bar diff --git a/ext/standard/tests/strings/htmlentities-utf.phpt b/ext/standard/tests/strings/htmlentities-utf.phpt index b85803a163..6b83afc778 100755 --- a/ext/standard/tests/strings/htmlentities-utf.phpt +++ b/ext/standard/tests/strings/htmlentities-utf.phpt @@ -4,12 +4,8 @@ HTML entities with invalid chars output_handler= --FILE-- <?php -@setlocale (LC_CTYPE, "C"); -$strings = array(b"<", b"\xD0", b"\xD0\x90", b"\xD0\x90\xD0", b"\xD0\x90\xD0\xB0", b"\xE0", b"A\xE0", b"\xE0\x80", b"\xE0\x79", b"\xE0\x80\xBE", - b"Voil\xE0", b"Clich\xE9s", - b"\xFE", b"\xFE\x41", b"\xC3\xA9", b"\xC3\x79", b"\xF7\xBF\xBF\xBF", b"\xFB\xBF\xBF\xBF\xBF", b"\xFD\xBF\xBF\xBF\xBF\xBF", - b"\x41\xF7\xF7\x42", b"\x42\xFB\xFB\x42", b"\x43\xFD\xFD\x42", b"\x44\xF7\xF7", b"\x45\xFB\xFB", b"\x46\xFD\xFD" - ); +setlocale (LC_CTYPE, "C"); +$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x80\xBE"); foreach($strings as $string) { $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8"); var_dump(bin2hex($sc_encoded)); @@ -17,54 +13,22 @@ foreach($strings as $string) { var_dump(bin2hex($ent_encoded)); } ?> ---EXPECTF-- -%unicode|string%(8) "266c743b" -%unicode|string%(8) "266c743b" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(4) "d090" -%unicode|string%(4) "d090" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(8) "d090d0b0" -%unicode|string%(8) "d090d0b0" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(8) "2667743b" -%unicode|string%(8) "2667743b" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(4) "c3a9" -%unicode|string%(16) "266561637574653b" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(8) "f7bfbfbf" -%unicode|string%(8) "f7bfbfbf" -%unicode|string%(10) "fbbfbfbfbf" -%unicode|string%(10) "fbbfbfbfbf" -%unicode|string%(12) "fdbfbfbfbfbf" -%unicode|string%(12) "fdbfbfbfbfbf" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" -%unicode|string%(0) "" +--EXPECT-- +string(8) "266c743b" +string(8) "266c743b" +string(0) "" +string(0) "" +string(4) "d090" +string(4) "d090" +string(0) "" +string(0) "" +string(8) "d090d0b0" +string(8) "d090d0b0" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(8) "2667743b" +string(8) "2667743b"
\ No newline at end of file diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index d644dfb0f5..6474bdd841 100755 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -645,10 +645,10 @@ Array -123456 123456 -123456 -1.2e+5 --1.2e+5 -+1.2e+5 --1.2e+5 +120000 +-120000 ++120000 +-120000 123456 -123456 1.0E+5 @@ -657,10 +657,10 @@ Array -123456 123456 -123456 -1.2E+5 --1.2E+5 -+1.2E+5 --1.2E+5 +120000 +-120000 ++120000 +-120000 *** Output for '%%%.2f' as the format parameter *** %12345678900.00 diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index b76911ab3e..7534927e69 100755 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -645,10 +645,10 @@ Array -123456 123456 -123456 -1.2e+5 --1.2e+5 -+1.2e+5 --1.2e+5 +120000 +-120000 ++120000 +-120000 123456 -123456 1.0E+5 @@ -657,10 +657,10 @@ Array -123456 123456 -123456 -1.2E+5 --1.2E+5 -+1.2E+5 --1.2E+5 +120000 +-120000 ++120000 +-120000 *** Output for '%%%.2f' as the format parameter *** %12345678900.00 diff --git a/ext/standard/tests/strings/similar_text_basic.phpt b/ext/standard/tests/strings/similar_text_basic.phpt index 37b6527180..0eaf5c1c26 100644 --- a/ext/standard/tests/strings/similar_text_basic.phpt +++ b/ext/standard/tests/strings/similar_text_basic.phpt @@ -3,7 +3,7 @@ similar_text(), basic tests --CREDITS-- Mats Lindh <mats at lindh.no> #Testfest php.no ---INI-- +--INIT-- precision=14 --FILE-- <?php |