diff options
| author | Jakub Zelenka <bukka@php.net> | 2016-06-19 17:05:48 +0100 |
|---|---|---|
| committer | Jakub Zelenka <bukka@php.net> | 2016-06-19 17:05:48 +0100 |
| commit | e63a8540a60e95aa5bd8e269add1b02afcc1b79b (patch) | |
| tree | b83a144eec24cc81adab0b9a778f7a730d8df79e /ext/standard/tests | |
| parent | 7a4cc73641bb3eb878f7184bcbd026ee663cf2a9 (diff) | |
| parent | 53071e647049f099f7f7a0771ddb63fc2cdd621c (diff) | |
| download | php-git-e63a8540a60e95aa5bd8e269add1b02afcc1b79b.tar.gz | |
Merge branch 'openssl_error_store' into openssl_aead
Diffstat (limited to 'ext/standard/tests')
89 files changed, 2728 insertions, 1374 deletions
diff --git a/ext/standard/tests/array/array_column_numeric_string_key.phpt b/ext/standard/tests/array/array_column_numeric_string_key.phpt new file mode 100644 index 0000000000..aed3c35ea2 --- /dev/null +++ b/ext/standard/tests/array/array_column_numeric_string_key.phpt @@ -0,0 +1,23 @@ +--TEST-- +array_column() treats numeric string keys as usual +--FILE-- +<?php + +$array = [[42 => 'a'], [42 => 'b']]; +var_dump(array_column($array, 42)); +var_dump(array_column($array, "42")); + +?> +--EXPECT-- +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" +} +array(2) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" +} diff --git a/ext/standard/tests/array/array_column_property_visibility.phpt b/ext/standard/tests/array/array_column_property_visibility.phpt new file mode 100644 index 0000000000..4639a3c9c5 --- /dev/null +++ b/ext/standard/tests/array/array_column_property_visibility.phpt @@ -0,0 +1,27 @@ +--TEST-- +array_column() respects property visibility +--FILE-- +<?php + +class Test { + private $prop; + public function __construct($value) { + $this->prop = $value; + } + public function __isset($name) { + return true; + } + public function __get($name) { + return "__get($this->prop)"; + } +} + +$arr = [new Test("foobar")]; +var_dump(array_column($arr, "prop")); + +?> +--EXPECT-- +array(1) { + [0]=> + string(13) "__get(foobar)" +} diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index f0a6115f79..b23618794e 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -34,7 +34,11 @@ var_dump( array_filter($input, 'dump2', true) ); echo "*** Testing array_filter() : usage variations - 'callback' expecting second argument ***\n"; -var_dump( array_filter($small, 'dump', false) ); +try { + var_dump( array_filter($small, 'dump', false) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "*** Testing array_filter() with various use types ***\n"; @@ -70,13 +74,7 @@ array(3) { NULL } *** Testing array_filter() : usage variations - 'callback' expecting second argument *** - -Warning: Missing argument 2 for dump() in %s on line %d - -Notice: Undefined variable: key in %s on line %d - = 123 -array(0) { -} +Exception: Too few arguments to function dump(), 1 passed and exactly 2 expected *** Testing array_filter() with various use types *** array(2) { [1]=> @@ -91,13 +89,13 @@ array(2) { int(2) } -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 44 +Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 array(0) { } Done diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index 7c623ec4ea..56dd033521 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -18,14 +18,22 @@ echo "\n-- Testing array_map() function with one less than expected no. of argum function callback1() { return 1; } -var_dump( array_map('callback1') ); +try { + var_dump( array_map('callback1') ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- Testing array_map() function with less no. of arrays than callback function arguments --\n"; $arr1 = array(1, 2); function callback2($p, $q) { return $p * $q; } -var_dump( array_map('callback2', $arr1) ); +try { + var_dump( array_map('callback2', $arr1) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- Testing array_map() function with more no. of arrays than callback function arguments --\n"; $arr2 = array(3, 4); @@ -48,20 +56,7 @@ Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d NULL -- Testing array_map() function with less no. of arrays than callback function arguments -- - -Warning: Missing argument 2 for callback2() in %s on line %d%d - -Notice: Undefined variable: q in %s on line %d%d - -Warning: Missing argument 2 for callback2() in %s on line %d%d - -Notice: Undefined variable: q in %s on line %d%d -array(2) { - [0]=> - int(0) - [1]=> - int(0) -} +Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected -- Testing array_map() function with more no. of arrays than callback function arguments -- array(2) { diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt index cc75436999..ecf9157620 100644 --- a/ext/standard/tests/array/array_map_variation10.phpt +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -20,7 +20,11 @@ echo "-- anonymous function with all parameters and body --\n"; var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1, $array2)); echo "-- anonymous function with two parameters and passing one array --\n"; -var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1)); +try { + var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1)); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "-- anonymous function with NULL parameter --\n"; var_dump( array_map( create_function(NULL, 'return NULL;'), $array1)); @@ -60,41 +64,7 @@ array(3) { } } -- anonymous function with two parameters and passing one array -- - -Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d - -Notice: Undefined variable: b in %s(20) : runtime-created function on line %d - -Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d - -Notice: Undefined variable: b in %s(20) : runtime-created function on line %d - -Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d - -Notice: Undefined variable: b in %s(20) : runtime-created function on line %d -array(3) { - [0]=> - array(2) { - [0]=> - int(1) - [1]=> - NULL - } - [1]=> - array(2) { - [0]=> - int(2) - [1]=> - NULL - } - [2]=> - array(2) { - [0]=> - int(3) - [1]=> - NULL - } -} +Exception: Too few arguments to function __lambda_func(), 1 passed and exactly 2 expected -- anonymous function with NULL parameter -- array(3) { [0]=> diff --git a/ext/standard/tests/array/array_map_variation9.phpt b/ext/standard/tests/array/array_map_variation9.phpt index f029beccd6..f33b717c6c 100644 --- a/ext/standard/tests/array/array_map_variation9.phpt +++ b/ext/standard/tests/array/array_map_variation9.phpt @@ -29,7 +29,11 @@ echo "-- checking binary safe array with one parameter callback function --\n"; var_dump( array_map('callback1', $arr1) ); echo "-- checking binary safe array with two parameter callback function --\n"; -var_dump( array_map(b"callback2", $arr1) ); +try { + var_dump( array_map(b"callback2", $arr1) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "Done"; ?> @@ -47,42 +51,5 @@ array(4) { string(5) "22.22" } -- checking binary safe array with two parameter callback function -- - -Warning: Missing argument 2 for callback2() in %s on line %d%d - -Notice: Undefined variable: b in %s on line %d%d - -Warning: Missing argument 2 for callback2() in %s on line %d%d - -Notice: Undefined variable: b in %s on line %d%d - -Warning: Missing argument 2 for callback2() in %s on line %d%d - -Notice: Undefined variable: b in %s on line %d%d - -Warning: Missing argument 2 for callback2() in %s on line %d%d - -Notice: Undefined variable: b in %s on line %d%d -array(4) { - [0]=> - array(1) { - ["hello"]=> - NULL - } - [1]=> - array(1) { - ["world"]=> - NULL - } - [2]=> - array(1) { - [1]=> - NULL - } - [3]=> - array(1) { - ["22.22"]=> - NULL - } -} +Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected Done diff --git a/ext/standard/tests/array/array_reduce_variation1.phpt b/ext/standard/tests/array/array_reduce_variation1.phpt index b02a82a7ca..adffeb53d4 100644 --- a/ext/standard/tests/array/array_reduce_variation1.phpt +++ b/ext/standard/tests/array/array_reduce_variation1.phpt @@ -25,7 +25,11 @@ echo "\n--- Testing with a callback with too few parameters ---\n"; var_dump(array_reduce($array, "oneArg", 2)); echo "\n--- Testing with a callback with too many parameters ---\n"; -var_dump(array_reduce($array, "threeArgs", 2)); +try { + var_dump(array_reduce($array, "threeArgs", 2)); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} ?> ===DONE=== @@ -36,9 +40,5 @@ var_dump(array_reduce($array, "threeArgs", 2)); int(2) --- Testing with a callback with too many parameters --- - -Warning: Missing argument 3 for threeArgs() in %sarray_reduce_variation1.php on line %d - -Notice: Undefined variable: x in %sarray_reduce_variation1.php on line %d -int(3) -===DONE===
\ No newline at end of file +Exception: Too few arguments to function threeArgs(), 2 passed and exactly 3 expected +===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt index 69380767bb..6b7f014467 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt @@ -24,7 +24,11 @@ echo "\n-- comparison function taking too many parameters --\n"; function too_many_parameters ($val1, $val2, $val3) { return 1; } -var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters')); +try { + var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters')); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- comparison function taking too few parameters --\n"; function too_few_parameters ($val1) { @@ -32,7 +36,6 @@ function too_few_parameters ($val1) { } var_dump(array_udiff_assoc($arr1, $arr2, 'too_few_parameters')); - ?> ===DONE=== --EXPECTF-- @@ -45,12 +48,7 @@ array(1) { } -- comparison function taking too many parameters -- - -Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_assoc_variation5.php on line %d -array(1) { - [0]=> - int(1) -} +Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected -- comparison function taking too few parameters -- array(1) { diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt index ec752a31bb..bf2c0f3d2d 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt @@ -23,7 +23,11 @@ echo "\n-- comparison function taking too many parameters --\n"; function too_many_parameters ($val1, $val2, $val3) { return 1; } -var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); +try { + var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- comparison function taking too few parameters --\n"; function too_few_parameters ($val1) { @@ -43,12 +47,7 @@ array(1) { } -- comparison function taking too many parameters -- - -Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_uassoc_variation6.php on line %d -array(1) { - [0]=> - int(1) -} +Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected -- comparison function taking too few parameters -- array(1) { diff --git a/ext/standard/tests/array/array_udiff_variation5.phpt b/ext/standard/tests/array/array_udiff_variation5.phpt index 49405d40be..ce6362fc08 100644 --- a/ext/standard/tests/array/array_udiff_variation5.phpt +++ b/ext/standard/tests/array/array_udiff_variation5.phpt @@ -24,7 +24,11 @@ echo "\n-- comparison function taking too many parameters --\n"; function too_many_parameters ($val1, $val2, $val3) { return 0; } -var_dump(array_udiff($arr1, $arr2, 'too_many_parameters')); +try { + var_dump(array_udiff($arr1, $arr2, 'too_many_parameters')); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- comparison function taking too few parameters --\n"; function too_few_parameters ($val1) { @@ -44,10 +48,7 @@ array(1) { } -- comparison function taking too many parameters -- - -Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_variation5.php on line %d -array(0) { -} +Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected -- comparison function taking too few parameters -- array(0) { diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt index e2d7bd03a6..bebe5b52c9 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt @@ -23,7 +23,11 @@ echo "\n-- comparison function taking too many parameters --\n"; function too_many_parameters ($val1, $val2, $val3) { return 1; } -var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters')); +try { + var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters')); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- comparison function taking too few parameters --\n"; function too_few_parameters ($val1) { @@ -42,10 +46,7 @@ array(0) { } -- comparison function taking too many parameters -- - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_assoc_variation5.php on line %d -array(0) { -} +Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected -- comparison function taking too few parameters -- array(0) { diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt index 6ed86f8417..a5317c1c0d 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt @@ -23,7 +23,11 @@ echo "\n-- comparison function taking too many parameters --\n"; function too_many_parameters ($val1, $val2, $val3) { return 1; } -var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); +try { + var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters')); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- comparison function taking too few parameters --\n"; function too_few_parameters ($val1) { @@ -41,14 +45,7 @@ array(0) { } -- comparison function taking too many parameters -- - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_uassoc_variation6.php on line %d -array(0) { -} +Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected -- comparison function taking too few parameters -- array(0) { diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt index 75cf08e270..642ebc0077 100644 --- a/ext/standard/tests/array/array_uintersect_variation5.phpt +++ b/ext/standard/tests/array/array_uintersect_variation5.phpt @@ -23,7 +23,11 @@ echo "\n-- comparison function taking too many parameters --\n"; function too_many_parameters ($val1, $val2, $val3) { return 1; } -var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters')); +try { + var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters')); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "\n-- comparison function taking too few parameters --\n"; function too_few_parameters ($val1) { @@ -42,14 +46,7 @@ array(0) { } -- comparison function taking too many parameters -- - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d - -Warning: Missing argument 3 for too_many_parameters() in %sarray_uintersect_variation5.php on line %d -array(0) { -} +Exception: Too few arguments to function too_many_parameters(), 2 passed and exactly 3 expected -- comparison function taking too few parameters -- array(0) { diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index 63c5f51ee0..fd3cbf5037 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -22,36 +22,44 @@ function callback2($value, $key, $user_data1, $user_data2) { echo "*** Testing array_walk() : error conditions - callback parameters ***\n"; // expected: Missing argument Warning -var_dump( array_walk($input, "callback1") ); -var_dump( array_walk($input, "callback2", 4) ); +try { + var_dump( array_walk($input, "callback1") ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} +try { + var_dump( array_walk($input, "callback2", 4) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} // expected: Warning is suppressed -var_dump( @array_walk($input, "callback1") ); -var_dump( @array_walk($input, "callback2", 4) ); +try { + var_dump( @array_walk($input, "callback1") ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} +try { + var_dump( @array_walk($input, "callback2", 4) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "-- Testing array_walk() function with too many callback parameters --\n"; -var_dump( array_walk($input, "callback1", 20, 10) ); +try { + var_dump( array_walk($input, "callback1", 20, 10) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "Done"; ?> --EXPECTF-- *** Testing array_walk() : error conditions - callback parameters *** - -Warning: Missing argument 3 for callback1() in %s on line %d - -callback1() invoked -bool(true) - -Warning: Missing argument 4 for callback2() in %s on line %d - -callback2() invoked -bool(true) - -callback1() invoked -bool(true) - -callback2() invoked -bool(true) +Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected +Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected +Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected +Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk() function with too many callback parameters -- Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index 8e0c8829e6..5a077c6886 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -22,36 +22,44 @@ function callback2($value, $key, $user_data1, $user_data2) { echo "*** Testing array_walk_recursive() : error conditions - callback parameters ***\n"; // expected: Missing argument Warning -var_dump( array_walk_recursive($input, "callback1") ); -var_dump( array_walk_recursive($input, "callback2", 4) ); +try { + var_dump( array_walk_recursive($input, "callback1") ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} +try { + var_dump( array_walk_recursive($input, "callback2", 4) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} // expected: Warning is suppressed -var_dump( @array_walk_recursive($input, "callback1") ); -var_dump( @array_walk_recursive($input, "callback2", 4) ); +try { + var_dump( @array_walk_recursive($input, "callback1") ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} +try { + var_dump( @array_walk_recursive($input, "callback2", 4) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "-- Testing array_walk_recursive() function with too many callback parameters --\n"; -var_dump( array_walk_recursive($input, "callback1", 20, 10) ); +try { + var_dump( array_walk_recursive($input, "callback1", 20, 10) ); +} catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; +} echo "Done"; ?> --EXPECTF-- *** Testing array_walk_recursive() : error conditions - callback parameters *** - -Warning: Missing argument 3 for callback1() in %s on line %d - -callback1() invoked -bool(true) - -Warning: Missing argument 4 for callback2() in %s on line %d - -callback2() invoked -bool(true) - -callback1() invoked -bool(true) - -callback2() invoked -bool(true) +Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected +Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected +Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected +Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk_recursive() function with too many callback parameters -- Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d diff --git a/ext/standard/tests/array/bug71334.phpt b/ext/standard/tests/array/bug71334.phpt new file mode 100644 index 0000000000..7a37d0953a --- /dev/null +++ b/ext/standard/tests/array/bug71334.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #71334: Cannot access array keys while uksort() +--FILE-- +<?php + +class myClass +{ + private $a = [ + 'foo-test' => [1], + '-' => [2], + 'bar-test' => [3] + ]; + + private function _mySort($x, $y) + { + if (!isset($this->a[$x])) { + throw new Exception('Missing X: "' . $x . '"'); + } + + if (!isset($this->a[$y])) { + throw new Exception('Missing Y: "' . $y . '"'); + } + + return $x < $y; + } + + public function __construct() + { + uksort($this->a, [$this, '_mySort']); + } +} + +new myClass(); +echo "Done"; + +?> +--EXPECT-- +Done diff --git a/ext/standard/tests/array/bug71837.phpt b/ext/standard/tests/array/bug71837.phpt new file mode 100644 index 0000000000..686d144c3c --- /dev/null +++ b/ext/standard/tests/array/bug71837.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #71837 (Wrong arrays behaviour) +--FILE-- +<?php + +$p = array(array()); +array_push($p[0], array(100)); + +$c = array_merge($p, array()); +$c[0][0] = 200; + +print_r($p); + +?> +--EXPECT-- +Array +( + [0] => Array + ( + [0] => Array + ( + [0] => 100 + ) + + ) + +) diff --git a/ext/standard/tests/array/bug72031.phpt b/ext/standard/tests/array/bug72031.phpt new file mode 100644 index 0000000000..541fd3c4ec --- /dev/null +++ b/ext/standard/tests/array/bug72031.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #72031: array_column() against an array of objects discards all values matching null +--FILE-- +<?php + +class myObj { + public $prop; + public function __construct($prop) { + $this->prop = $prop; + } +} + +$objects = [ + new myObj(-1), + new myObj(0), + new myObj(1), + new myObj(2), + new myObj(null), + new myObj(true), + new myObj(false), + new myObj('abc'), + new myObj(''), +]; + +var_dump(array_column($objects, 'prop')); + +?> +--EXPECT-- +array(9) { + [0]=> + int(-1) + [1]=> + int(0) + [2]=> + int(1) + [3]=> + int(2) + [4]=> + NULL + [5]=> + bool(true) + [6]=> + bool(false) + [7]=> + string(3) "abc" + [8]=> + string(0) "" +} diff --git a/ext/standard/tests/array/bug72116.phpt b/ext/standard/tests/array/bug72116.phpt new file mode 100644 index 0000000000..7951f69130 --- /dev/null +++ b/ext/standard/tests/array/bug72116.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #72116 (insertion after array_fill fails) +--FILE-- +<?php + +$x = array_fill(0, 1, '..'); +$x[] = 'a'; +var_dump($x); + +?> +--EXPECT-- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "a" +} + diff --git a/ext/standard/tests/array/bug72369.phpt b/ext/standard/tests/array/bug72369.phpt new file mode 100644 index 0000000000..63bb5625de --- /dev/null +++ b/ext/standard/tests/array/bug72369.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72369 (array_merge() produces references in PHP7) +--FILE-- +<?php +$x = 'xxx'; +$d = ['test' => &$x]; +unset($x); +$a = ['test' => 'yyy']; +$a = array_merge($a, $d); +debug_zval_dump($a); +?> +--EXPECTF-- +array(1) refcount(%d){ + ["test"]=> + string(3) "xxx" refcount(%d) +} diff --git a/ext/standard/tests/array/range_bug72017.phpt b/ext/standard/tests/array/range_bug72017.phpt new file mode 100644 index 0000000000..b5a56d7f4e --- /dev/null +++ b/ext/standard/tests/array/range_bug72017.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #72017 (incorrect truncation due to floating point precision issue) +--FILE-- +<?php +var_dump(range(4.5, 4.2, 0.1)); +?> +--EXPECT-- +array(4) { + [0]=> + float(4.5) + [1]=> + float(4.4) + [2]=> + float(4.3) + [3]=> + float(4.2) +} diff --git a/ext/standard/tests/array/unexpected_array_mod_bug.phpt b/ext/standard/tests/array/unexpected_array_mod_bug.phpt index 58f2249205..2762ebd830 100644 --- a/ext/standard/tests/array/unexpected_array_mod_bug.phpt +++ b/ext/standard/tests/array/unexpected_array_mod_bug.phpt @@ -4,7 +4,7 @@ Crash when function parameter modified via reference <?php function usercompare($a,$b) { unset($GLOBALS['my_var'][2]); - return 0; + return $a <=> $b; } $my_var = array(1 => "entry_1", 2 => "entry_2", @@ -12,10 +12,19 @@ $my_var = array(1 => "entry_1", 4 => "entry_4", 5 => "entry_5"); usort($my_var, "usercompare"); +var_dump($my_var); -echo "Done.\n"; ?> ---EXPECTF-- - -Warning: usort(): Array was modified by the user comparison function in %s on line %d -Done. +--EXPECT-- +array(5) { + [0]=> + string(7) "entry_1" + [1]=> + string(7) "entry_2" + [2]=> + string(7) "entry_3" + [3]=> + string(7) "entry_4" + [4]=> + string(7) "entry_5" +} diff --git a/ext/standard/tests/array/unexpected_array_mod_bug_variation1.phpt b/ext/standard/tests/array/unexpected_array_mod_bug_variation1.phpt new file mode 100644 index 0000000000..b5a1ee24d5 --- /dev/null +++ b/ext/standard/tests/array/unexpected_array_mod_bug_variation1.phpt @@ -0,0 +1,33 @@ +--TEST-- +Crash when function parameter modified via reference while keeping orig refcount +--FILE-- +<?php + +$array = array( + 1 => "entry_1", + 2 => "entry_2", + 3 => "entry_3", + 4 => "entry_4", + 5 => "entry_5" +); +usort($array, function($a, $b) use (&$array, &$ref) { + unset($array[2]); + $ref = $array; + return $a <=> $b; +}); +var_dump($array); + +?> +--EXPECT-- +array(5) { + [0]=> + string(7) "entry_1" + [1]=> + string(7) "entry_2" + [2]=> + string(7) "entry_3" + [3]=> + string(7) "entry_4" + [4]=> + string(7) "entry_5" +} diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt index 41a7197535..7861d435c8 100644 --- a/ext/standard/tests/assert/assert_error2.phpt +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -22,8 +22,11 @@ echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) -Warning: Missing argument 4 for f1() in %s on line 2 -f1 called - Warning: assert(): Assertion "0 != 0" failed in %s on line 9 +Fatal error: Uncaught Error: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2 +Stack trace: +#0 [internal function]: f1('%s', 9, '0 != 0') +#1 %sassert_error2.php(9): assert('0 != 0') +#2 {main} + thrown in %sassert_error2.php on line 2 diff --git a/ext/standard/tests/bug71827.phpt b/ext/standard/tests/bug71827.phpt new file mode 100644 index 0000000000..eedb9fb549 --- /dev/null +++ b/ext/standard/tests/bug71827.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #71827 (substr_replace bug when length type is string ) +--FILE-- +<?php +$line = str_repeat(' ',20); $value ='03'; $pos=0; $len='2'; +$line = substr_replace($line,$value,$pos,$len); +echo "[$line]\n"; +?> +--EXPECT-- +[03 ] diff --git a/ext/standard/tests/file/bug38450.phpt b/ext/standard/tests/file/bug38450.phpt index 07e413b92b..4a2953ea79 100644 --- a/ext/standard/tests/file/bug38450.phpt +++ b/ext/standard/tests/file/bug38450.phpt @@ -7,7 +7,7 @@ class VariableStream { var $position; var $varname; - function __construct($var) { + function __construct($var=null) { var_dump("constructor!"); } @@ -102,7 +102,6 @@ var_dump($myvar); echo "Done\n"; ?> --EXPECTF-- -Warning: Missing argument 1 for VariableStream::__construct() in %s on line %d string(12) "constructor!" line1 line2 diff --git a/ext/standard/tests/file/bug38450_1.phpt b/ext/standard/tests/file/bug38450_1.phpt index 07e413b92b..d0682186f9 100644 --- a/ext/standard/tests/file/bug38450_1.phpt +++ b/ext/standard/tests/file/bug38450_1.phpt @@ -7,7 +7,7 @@ class VariableStream { var $position; var $varname; - function __construct($var) { + function __construct($var = null) { var_dump("constructor!"); } @@ -102,7 +102,6 @@ var_dump($myvar); echo "Done\n"; ?> --EXPECTF-- -Warning: Missing argument 1 for VariableStream::__construct() in %s on line %d string(12) "constructor!" line1 line2 diff --git a/ext/standard/tests/file/bug38450_2.phpt b/ext/standard/tests/file/bug38450_2.phpt index 7934bb40f5..64c9f8d94a 100644 --- a/ext/standard/tests/file/bug38450_2.phpt +++ b/ext/standard/tests/file/bug38450_2.phpt @@ -7,7 +7,7 @@ class VariableStream { var $position; var $varname; - function __construct($var) { + function __construct($var = null) { throw new Exception("constructor"); } @@ -102,7 +102,6 @@ var_dump($myvar); echo "Done\n"; ?> --EXPECTF-- -Warning: Missing argument 1 for VariableStream::__construct() in %s on line %d Warning: fopen(var://myvar): failed to open stream: "VariableStream::stream_open" call failed in %s on line %d diff --git a/ext/standard/tests/file/bug38450_3.phpt b/ext/standard/tests/file/bug38450_3.phpt index f2c4643ef3..07c5958ab4 100644 --- a/ext/standard/tests/file/bug38450_3.phpt +++ b/ext/standard/tests/file/bug38450_3.phpt @@ -104,7 +104,7 @@ echo "Done\n"; --EXPECTF-- Warning: fopen(var://myvar): failed to open stream: "VariableStream::stream_open" call failed in %sbug38450_3.php on line %d -Fatal error: Uncaught TypeError: Argument 1 passed to VariableStream::__construct() must be of the type array, none given in %s:%d +Fatal error: Uncaught Error: Too few arguments to function VariableStream::__construct(), 0 passed and exactly 1 expected in %sbug38450_3.php:7 Stack trace: #0 [internal function]: VariableStream->__construct() #1 %s(%d): fopen('var://myvar', 'r+') diff --git a/ext/standard/tests/file/bug39673.phpt b/ext/standard/tests/file/bug39673.phpt index 3836f2103d..00c29b28da 100644 --- a/ext/standard/tests/file/bug39673.phpt +++ b/ext/standard/tests/file/bug39673.phpt @@ -22,14 +22,14 @@ $offsets = array( foreach ($offsets as $offset) { $r = file_get_contents($filename, false, null, $offset); - var_dump(strlen($r)); + if ($r !== false) var_dump(strlen($r)); } @unlink($filename); echo "Done\n"; ?> ---EXPECTF-- -int(13824) +--EXPECTF-- +int(1) int(13824) int(0) int(1) diff --git a/ext/standard/tests/file/bug47517.phpt b/ext/standard/tests/file/bug47517.phpt new file mode 100644 index 0000000000..97f387c865 --- /dev/null +++ b/ext/standard/tests/file/bug47517.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #47517 test registry virtualization disabled +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only for Windows'); +} +?> +--FILE-- +<?php +/* This has to behave same way on both 64- and 32-bits. */ +file_put_contents('C:\Program Files\myfile.txt', 'hello'); +?> +==DONE== +--EXPECTF-- +Warning: file_put_contents(C:\Program Files\myfile.txt): failed to open stream: Permission denied in %sbug47517.php on line %d +==DONE== diff --git a/ext/standard/tests/file/bug52624.phpt b/ext/standard/tests/file/bug52624.phpt index ee61eb90e6..c5e7a9cb0e 100644 --- a/ext/standard/tests/file/bug52624.phpt +++ b/ext/standard/tests/file/bug52624.phpt @@ -9,4 +9,6 @@ echo tempnam("directory_that_not_exists", "prefix_"); ?> --EXPECTF-- +Notice: tempnam(): file created in the system's temporary directory in %sbug52624.php on line %d + Warning: tempnam(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt new file mode 100644 index 0000000000..a2abbb7f35 --- /dev/null +++ b/ext/standard/tests/file/bug72035.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #72035 php-cgi.exe fails to run scripts relative to drive root +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); +if(php_sapi_name() != "cli") die('skip CLI only test'); + +$cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe"; +if (!file_exists($cgi)) die('skip CGI binary not found'); +?> +--FILE-- +<?php + +$fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . md5(uniqid()) . ".php"; +$fl = substr($fl, 2); + +$cgi = realpath(dirname(PHP_BINARY) . DIRECTORY_SEPARATOR . "php-cgi.exe"); + +file_put_contents($fl, "<?php echo \"hello\", \"\n\"; ?>"); + +$cmd = "$cgi -n -C $fl"; + +/* Need to run CGI with the env reset. */ +$desc = array(0 => array("pipe", "r")); +$proc = proc_open($cmd, $desc, $pipes, getcwd(), array()); +if (is_resource($proc)) { + echo stream_get_contents($pipes[0]); + + proc_close($proc); +} + +unlink($fl); +?> +==DONE== +--EXPECTF-- +X-Powered-By: PHP/%s +Content-type: text/html; charset=UTF-8 + +hello +==DONE== diff --git a/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt b/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt new file mode 100644 index 0000000000..3afc3dc180 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation5_32bit.phpt @@ -0,0 +1,236 @@ +--TEST-- +Test file_get_contents() function : usage variation +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32-bit only"); +--FILE-- +<?php +/* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) + * Description: Read the entire file into a string + * Source code: ext/standard/file.c + * Alias to functions: + */ + +echo "*** Testing file_get_contents() : usage variation ***\n"; + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + +// Initialise function arguments not being substituted (if any) +$filename = 'FileGetContentsVar5.tmp'; +$absFile = dirname(__FILE__).'/'.$filename; +$h = fopen($absFile,"w"); +fwrite($h, b"contents read"); +fclose($h); + + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// add arrays +$index_array = array (1, 2, 3); +$assoc_array = array ('one' => 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -12345, + 'int -10' => -10, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float -22.5' => -22.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for offset + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( file_get_contents($absFile, false, null, $value) ); +}; + +unlink($absFile); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_get_contents() : usage variation *** + +--int 0-- +string(%d) "contents read" + +--int 1-- +string(%d) "ontents read" + +--int 12345-- +string(%d) "" + +--int -12345-- +Error: 2 - file_get_contents(): Failed to seek to position -12345 in the stream, %s(%d) +bool(false) + +--int -10-- +string(10) "tents read" + +--float 10.5-- +string(3) "ead" + +--float -10.5-- +string(10) "tents read" + +--float -22.5-- +Error: 2 - file_get_contents(): Failed to seek to position -22 in the stream, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, float given, %s(%d) +NULL + +--float -12.3456789000e10-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, float given, %s(%d) +NULL + +--float .5-- +string(%d) "contents read" + +--empty array-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, array given, %s(%d) +NULL + +--uppercase NULL-- +string(%d) "contents read" + +--lowercase null-- +string(%d) "contents read" + +--lowercase true-- +string(12) "ontents read" + +--lowercase false-- +string(%d) "contents read" + +--uppercase TRUE-- +string(12) "ontents read" + +--uppercase FALSE-- +string(%d) "contents read" + +--empty string DQ-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d) +NULL + +--string DQ-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d) +NULL + +--string SQ-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d) +NULL + +--heredoc-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, %unicode_string_optional% given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - file_get_contents() expects parameter 4 to be integer, object given, %s(%d) +NULL + +--undefined var-- +string(%d) "contents read" + +--unset var-- +string(%d) "contents read" +===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation5.phpt b/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt index aa13d69eb8..df33059f30 100644 --- a/ext/standard/tests/file/file_get_contents_variation5.phpt +++ b/ext/standard/tests/file/file_get_contents_variation5_64bit.phpt @@ -63,11 +63,13 @@ $inputs = array( 'int 0' => 0, 'int 1' => 1, 'int 12345' => 12345, - 'int -12345' => -2345, + 'int -12345' => -12345, + 'int -10' => -10, // float data 'float 10.5' => 10.5, 'float -10.5' => -10.5, + 'float -22.5' => -22.5, 'float 12.3456789000e10' => 12.3456789000e10, 'float -12.3456789000e10' => -12.3456789000e10, 'float .5' => .5, @@ -133,19 +135,28 @@ string(%d) "ontents read" string(%d) "" --int -12345-- -string(%d) "contents read" +Error: 2 - file_get_contents(): Failed to seek to position -12345 in the stream, %s(%d) +bool(false) + +--int -10-- +string(10) "tents read" --float 10.5-- string(3) "ead" --float -10.5-- -string(%d) "contents read" +string(10) "tents read" + +--float -22.5-- +Error: 2 - file_get_contents(): Failed to seek to position -22 in the stream, %s(%d) +bool(false) --float 12.3456789000e10-- string(%d) %s --float -12.3456789000e10-- -string(%d) %s +Error: 2 - file_get_contents(): Failed to seek to position -123456789000 in the stream, %s(%d) +bool(false) --float .5-- string(%d) "contents read" diff --git a/ext/standard/tests/file/file_put_contents_variation7-win32.phpt b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt index d7bfdf9233..e1a94a2043 100644 --- a/ext/standard/tests/file/file_put_contents_variation7-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt @@ -59,10 +59,10 @@ for($i = 0; $i<count($allDirs); $i++) { $j = $i+1; $dir = $allDirs[$i]; echo "\n-- Iteration $j --\n"; - $res = file_put_contents($dir."\\".$filename, ($data + $i)); + $res = file_put_contents($dir."\\".$filename, ($data . $i)); if ($res !== false) { $in = file_get_contents($absFile); - if ($in == ($data + $i)) { + if ($in == ($data . $i)) { echo "Data written correctly\n"; } else { @@ -127,4 +127,4 @@ No data written -- Iteration 12 -- Data written correctly -*** Done ***
\ No newline at end of file +*** Done *** diff --git a/ext/standard/tests/file/file_put_contents_variation7.phpt b/ext/standard/tests/file/file_put_contents_variation7.phpt index 5c8e5f3602..b1b2face60 100644 --- a/ext/standard/tests/file/file_put_contents_variation7.phpt +++ b/ext/standard/tests/file/file_put_contents_variation7.phpt @@ -51,10 +51,10 @@ for($i = 0; $i<count($allDirs); $i++) { $j = $i+1; $dir = $allDirs[$i]; echo "\n-- Iteration $j --\n"; - $res = file_put_contents($dir."/".$filename, ($data + $i)); + $res = file_put_contents($dir."/".$filename, ($data . $i)); if ($res !== false) { $in = file_get_contents($absFile); - if ($in == ($data + $i)) { + if ($in == ($data . $i)) { echo "Data written correctly\n"; } else { @@ -116,4 +116,4 @@ Data written correctly Warning: file_put_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d No data written -*** Done ***
\ No newline at end of file +*** Done *** diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt index c37bdeb20a..003dd53dfa 100644 --- a/ext/standard/tests/file/fscanf.phpt +++ b/ext/standard/tests/file/fscanf.phpt @@ -7,7 +7,7 @@ $filename = dirname(__FILE__)."/fscanf.dat"; var_dump(fscanf()); var_dump(fscanf(array())); -var_dump(fscanf(array(), array(), new stdclass)); +var_dump(fscanf(array(), array())); file_put_contents($filename, "data"); diff --git a/ext/standard/tests/file/tempnam_variation2-win32.phpt b/ext/standard/tests/file/tempnam_variation2-win32.phpt index 4224966daf..15d59614ff 100644 --- a/ext/standard/tests/file/tempnam_variation2-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation2-win32.phpt @@ -121,6 +121,8 @@ File permissions are => 100666 File created in => directory specified -- Iteration 7 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2-win32.php on line %d File name is => %s\t%s File permissions are => 100666 File created in => temp dir @@ -131,11 +133,15 @@ File permissions are => 100666 File created in => directory specified -- Iteration 9 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2-win32.php on line %d File name is => %s\t%s File permissions are => 100666 File created in => temp dir -- Iteration 10 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2-win32.php on line %d File name is => %s\t%s File permissions are => 100666 File created in => temp dir @@ -156,8 +162,10 @@ File permissions are => 100666 File created in => directory specified -- Iteration 14 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2-win32.php on line %d File name is => %s\t%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..1a2de1885b 100644 --- a/ext/standard/tests/file/tempnam_variation2.phpt +++ b/ext/standard/tests/file/tempnam_variation2.phpt @@ -121,6 +121,8 @@ File permissions are => 100600 File created in => directory specified -- Iteration 7 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2.php on line %d File name is => %s/tempnam_variation2.tmp%s File permissions are => 100600 File created in => temp dir @@ -131,11 +133,15 @@ File permissions are => 100600 File created in => directory specified -- Iteration 9 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2.php on line %d File name is => %s/tempnam_variation2.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 10 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2.php on line %d File name is => %s/tempnam_variation2.tmp%s File permissions are => 100600 File created in => temp dir @@ -156,8 +162,10 @@ File permissions are => 100600 File created in => directory specified -- Iteration 14 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation2.php on line %d File name is => %s/tempnam_variation2.tmp%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 df0d88feda..6d5071b5e5 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -99,6 +99,8 @@ OK -- Iteration 4 -- OK -- Iteration 5 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation3-win32.php on line %d Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- diff --git a/ext/standard/tests/file/tempnam_variation4-0.phpt b/ext/standard/tests/file/tempnam_variation4-0.phpt new file mode 100644 index 0000000000..e96846ff2c --- /dev/null +++ b/ext/standard/tests/file/tempnam_variation4-0.phpt @@ -0,0 +1,638 @@ +--TEST-- +Test tempnam() function: usage variations - permissions(0000 to 0350) of dir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip Not valid for Windows'); +} +// Skip if being run by root +$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); +?> +--FILE-- +<?php +/* Prototype: string tempnam ( string $dir, string $prefix ); + Description: Create file with unique file name. +*/ + +/* Trying to create the file in a dir with permissions from 0000 to 0350, + Allowable permissions: files are expected to be created in the input dir + Non-allowable permissions: files are expected to be created in '/tmp' dir +*/ + +echo "*** Testing tempnam() with dir of permissions from 0000 to 0350 ***\n"; +$file_path = dirname(__FILE__); +$dir_name = $file_path."/tempnam_variation4"; +$prefix = "tempnamVar4."; + +mkdir($dir_name); + +for($mode = 0000; $mode <= 0350; $mode++) { + chmod($dir_name, $mode); + $file_name = tempnam($dir_name, $prefix); + + if(file_exists($file_name) ) { + if (dirname($file_name) != $dir_name) { + /* Either there's a notice or error */ + printf("%o\n", $mode); + + if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) { + echo " created in unexpected dir\n"; + } + } + unlink($file_name); + } + else { + print("FAILED: File is not created\n"); + } +} + +rmdir($dir_name); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing tempnam() with dir of permissions from 0000 to 0350 *** + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +0 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +1 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +2 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +3 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +4 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +5 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +6 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +7 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +10 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +11 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +12 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +13 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +14 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +15 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +16 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +17 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +20 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +21 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +22 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +23 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +24 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +25 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +26 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +27 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +30 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +31 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +32 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +33 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +34 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +35 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +36 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +37 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +40 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +41 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +42 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +43 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +44 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +45 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +46 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +47 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +50 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +51 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +52 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +53 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +54 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +55 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +56 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +57 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +60 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +61 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +62 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +63 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +64 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +65 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +66 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +67 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +70 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +71 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +72 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +73 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +74 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +75 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +76 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +77 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +100 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +101 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +102 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +103 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +104 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +105 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +106 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +107 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +110 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +111 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +112 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +113 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +114 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +115 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +116 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +117 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +120 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +121 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +122 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +123 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +124 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +125 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +126 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +127 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +130 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +131 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +132 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +133 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +134 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +135 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +136 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +137 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +140 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +141 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +142 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +143 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +144 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +145 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +146 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +147 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +150 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +151 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +152 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +153 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +154 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +155 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +156 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +157 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +160 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +161 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +162 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +163 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +164 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +165 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +166 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +167 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +170 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +171 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +172 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +173 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +174 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +175 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +176 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +177 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +200 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +201 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +202 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +203 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +204 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +205 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +206 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +207 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +210 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +211 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +212 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +213 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +214 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +215 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +216 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +217 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +220 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +221 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +222 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +223 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +224 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +225 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +226 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +227 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +230 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +231 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +232 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +233 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +234 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +235 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +236 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +237 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +240 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +241 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +242 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +243 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +244 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +245 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +246 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +247 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +250 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +251 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +252 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +253 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +254 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +255 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +256 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +257 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +260 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +261 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +262 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +263 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +264 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +265 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +266 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +267 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +270 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +271 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +272 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +273 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +274 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +275 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +276 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 +277 +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation4-1.phpt b/ext/standard/tests/file/tempnam_variation4-1.phpt new file mode 100644 index 0000000000..667d3ecda6 --- /dev/null +++ b/ext/standard/tests/file/tempnam_variation4-1.phpt @@ -0,0 +1,638 @@ +--TEST-- +Test tempnam() function: usage variations - permissions(0351 to 0777) of dir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip Not valid for Windows'); +} +// Skip if being run by root +$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); +?> +--FILE-- +<?php +/* Prototype: string tempnam ( string $dir, string $prefix ); + Description: Create file with unique file name. +*/ + +/* Trying to create the file in a dir with permissions from 0351 to 0777, + Allowable permissions: files are expected to be created in the input dir + Non-allowable permissions: files are expected to be created in '/tmp' dir +*/ + +echo "*** Testing tempnam() with dir of permissions from 0351 to 0777 ***\n"; +$file_path = dirname(__FILE__); +$dir_name = $file_path."/tempnam_variation4"; +$prefix = "tempnamVar4."; + +mkdir($dir_name); + +for($mode = 0351; $mode <= 0777; $mode++) { + chmod($dir_name, $mode); + $file_name = tempnam($dir_name, $prefix); + + if(file_exists($file_name) ) { + if (dirname($file_name) != $dir_name) { + /* Either there's a notice or error */ + printf("%o\n", $mode); + + if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) { + echo " created in unexpected dir\n"; + } + } + unlink($file_name); + } + else { + print("FAILED: File is not created\n"); + } +} + +rmdir($dir_name); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing tempnam() with dir of permissions from 0351 to 0777 *** + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +400 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +401 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +402 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +403 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +404 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +405 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +406 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +407 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +410 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +411 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +412 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +413 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +414 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +415 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +416 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +417 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +420 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +421 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +422 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +423 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +424 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +425 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +426 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +427 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +430 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +431 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +432 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +433 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +434 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +435 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +436 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +437 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +440 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +441 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +442 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +443 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +444 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +445 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +446 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +447 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +450 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +451 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +452 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +453 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +454 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +455 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +456 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +457 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +460 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +461 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +462 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +463 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +464 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +465 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +466 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +467 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +470 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +471 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +472 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +473 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +474 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +475 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +476 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +477 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +500 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +501 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +502 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +503 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +504 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +505 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +506 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +507 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +510 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +511 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +512 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +513 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +514 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +515 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +516 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +517 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +520 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +521 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +522 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +523 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +524 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +525 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +526 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +527 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +530 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +531 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +532 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +533 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +534 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +535 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +536 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +537 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +540 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +541 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +542 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +543 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +544 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +545 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +546 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +547 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +550 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +551 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +552 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +553 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +554 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +555 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +556 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +557 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +560 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +561 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +562 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +563 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +564 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +565 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +566 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +567 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +570 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +571 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +572 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +573 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +574 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +575 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +576 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +577 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +600 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +601 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +602 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +603 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +604 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +605 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +606 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +607 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +610 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +611 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +612 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +613 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +614 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +615 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +616 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +617 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +620 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +621 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +622 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +623 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +624 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +625 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +626 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +627 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +630 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +631 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +632 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +633 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +634 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +635 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +636 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +637 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +640 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +641 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +642 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +643 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +644 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +645 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +646 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +647 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +650 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +651 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +652 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +653 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +654 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +655 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +656 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +657 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +660 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +661 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +662 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +663 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +664 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +665 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +666 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +667 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +670 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +671 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +672 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +673 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +674 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +675 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +676 + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20 +677 +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation4.phpt b/ext/standard/tests/file/tempnam_variation4.phpt deleted file mode 100644 index 4ce1c7ec24..0000000000 --- a/ext/standard/tests/file/tempnam_variation4.phpt +++ /dev/null @@ -1,1092 +0,0 @@ ---TEST-- -Test tempnam() function: usage variations - permissions(0000 to 0777) of dir ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip Not valid for Windows'); -} -// Skip if being run by root -$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); -?> ---FILE-- -<?php -/* Prototype: string tempnam ( string $dir, string $prefix ); - Description: Create file with unique file name. -*/ - -/* Trying to create the file in a dir with permissions from 0000 to 0777, - Allowable permissions: files are expected to be created in the input dir - Non-allowable permissions: files are expected to be created in '/tmp' dir -*/ - -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++) { - echo "-- dir perms "; - printf("%o", $mode); - echo " --\n"; - chmod($dir_name, $mode); - $file_name = tempnam($dir_name, $prefix); - - if(file_exists($file_name) ) { - if (realpath(dirname($file_name)) == realpath(sys_get_temp_dir())) { - $msg = " created in temp dir "; - } - else if (dirname($file_name) == $dir_name) { - $msg = " created in requested dir"; - } - else { - $msg = " created in unexpected dir"; - } - - echo $msg."\n"; - unlink($file_name); - } - else { - print("FAILED: File is not created\n"); - } -} - -rmdir($dir_name); - -echo "*** Done ***\n"; -?> ---EXPECTF-- -*** Testing tempnam() with dir of permissions from 0000 to 0777 *** --- dir perms 0 -- - created in temp dir --- dir perms 1 -- - created in temp dir --- dir perms 2 -- - created in temp dir --- dir perms 3 -- - created in temp dir --- dir perms 4 -- - created in temp dir --- dir perms 5 -- - created in temp dir --- dir perms 6 -- - created in temp dir --- dir perms 7 -- - created in temp dir --- dir perms 10 -- - created in temp dir --- dir perms 11 -- - created in temp dir --- dir perms 12 -- - created in temp dir --- dir perms 13 -- - created in temp dir --- dir perms 14 -- - created in temp dir --- dir perms 15 -- - created in temp dir --- dir perms 16 -- - created in temp dir --- dir perms 17 -- - created in temp dir --- dir perms 20 -- - created in temp dir --- dir perms 21 -- - created in temp dir --- dir perms 22 -- - created in temp dir --- dir perms 23 -- - created in temp dir --- dir perms 24 -- - created in temp dir --- dir perms 25 -- - created in temp dir --- dir perms 26 -- - created in temp dir --- dir perms 27 -- - created in temp dir --- dir perms 30 -- - created in temp dir --- dir perms 31 -- - created in temp dir --- dir perms 32 -- - created in temp dir --- dir perms 33 -- - created in temp dir --- dir perms 34 -- - created in temp dir --- dir perms 35 -- - created in temp dir --- dir perms 36 -- - created in temp dir --- dir perms 37 -- - created in temp dir --- dir perms 40 -- - created in temp dir --- dir perms 41 -- - created in temp dir --- dir perms 42 -- - created in temp dir --- dir perms 43 -- - created in temp dir --- dir perms 44 -- - created in temp dir --- dir perms 45 -- - created in temp dir --- dir perms 46 -- - created in temp dir --- dir perms 47 -- - created in temp dir --- dir perms 50 -- - created in temp dir --- dir perms 51 -- - created in temp dir --- dir perms 52 -- - created in temp dir --- dir perms 53 -- - created in temp dir --- dir perms 54 -- - created in temp dir --- dir perms 55 -- - created in temp dir --- dir perms 56 -- - created in temp dir --- dir perms 57 -- - created in temp dir --- dir perms 60 -- - created in temp dir --- dir perms 61 -- - created in temp dir --- dir perms 62 -- - created in temp dir --- dir perms 63 -- - created in temp dir --- dir perms 64 -- - created in temp dir --- dir perms 65 -- - created in temp dir --- dir perms 66 -- - created in temp dir --- dir perms 67 -- - created in temp dir --- dir perms 70 -- - created in temp dir --- dir perms 71 -- - created in temp dir --- dir perms 72 -- - created in temp dir --- dir perms 73 -- - created in temp dir --- dir perms 74 -- - created in temp dir --- dir perms 75 -- - created in temp dir --- dir perms 76 -- - created in temp dir --- dir perms 77 -- - created in temp dir --- dir perms 100 -- - created in temp dir --- dir perms 101 -- - created in temp dir --- dir perms 102 -- - created in temp dir --- dir perms 103 -- - created in temp dir --- dir perms 104 -- - created in temp dir --- dir perms 105 -- - created in temp dir --- dir perms 106 -- - created in temp dir --- dir perms 107 -- - created in temp dir --- dir perms 110 -- - created in temp dir --- dir perms 111 -- - created in temp dir --- dir perms 112 -- - created in temp dir --- dir perms 113 -- - created in temp dir --- dir perms 114 -- - created in temp dir --- dir perms 115 -- - created in temp dir --- dir perms 116 -- - created in temp dir --- dir perms 117 -- - created in temp dir --- dir perms 120 -- - created in temp dir --- dir perms 121 -- - created in temp dir --- dir perms 122 -- - created in temp dir --- dir perms 123 -- - created in temp dir --- dir perms 124 -- - created in temp dir --- dir perms 125 -- - created in temp dir --- dir perms 126 -- - created in temp dir --- dir perms 127 -- - created in temp dir --- dir perms 130 -- - created in temp dir --- dir perms 131 -- - created in temp dir --- dir perms 132 -- - created in temp dir --- dir perms 133 -- - created in temp dir --- dir perms 134 -- - created in temp dir --- dir perms 135 -- - created in temp dir --- dir perms 136 -- - created in temp dir --- dir perms 137 -- - created in temp dir --- dir perms 140 -- - created in temp dir --- dir perms 141 -- - created in temp dir --- dir perms 142 -- - created in temp dir --- dir perms 143 -- - created in temp dir --- dir perms 144 -- - created in temp dir --- dir perms 145 -- - created in temp dir --- dir perms 146 -- - created in temp dir --- dir perms 147 -- - created in temp dir --- dir perms 150 -- - created in temp dir --- dir perms 151 -- - created in temp dir --- dir perms 152 -- - created in temp dir --- dir perms 153 -- - created in temp dir --- dir perms 154 -- - created in temp dir --- dir perms 155 -- - created in temp dir --- dir perms 156 -- - created in temp dir --- dir perms 157 -- - created in temp dir --- dir perms 160 -- - created in temp dir --- dir perms 161 -- - created in temp dir --- dir perms 162 -- - created in temp dir --- dir perms 163 -- - created in temp dir --- dir perms 164 -- - created in temp dir --- dir perms 165 -- - created in temp dir --- dir perms 166 -- - created in temp dir --- dir perms 167 -- - created in temp dir --- dir perms 170 -- - created in temp dir --- dir perms 171 -- - created in temp dir --- dir perms 172 -- - created in temp dir --- dir perms 173 -- - created in temp dir --- dir perms 174 -- - created in temp dir --- dir perms 175 -- - created in temp dir --- dir perms 176 -- - created in temp dir --- dir perms 177 -- - created in temp dir --- dir perms 200 -- - created in temp dir --- dir perms 201 -- - created in temp dir --- dir perms 202 -- - created in temp dir --- dir perms 203 -- - created in temp dir --- dir perms 204 -- - created in temp dir --- dir perms 205 -- - created in temp dir --- dir perms 206 -- - created in temp dir --- dir perms 207 -- - created in temp dir --- dir perms 210 -- - created in temp dir --- dir perms 211 -- - created in temp dir --- dir perms 212 -- - created in temp dir --- dir perms 213 -- - created in temp dir --- dir perms 214 -- - created in temp dir --- dir perms 215 -- - created in temp dir --- dir perms 216 -- - created in temp dir --- dir perms 217 -- - created in temp dir --- dir perms 220 -- - created in temp dir --- dir perms 221 -- - created in temp dir --- dir perms 222 -- - created in temp dir --- dir perms 223 -- - created in temp dir --- dir perms 224 -- - created in temp dir --- dir perms 225 -- - created in temp dir --- dir perms 226 -- - created in temp dir --- dir perms 227 -- - created in temp dir --- dir perms 230 -- - created in temp dir --- dir perms 231 -- - created in temp dir --- dir perms 232 -- - created in temp dir --- dir perms 233 -- - created in temp dir --- dir perms 234 -- - created in temp dir --- dir perms 235 -- - created in temp dir --- dir perms 236 -- - created in temp dir --- dir perms 237 -- - created in temp dir --- dir perms 240 -- - created in temp dir --- dir perms 241 -- - created in temp dir --- dir perms 242 -- - created in temp dir --- dir perms 243 -- - created in temp dir --- dir perms 244 -- - created in temp dir --- dir perms 245 -- - created in temp dir --- dir perms 246 -- - created in temp dir --- dir perms 247 -- - created in temp dir --- dir perms 250 -- - created in temp dir --- dir perms 251 -- - created in temp dir --- dir perms 252 -- - created in temp dir --- dir perms 253 -- - created in temp dir --- dir perms 254 -- - created in temp dir --- dir perms 255 -- - created in temp dir --- dir perms 256 -- - created in temp dir --- dir perms 257 -- - created in temp dir --- dir perms 260 -- - created in temp dir --- dir perms 261 -- - created in temp dir --- dir perms 262 -- - created in temp dir --- dir perms 263 -- - created in temp dir --- dir perms 264 -- - created in temp dir --- dir perms 265 -- - created in temp dir --- dir perms 266 -- - created in temp dir --- dir perms 267 -- - created in temp dir --- dir perms 270 -- - created in temp dir --- dir perms 271 -- - created in temp dir --- dir perms 272 -- - created in temp dir --- dir perms 273 -- - created in temp dir --- dir perms 274 -- - created in temp dir --- dir perms 275 -- - created in temp dir --- dir perms 276 -- - created in temp dir --- dir perms 277 -- - created in temp dir --- dir perms 300 -- - created in requested dir --- dir perms 301 -- - created in requested dir --- dir perms 302 -- - created in requested dir --- dir perms 303 -- - created in requested dir --- dir perms 304 -- - created in requested dir --- dir perms 305 -- - created in requested dir --- dir perms 306 -- - created in requested dir --- dir perms 307 -- - created in requested dir --- dir perms 310 -- - created in requested dir --- dir perms 311 -- - created in requested dir --- dir perms 312 -- - created in requested dir --- dir perms 313 -- - created in requested dir --- dir perms 314 -- - created in requested dir --- dir perms 315 -- - created in requested dir --- dir perms 316 -- - created in requested dir --- dir perms 317 -- - created in requested dir --- dir perms 320 -- - created in requested dir --- dir perms 321 -- - created in requested dir --- dir perms 322 -- - created in requested dir --- dir perms 323 -- - created in requested dir --- dir perms 324 -- - created in requested dir --- dir perms 325 -- - created in requested dir --- dir perms 326 -- - created in requested dir --- dir perms 327 -- - created in requested dir --- dir perms 330 -- - created in requested dir --- dir perms 331 -- - created in requested dir --- dir perms 332 -- - created in requested dir --- dir perms 333 -- - created in requested dir --- dir perms 334 -- - created in requested dir --- dir perms 335 -- - created in requested dir --- dir perms 336 -- - created in requested dir --- dir perms 337 -- - created in requested dir --- dir perms 340 -- - created in requested dir --- dir perms 341 -- - created in requested dir --- dir perms 342 -- - created in requested dir --- dir perms 343 -- - created in requested dir --- dir perms 344 -- - created in requested dir --- dir perms 345 -- - created in requested dir --- dir perms 346 -- - created in requested dir --- dir perms 347 -- - created in requested dir --- dir perms 350 -- - created in requested dir --- dir perms 351 -- - created in requested dir --- dir perms 352 -- - created in requested dir --- dir perms 353 -- - created in requested dir --- dir perms 354 -- - created in requested dir --- dir perms 355 -- - created in requested dir --- dir perms 356 -- - created in requested dir --- dir perms 357 -- - created in requested dir --- dir perms 360 -- - created in requested dir --- dir perms 361 -- - created in requested dir --- dir perms 362 -- - created in requested dir --- dir perms 363 -- - created in requested dir --- dir perms 364 -- - created in requested dir --- dir perms 365 -- - created in requested dir --- dir perms 366 -- - created in requested dir --- dir perms 367 -- - created in requested dir --- dir perms 370 -- - created in requested dir --- dir perms 371 -- - created in requested dir --- dir perms 372 -- - created in requested dir --- dir perms 373 -- - created in requested dir --- dir perms 374 -- - created in requested dir --- dir perms 375 -- - created in requested dir --- dir perms 376 -- - created in requested dir --- dir perms 377 -- - created in requested dir --- dir perms 400 -- - created in temp dir --- dir perms 401 -- - created in temp dir --- dir perms 402 -- - created in temp dir --- dir perms 403 -- - created in temp dir --- dir perms 404 -- - created in temp dir --- dir perms 405 -- - created in temp dir --- dir perms 406 -- - created in temp dir --- dir perms 407 -- - created in temp dir --- dir perms 410 -- - created in temp dir --- dir perms 411 -- - created in temp dir --- dir perms 412 -- - created in temp dir --- dir perms 413 -- - created in temp dir --- dir perms 414 -- - created in temp dir --- dir perms 415 -- - created in temp dir --- dir perms 416 -- - created in temp dir --- dir perms 417 -- - created in temp dir --- dir perms 420 -- - created in temp dir --- dir perms 421 -- - created in temp dir --- dir perms 422 -- - created in temp dir --- dir perms 423 -- - created in temp dir --- dir perms 424 -- - created in temp dir --- dir perms 425 -- - created in temp dir --- dir perms 426 -- - created in temp dir --- dir perms 427 -- - created in temp dir --- dir perms 430 -- - created in temp dir --- dir perms 431 -- - created in temp dir --- dir perms 432 -- - created in temp dir --- dir perms 433 -- - created in temp dir --- dir perms 434 -- - created in temp dir --- dir perms 435 -- - created in temp dir --- dir perms 436 -- - created in temp dir --- dir perms 437 -- - created in temp dir --- dir perms 440 -- - created in temp dir --- dir perms 441 -- - created in temp dir --- dir perms 442 -- - created in temp dir --- dir perms 443 -- - created in temp dir --- dir perms 444 -- - created in temp dir --- dir perms 445 -- - created in temp dir --- dir perms 446 -- - created in temp dir --- dir perms 447 -- - created in temp dir --- dir perms 450 -- - created in temp dir --- dir perms 451 -- - created in temp dir --- dir perms 452 -- - created in temp dir --- dir perms 453 -- - created in temp dir --- dir perms 454 -- - created in temp dir --- dir perms 455 -- - created in temp dir --- dir perms 456 -- - created in temp dir --- dir perms 457 -- - created in temp dir --- dir perms 460 -- - created in temp dir --- dir perms 461 -- - created in temp dir --- dir perms 462 -- - created in temp dir --- dir perms 463 -- - created in temp dir --- dir perms 464 -- - created in temp dir --- dir perms 465 -- - created in temp dir --- dir perms 466 -- - created in temp dir --- dir perms 467 -- - created in temp dir --- dir perms 470 -- - created in temp dir --- dir perms 471 -- - created in temp dir --- dir perms 472 -- - created in temp dir --- dir perms 473 -- - created in temp dir --- dir perms 474 -- - created in temp dir --- dir perms 475 -- - created in temp dir --- dir perms 476 -- - created in temp dir --- dir perms 477 -- - created in temp dir --- dir perms 500 -- - created in temp dir --- dir perms 501 -- - created in temp dir --- dir perms 502 -- - created in temp dir --- dir perms 503 -- - created in temp dir --- dir perms 504 -- - created in temp dir --- dir perms 505 -- - created in temp dir --- dir perms 506 -- - created in temp dir --- dir perms 507 -- - created in temp dir --- dir perms 510 -- - created in temp dir --- dir perms 511 -- - created in temp dir --- dir perms 512 -- - created in temp dir --- dir perms 513 -- - created in temp dir --- dir perms 514 -- - created in temp dir --- dir perms 515 -- - created in temp dir --- dir perms 516 -- - created in temp dir --- dir perms 517 -- - created in temp dir --- dir perms 520 -- - created in temp dir --- dir perms 521 -- - created in temp dir --- dir perms 522 -- - created in temp dir --- dir perms 523 -- - created in temp dir --- dir perms 524 -- - created in temp dir --- dir perms 525 -- - created in temp dir --- dir perms 526 -- - created in temp dir --- dir perms 527 -- - created in temp dir --- dir perms 530 -- - created in temp dir --- dir perms 531 -- - created in temp dir --- dir perms 532 -- - created in temp dir --- dir perms 533 -- - created in temp dir --- dir perms 534 -- - created in temp dir --- dir perms 535 -- - created in temp dir --- dir perms 536 -- - created in temp dir --- dir perms 537 -- - created in temp dir --- dir perms 540 -- - created in temp dir --- dir perms 541 -- - created in temp dir --- dir perms 542 -- - created in temp dir --- dir perms 543 -- - created in temp dir --- dir perms 544 -- - created in temp dir --- dir perms 545 -- - created in temp dir --- dir perms 546 -- - created in temp dir --- dir perms 547 -- - created in temp dir --- dir perms 550 -- - created in temp dir --- dir perms 551 -- - created in temp dir --- dir perms 552 -- - created in temp dir --- dir perms 553 -- - created in temp dir --- dir perms 554 -- - created in temp dir --- dir perms 555 -- - created in temp dir --- dir perms 556 -- - created in temp dir --- dir perms 557 -- - created in temp dir --- dir perms 560 -- - created in temp dir --- dir perms 561 -- - created in temp dir --- dir perms 562 -- - created in temp dir --- dir perms 563 -- - created in temp dir --- dir perms 564 -- - created in temp dir --- dir perms 565 -- - created in temp dir --- dir perms 566 -- - created in temp dir --- dir perms 567 -- - created in temp dir --- dir perms 570 -- - created in temp dir --- dir perms 571 -- - created in temp dir --- dir perms 572 -- - created in temp dir --- dir perms 573 -- - created in temp dir --- dir perms 574 -- - created in temp dir --- dir perms 575 -- - created in temp dir --- dir perms 576 -- - created in temp dir --- dir perms 577 -- - created in temp dir --- dir perms 600 -- - created in temp dir --- dir perms 601 -- - created in temp dir --- dir perms 602 -- - created in temp dir --- dir perms 603 -- - created in temp dir --- dir perms 604 -- - created in temp dir --- dir perms 605 -- - created in temp dir --- dir perms 606 -- - created in temp dir --- dir perms 607 -- - created in temp dir --- dir perms 610 -- - created in temp dir --- dir perms 611 -- - created in temp dir --- dir perms 612 -- - created in temp dir --- dir perms 613 -- - created in temp dir --- dir perms 614 -- - created in temp dir --- dir perms 615 -- - created in temp dir --- dir perms 616 -- - created in temp dir --- dir perms 617 -- - created in temp dir --- dir perms 620 -- - created in temp dir --- dir perms 621 -- - created in temp dir --- dir perms 622 -- - created in temp dir --- dir perms 623 -- - created in temp dir --- dir perms 624 -- - created in temp dir --- dir perms 625 -- - created in temp dir --- dir perms 626 -- - created in temp dir --- dir perms 627 -- - created in temp dir --- dir perms 630 -- - created in temp dir --- dir perms 631 -- - created in temp dir --- dir perms 632 -- - created in temp dir --- dir perms 633 -- - created in temp dir --- dir perms 634 -- - created in temp dir --- dir perms 635 -- - created in temp dir --- dir perms 636 -- - created in temp dir --- dir perms 637 -- - created in temp dir --- dir perms 640 -- - created in temp dir --- dir perms 641 -- - created in temp dir --- dir perms 642 -- - created in temp dir --- dir perms 643 -- - created in temp dir --- dir perms 644 -- - created in temp dir --- dir perms 645 -- - created in temp dir --- dir perms 646 -- - created in temp dir --- dir perms 647 -- - created in temp dir --- dir perms 650 -- - created in temp dir --- dir perms 651 -- - created in temp dir --- dir perms 652 -- - created in temp dir --- dir perms 653 -- - created in temp dir --- dir perms 654 -- - created in temp dir --- dir perms 655 -- - created in temp dir --- dir perms 656 -- - created in temp dir --- dir perms 657 -- - created in temp dir --- dir perms 660 -- - created in temp dir --- dir perms 661 -- - created in temp dir --- dir perms 662 -- - created in temp dir --- dir perms 663 -- - created in temp dir --- dir perms 664 -- - created in temp dir --- dir perms 665 -- - created in temp dir --- dir perms 666 -- - created in temp dir --- dir perms 667 -- - created in temp dir --- dir perms 670 -- - created in temp dir --- dir perms 671 -- - created in temp dir --- dir perms 672 -- - created in temp dir --- dir perms 673 -- - created in temp dir --- dir perms 674 -- - created in temp dir --- dir perms 675 -- - created in temp dir --- dir perms 676 -- - created in temp dir --- dir perms 677 -- - created in temp dir --- dir perms 700 -- - created in requested dir --- dir perms 701 -- - created in requested dir --- dir perms 702 -- - created in requested dir --- dir perms 703 -- - created in requested dir --- dir perms 704 -- - created in requested dir --- dir perms 705 -- - created in requested dir --- dir perms 706 -- - created in requested dir --- dir perms 707 -- - created in requested dir --- dir perms 710 -- - created in requested dir --- dir perms 711 -- - created in requested dir --- dir perms 712 -- - created in requested dir --- dir perms 713 -- - created in requested dir --- dir perms 714 -- - created in requested dir --- dir perms 715 -- - created in requested dir --- dir perms 716 -- - created in requested dir --- dir perms 717 -- - created in requested dir --- dir perms 720 -- - created in requested dir --- dir perms 721 -- - created in requested dir --- dir perms 722 -- - created in requested dir --- dir perms 723 -- - created in requested dir --- dir perms 724 -- - created in requested dir --- dir perms 725 -- - created in requested dir --- dir perms 726 -- - created in requested dir --- dir perms 727 -- - created in requested dir --- dir perms 730 -- - created in requested dir --- dir perms 731 -- - created in requested dir --- dir perms 732 -- - created in requested dir --- dir perms 733 -- - created in requested dir --- dir perms 734 -- - created in requested dir --- dir perms 735 -- - created in requested dir --- dir perms 736 -- - created in requested dir --- dir perms 737 -- - created in requested dir --- dir perms 740 -- - created in requested dir --- dir perms 741 -- - created in requested dir --- dir perms 742 -- - created in requested dir --- dir perms 743 -- - created in requested dir --- dir perms 744 -- - created in requested dir --- dir perms 745 -- - created in requested dir --- dir perms 746 -- - created in requested dir --- dir perms 747 -- - created in requested dir --- dir perms 750 -- - created in requested dir --- dir perms 751 -- - created in requested dir --- dir perms 752 -- - created in requested dir --- dir perms 753 -- - created in requested dir --- dir perms 754 -- - created in requested dir --- dir perms 755 -- - created in requested dir --- dir perms 756 -- - created in requested dir --- dir perms 757 -- - created in requested dir --- dir perms 760 -- - created in requested dir --- dir perms 761 -- - created in requested dir --- dir perms 762 -- - created in requested dir --- dir perms 763 -- - created in requested dir --- dir perms 764 -- - created in requested dir --- dir perms 765 -- - created in requested dir --- dir perms 766 -- - created in requested dir --- dir perms 767 -- - created in requested dir --- dir perms 770 -- - created in requested dir --- dir perms 771 -- - created in requested dir --- dir perms 772 -- - created in requested dir --- dir perms 773 -- - created in requested dir --- dir perms 774 -- - created in requested dir --- dir perms 775 -- - created in requested dir --- dir perms 776 -- - created in requested dir --- dir perms 777 -- - created in requested dir -*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 0c8caca95c..918ef36588 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -65,10 +65,14 @@ echo "\n*** Done ***\n"; --EXPECTF-- *** Testing tempnam() with invalid/non-existing directory names *** -- Iteration 0 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 1 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir @@ -85,6 +89,8 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 5 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir @@ -101,10 +107,14 @@ Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d -- Iteration 8 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 9 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index b6f81caabc..d24c1d8974 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -70,10 +70,14 @@ echo "\n*** Done ***\n"; --EXPECTF-- *** Testing tempnam() with invalid/non-existing directory names *** -- Iteration 0 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 1 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir @@ -90,6 +94,8 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 5 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir @@ -106,10 +112,14 @@ Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on Warning: unlink(): %s in %s on line %d -- Iteration 8 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s/tempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 9 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s/tempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir diff --git a/ext/standard/tests/file/tempnam_variation8-win32.phpt b/ext/standard/tests/file/tempnam_variation8-win32.phpt index 8df67b609e..52ff7b9daa 100644 --- a/ext/standard/tests/file/tempnam_variation8-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation8-win32.phpt @@ -115,11 +115,15 @@ File permissions are => 100666 File created in => directory specified -- Iteration 6 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation8-win32.php on line %d File name is => %s\t%s File permissions are => 100666 File created in => temp dir -- Iteration 7 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation8-win32.php on line %d File name is => %s\t%s File permissions are => 100666 File created in => temp dir @@ -140,6 +144,8 @@ File permissions are => 100666 File created in => directory specified -- Iteration 11 -- + +Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation8-win32.php on line %d File name is => %s\t%s File permissions are => 100666 File created in => temp dir diff --git a/ext/standard/tests/general_functions/bug71891.phpt b/ext/standard/tests/general_functions/bug71891.phpt new file mode 100644 index 0000000000..b1f7e200d8 --- /dev/null +++ b/ext/standard/tests/general_functions/bug71891.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #71891 (header_register_callback() and register_shutdown_function()) +--FILE-- +<?php + +header_register_callback(function () { + echo 'header'; + register_shutdown_function(function () { + echo 'shutdown'; + }); +}); +?> +--EXPECT-- +header diff --git a/ext/standard/tests/general_functions/bug72300.phpt b/ext/standard/tests/general_functions/bug72300.phpt new file mode 100644 index 0000000000..94d1f20f8a --- /dev/null +++ b/ext/standard/tests/general_functions/bug72300.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #72300 (ignore_user_abort(false) has no effect) +--INI-- +ignore_user_abort=0 +--FILE-- +<?php + +var_dump(ignore_user_abort(true)); +var_dump(ignore_user_abort()); +var_dump(ini_get("ignore_user_abort")); +var_dump(ignore_user_abort(false)); +var_dump(ignore_user_abort()); +var_dump(ini_get("ignore_user_abort")); + +?> +--EXPECT-- +int(0) +int(1) +string(1) "1" +int(1) +int(0) +string(1) "0" diff --git a/ext/standard/tests/general_functions/bug72306.phpt b/ext/standard/tests/general_functions/bug72306.phpt new file mode 100644 index 0000000000..05c25e6f1e --- /dev/null +++ b/ext/standard/tests/general_functions/bug72306.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #72306 (Heap overflow through proc_open and $env parameter) +--FILE-- +<?php +class moo { + function __construct() { $this->a = 0; } + function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; } +} + +$env = array('some_option' => new moo()); +$pipes = array(); +$description = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "r") +); + +$process = proc_open('nothing', $description, $pipes, NULL, $env); + +?> +okey +--EXPECT-- +okey diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index 9b7a3281e4..d7bdffd6ae 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -155,6 +155,10 @@ float(5000000) float(-5000000) *** Testing floatval() on non floating types *** + +Notice: A non well formed numeric value encountered in %s on line 69 + +Notice: A non well formed numeric value encountered in %s on line 70 float(-2147483648) float(2147483648) float(%d) diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt index 83925b89b0..aa808cfba1 100644 --- a/ext/standard/tests/general_functions/floatval_variation1.phpt +++ b/ext/standard/tests/general_functions/floatval_variation1.phpt @@ -52,6 +52,11 @@ foreach ($not_float_types as $key => $type ) { ?> ===DONE=== --EXPECTF-- + +Notice: A non well formed numeric value encountered in %s on line %d + +Notice: A non well formed numeric value encountered in %s on line %d + *** Testing floatval() on non floating types *** -- Iteration : -2147483648 -- @@ -151,4 +156,4 @@ float(0) -- Iteration : null -- float(0) -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt index 2242952769..18b05b6a97 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt @@ -282,7 +282,7 @@ string(7) "integer" -- Iteration 18 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 19 -- string(6) "string" @@ -297,7 +297,7 @@ string(7) "integer" -- Iteration 21 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 22 -- string(6) "string" @@ -312,7 +312,7 @@ string(7) "integer" -- Iteration 24 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 25 -- string(6) "string" @@ -327,7 +327,7 @@ string(7) "integer" -- Iteration 27 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 28 -- string(6) "string" @@ -687,7 +687,7 @@ string(7) "integer" -- Iteration 18 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 19 -- string(6) "string" @@ -702,7 +702,7 @@ string(7) "integer" -- Iteration 21 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 22 -- string(6) "string" @@ -717,7 +717,7 @@ string(7) "integer" -- Iteration 24 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 25 -- string(6) "string" @@ -732,7 +732,7 @@ string(7) "integer" -- Iteration 27 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 28 -- string(6) "string" diff --git a/ext/standard/tests/http/http_response_header_01.phpt b/ext/standard/tests/http/http_response_header_01.phpt new file mode 100644 index 0000000000..2facf4fae5 --- /dev/null +++ b/ext/standard/tests/http/http_response_header_01.phpt @@ -0,0 +1,38 @@ +--TEST-- +$http_reponse_header (no redirect) +--SKIPIF-- +<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:22346'); ?> +--INI-- +allow_url_fopen=1 +allow_url_include=1 +--FILE-- +<?php +require 'server.inc'; + +$responses = array( + "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\nSome: Header\r\n\r\nBody", +); + +$pid = http_server("tcp://127.0.0.1:22346", $responses, $output); + +function test() { + $f = file_get_contents('http://127.0.0.1:22346/'); + var_dump($f); + var_dump($http_response_header); +} +test(); + +http_server_kill($pid); +?> +==DONE== +--EXPECT-- +string(4) "Body" +array(3) { + [0]=> + string(15) "HTTP/1.0 200 Ok" + [1]=> + string(12) "Some: Header" + [2]=> + string(12) "Some: Header" +} +==DONE== diff --git a/ext/standard/tests/http/http_response_header_02.phpt b/ext/standard/tests/http/http_response_header_02.phpt new file mode 100644 index 0000000000..0d4da1af14 --- /dev/null +++ b/ext/standard/tests/http/http_response_header_02.phpt @@ -0,0 +1,44 @@ +--TEST-- +$http_reponse_header (redirect) +--SKIPIF-- +<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:22347'); ?> +--INI-- +allow_url_fopen=1 +allow_url_include=1 +--FILE-- +<?php +require 'server.inc'; + +$responses = array( + "data://text/plain,HTTP/1.0 302 Found\r\n" + . "Some: Header\r\nLocation: http://127.0.0.1:22347/try-again\r\n\r\n", + "data://test/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\n\r\nBody", +); + +$pid = http_server("tcp://127.0.0.1:22347", $responses, $output); + +function test() { + $f = file_get_contents('http://127.0.0.1:22347/'); + var_dump($f); + var_dump($http_response_header); +} +test(); + +http_server_kill($pid); +?> +==DONE== +--EXPECT-- +string(4) "Body" +array(5) { + [0]=> + string(18) "HTTP/1.0 302 Found" + [1]=> + string(12) "Some: Header" + [2]=> + string(42) "Location: http://127.0.0.1:22347/try-again" + [3]=> + string(15) "HTTP/1.0 200 Ok" + [4]=> + string(12) "Some: Header" +} +==DONE== diff --git a/ext/standard/tests/http/http_response_header_03.phpt b/ext/standard/tests/http/http_response_header_03.phpt new file mode 100644 index 0000000000..866a9b3ba5 --- /dev/null +++ b/ext/standard/tests/http/http_response_header_03.phpt @@ -0,0 +1,45 @@ +--TEST-- +$http_reponse_header (redirect + not found) +--SKIPIF-- +<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:22348'); ?> +--INI-- +allow_url_fopen=1 +allow_url_include=1 +--FILE-- +<?php +require 'server.inc'; + +$responses = array( + "data://text/plain,HTTP/1.0 302 Found\r\n" + . "Some: Header\r\nLocation: http://127.0.0.1:22348/try-again\r\n\r\n", + "data://test/plain,HTTP/1.0 404 Not Found\r\nSome: Header\r\n\r\nBody", +); + +$pid = http_server("tcp://127.0.0.1:22348", $responses, $output); + +function test() { + $f = file_get_contents('http://127.0.0.1:22348/'); + var_dump($f); + var_dump($http_response_header); +} +test(); + +http_server_kill($pid); +?> +==DONE== +--EXPECTF-- +Warning: file_get_contents(http://127.0.0.1:22348/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%a +bool(false) +array(5) { + [0]=> + string(18) "HTTP/1.0 302 Found" + [1]=> + string(12) "Some: Header" + [2]=> + string(42) "Location: http://127.0.0.1:22348/try-again" + [3]=> + string(22) "HTTP/1.0 404 Not Found" + [4]=> + string(12) "Some: Header" +} +==DONE== diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt index b4389956f4..572a04245e 100644 --- a/ext/standard/tests/math/decbin_basic.phpt +++ b/ext/standard/tests/math/decbin_basic.phpt @@ -31,7 +31,7 @@ string(2) "11" string(7) "1011111" string(4) "1010" string(12) "111101101110" -string(2) "11" +string(12) "111101101110" string(6) "100111" string(1) "0" string(1) "1" diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt index 2423d8e748..ac53a97b34 100644 --- a/ext/standard/tests/math/dechex_basic.phpt +++ b/ext/standard/tests/math/dechex_basic.phpt @@ -30,7 +30,7 @@ string(1) "3" string(2) "5f" string(1) "a" string(3) "f6e" -string(1) "3" +string(3) "f6e" string(2) "27" string(1) "0" string(1) "1" diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt index cc1f0a899a..3a5011b973 100644 --- a/ext/standard/tests/math/decoct_basic.phpt +++ b/ext/standard/tests/math/decoct_basic.phpt @@ -30,7 +30,7 @@ string(1) "3" string(3) "137" string(2) "12" string(4) "7556" -string(1) "3" +string(4) "7556" string(2) "47" string(1) "0" string(1) "1" diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt index 5576e5b493..c744c4eb9d 100644 --- a/ext/standard/tests/math/pow_variation1.phpt +++ b/ext/standard/tests/math/pow_variation1.phpt @@ -143,21 +143,31 @@ int(1) int(0) -- Iteration 17 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 18 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 19 -- int(0) -- Iteration 20 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 21 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 22 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 23 -- diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt index e1986ba858..ea2ae45d18 100644 --- a/ext/standard/tests/math/pow_variation1_64bit.phpt +++ b/ext/standard/tests/math/pow_variation1_64bit.phpt @@ -143,21 +143,31 @@ int(1) int(0) -- Iteration 17 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 18 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 19 -- int(0) -- Iteration 20 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 21 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 22 -- + +Warning: A non-numeric value encountered in %s on line %d int(0) -- Iteration 23 -- diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt index f571936727..36b085b647 100644 --- a/ext/standard/tests/math/pow_variation2.phpt +++ b/ext/standard/tests/math/pow_variation2.phpt @@ -139,21 +139,31 @@ float(20.3) float(1) -- Iteration 17 -- + +Warning: A non-numeric value encountered in %s on line %d float(1) -- Iteration 18 -- + +Warning: A non-numeric value encountered in %s on line %d float(1) -- Iteration 19 -- int(1) -- Iteration 20 -- + +Warning: A non-numeric value encountered in %s on line %d float(1) -- Iteration 21 -- + +Warning: A non-numeric value encountered in %s on line %d float(1) -- Iteration 22 -- + +Warning: A non-numeric value encountered in %s on line %d float(1) -- Iteration 23 -- diff --git a/ext/standard/tests/serialize/bug71840.phpt b/ext/standard/tests/serialize/bug71840.phpt new file mode 100644 index 0000000000..6cbf04bfb4 --- /dev/null +++ b/ext/standard/tests/serialize/bug71840.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #71840 (Unserialize accepts wrongly data) +--FILE-- +<?php +var_dump(unserialize('a:1:{s:0:""0a:0:{}}')); +?> +--EXPECTF-- +Notice: unserialize(): Error at offset 11 of 19 bytes in %sbug71840.php on line %d +bool(false) diff --git a/ext/standard/tests/serialize/bug71940.phpt b/ext/standard/tests/serialize/bug71940.phpt new file mode 100644 index 0000000000..c391ba6603 --- /dev/null +++ b/ext/standard/tests/serialize/bug71940.phpt @@ -0,0 +1,67 @@ +--TEST-- +Bug #71940 (Unserialize crushes on restore object reference) +--FILE-- +<?php + +class Identity +{ + private $role; + + public function __construct($role) + { + $this->role = $role; + } +} + +class Entry implements \Serializable +{ + private $identity; + + public function __construct(Identity $identity) + { + $this->identity = $identity; + } + + public function serialize() + { + return serialize(array($this->identity)); + } + + public function unserialize($serialized) + { + list($this->identity) = unserialize($serialized); + } +} + +$identity = new Identity('test'); +$identityRef = &$identity; + +$entry1 = new Entry($identity); +$entry2 = new Entry($identityRef); + +$serialized = serialize([$entry1, $entry2]); +print_r(unserialize($serialized)); + +?> +--EXPECTF-- +Array +( + [0] => Entry Object + ( + [identity:Entry:private] => Identity Object + ( + [role:Identity:private] => test + ) + + ) + + [1] => Entry Object + ( + [identity:Entry:private] => Identity Object + ( + [role:Identity:private] => test + ) + + ) + +) diff --git a/ext/standard/tests/serialize/bug71995.phpt b/ext/standard/tests/serialize/bug71995.phpt new file mode 100644 index 0000000000..0f7ac98722 --- /dev/null +++ b/ext/standard/tests/serialize/bug71995.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #71995 (Returning the same var twice from __sleep() produces broken serialized data) +--FILE-- +<?php + +class A { + public $b; + public function __construct() { + $this->b = new StdClass(); + } + public function __sleep() { + return array("b", "b"); + } +} +$a = new A(); +$s = serialize($a); +var_dump($s); +var_dump(unserialize($s)); +?> +--EXPECTF-- +Notice: serialize(): "b" is returned from __sleep multiple times in %sbug71995.php on line %d +string(39) "O:1:"A":1:{s:1:"b";O:8:"stdClass":0:{}}" +object(A)#%d (1) { + ["b"]=> + object(stdClass)#%d (0) { + } +} diff --git a/ext/standard/tests/serialize/bug72229.phpt b/ext/standard/tests/serialize/bug72229.phpt new file mode 100644 index 0000000000..17c393c7d4 --- /dev/null +++ b/ext/standard/tests/serialize/bug72229.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #72229 (Wrong reference when serialize/unserialize an object) +--FILE-- +<?php +class C1 +{ + public $arr1 = array(); + public $arr2 = array(); + public function __construct() + { + $this->arr1[0] = $this; + $this->arr2[0] = $this->arr1[0]; + $var1 = &$this->arr1[0]; // Set a reference... + unset($var1); // ... and unset it. + } +} +$Obj1 = new C1(); +$txt1 = serialize($Obj1); +$Obj2 = unserialize($txt1); +$Obj1->arr2[0] = 50; +print_r($Obj1); +$Obj2->arr2[0] = 50; +print_r($Obj2); +?> +--EXPECTF-- +C1 Object +( + [arr1] => Array + ( + [0] => C1 Object + *RECURSION* + ) + + [arr2] => Array + ( + [0] => 50 + ) + +) +C1 Object +( + [arr1] => Array + ( + [0] => C1 Object + *RECURSION* + ) + + [arr2] => Array + ( + [0] => 50 + ) + +) diff --git a/ext/standard/tests/streams/bug60602.phpt b/ext/standard/tests/streams/bug60602.phpt index 2c08ce87b7..f0a3cf83e8 100644 --- a/ext/standard/tests/streams/bug60602.phpt +++ b/ext/standard/tests/streams/bug60602.phpt @@ -49,8 +49,6 @@ if (is_resource($p)) { ==DONE== --EXPECTF-- Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d int(%d) int(0) bool(true) diff --git a/ext/standard/tests/streams/bug71884.phpt b/ext/standard/tests/streams/bug71884.phpt new file mode 100644 index 0000000000..798c6b6431 --- /dev/null +++ b/ext/standard/tests/streams/bug71884.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #71884 (Null pointer deref (segfault) in stream_context_get_default) +--FILE-- +<?php +$arr=array(); +$arr[0]['A']=0; +stream_context_get_default($arr); +?> +--EXPECTF-- +Warning: stream_context_get_default(): options should have the form ["wrappername"]["optionname"] = $value in %sbug71884.php on line %d diff --git a/ext/standard/tests/streams/bug72075.phpt b/ext/standard/tests/streams/bug72075.phpt new file mode 100644 index 0000000000..93dce60350 --- /dev/null +++ b/ext/standard/tests/streams/bug72075.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #72075 (Referencing socket resources breaks stream_select) +--FILE-- +<?php +$r = [stream_socket_server("tcp://127.0.0.1:0", $errno, $errStr)]; +$w = NULL; +$e = NULL; + +// Without this line, all is well: +$dummy =& $r[0]; + +print stream_select($r, $w, $e, 0.5); + +--EXPECT-- +0 diff --git a/ext/standard/tests/streams/bug72221.phpt b/ext/standard/tests/streams/bug72221.phpt new file mode 100644 index 0000000000..8f30099cab --- /dev/null +++ b/ext/standard/tests/streams/bug72221.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #72221 (Segmentation fault in stream_get_line / zend_memnstr_ex) +--FILE-- +<?php +$fp = fopen("php://memory", "r+"); +fwrite($fp, str_repeat("baad", 1024*1024)); +rewind($fp); +stream_get_line($fp, 1024*1024*2, "aaaa"); +echo "Done\n"; +--EXPECT-- +Done diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt new file mode 100644 index 0000000000..ca3289fbc2 --- /dev/null +++ b/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt @@ -0,0 +1,22 @@ +--TEST-- +stream context tcp_nodelay +--SKIPIF-- +<?php if (!extension_loaded("sockets")) die("skip: need sockets") ?> +--FILE-- +<?php +$ctxt = stream_context_create([ + "socket" => [ + "tcp_nodelay" => true + ] +]); + +$stream = stream_socket_client( + "tcp://www.php.net:80", $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $ctxt); + +$socket = + socket_import_stream($stream); + +var_dump(socket_get_option($socket, SOL_TCP, TCP_NODELAY) > 0); +?> +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt new file mode 100644 index 0000000000..08ad4c2d2e --- /dev/null +++ b/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt @@ -0,0 +1,21 @@ +--TEST-- +stream context tcp_nodelay fopen +--SKIPIF-- +<?php if (!extension_loaded("sockets")) die("skip: need sockets") ?> +--FILE-- +<?php +$ctxt = stream_context_create([ + "socket" => [ + "tcp_nodelay" => true + ] +]); + +$stream = fopen("http://www.php.net", "r", false, $ctxt); + +$socket = + @socket_import_stream($stream); + +var_dump(socket_get_option($socket, STREAM_IPPROTO_TCP, TCP_NODELAY) > 0); +?> +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt new file mode 100644 index 0000000000..6606a15052 --- /dev/null +++ b/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt @@ -0,0 +1,47 @@ +--TEST-- +stream context tcp_nodelay server +--SKIPIF-- +<?php if (!extension_loaded("sockets")) die("skip: need sockets") ?> +--FILE-- +<?php +$serverCode = <<<'CODE' + $ctxt = stream_context_create([ + "socket" => [ + "tcp_nodelay" => true + ] + ]); + + $server = stream_socket_server( + "tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt); + + $client = stream_socket_accept($server); + + var_dump(socket_get_option( + socket_import_stream($server), + SOL_TCP, TCP_NODELAY) > 0); + + var_dump(socket_get_option( + socket_import_stream($client), + SOL_TCP, TCP_NODELAY) > 0); + + fclose($client); + fclose($server); +CODE; + +$clientCode = <<<'CODE' + $test = stream_socket_client( + "tcp://127.0.0.1:9099", $errno, $errstr, 10); + + sleep(1); + + fclose($test); +CODE; + +include sprintf( + "%s/../../../openssl/tests/ServerClientTestCase.inc", + dirname(__FILE__)); +ServerClientTestCase::getInstance()->run($serverCode, $clientCode); +?> +--EXPECT-- +bool(false) +bool(true) diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt index 6cfe47056b..84e4337463 100644 --- a/ext/standard/tests/strings/bug40754.phpt +++ b/ext/standard/tests/strings/bug40754.phpt @@ -32,7 +32,7 @@ var_dump(substr("abcde", $v, $v)); bool(false) bool(false) -Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d +Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d @@ -41,10 +41,10 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d +Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) -Warning: substr_count(): Length value 2147483647 exceeds string length in %s on line %d +Warning: substr_count(): Invalid length value in %s on line %d bool(false) Warning: strpos(): Offset not contained in string in %s on line %d diff --git a/ext/standard/tests/strings/bug55871.phpt b/ext/standard/tests/strings/bug55871.phpt index 249d1bd3a3..0044f50ce7 100644 --- a/ext/standard/tests/strings/bug55871.phpt +++ b/ext/standard/tests/strings/bug55871.phpt @@ -41,6 +41,8 @@ array(1) { [0]=> string(0) "" } + +Warning: A non-numeric value encountered in %s on line %d array(1) { [0]=> string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" diff --git a/ext/standard/tests/strings/bug71806.dat b/ext/standard/tests/strings/bug71806.dat new file mode 100644 index 0000000000..c999da61c2 --- /dev/null +++ b/ext/standard/tests/strings/bug71806.dat @@ -0,0 +1,3 @@ +<?php +/* comment */ +echo 098 ; diff --git a/ext/standard/tests/strings/bug71806.phpt b/ext/standard/tests/strings/bug71806.phpt new file mode 100644 index 0000000000..6eb534d0a0 --- /dev/null +++ b/ext/standard/tests/strings/bug71806.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #71806 (php_strip_whitespace() fails on some numerical values) +--FILE-- +<?php + +echo php_strip_whitespace(__DIR__ . '/bug71806.dat'); + +?> +--EXPECT-- +<?php + echo 098 ; diff --git a/ext/standard/tests/strings/bug71969.phpt b/ext/standard/tests/strings/bug71969.phpt new file mode 100644 index 0000000000..aafceb09ad --- /dev/null +++ b/ext/standard/tests/strings/bug71969.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #71969 (str_replace returns an incorrect resulting array after a foreach by reference) +--FILE-- +<?php +$a = array( + array("one" => array("a"=>"0000", "b"=>"1111")), +); + +//foreach by reference, changing the array value +foreach($a as &$record) +{ + $record["one"]["a"] = "2222"; +} +var_dump(str_replace("2", "3", $a)); +?> +--EXPECT-- +array(1) { + [0]=> + array(1) { + ["one"]=> + array(2) { + ["a"]=> + string(4) "2222" + ["b"]=> + string(4) "1111" + } + } +} diff --git a/ext/standard/tests/strings/bug72100.phpt b/ext/standard/tests/strings/bug72100.phpt new file mode 100644 index 0000000000..7fcc0831b6 --- /dev/null +++ b/ext/standard/tests/strings/bug72100.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test implode() function, problems with big numbers +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php +var_dump( implode(" ", ["hello long", 999999999999999999, PHP_INT_MAX])); +var_dump( implode(" ", ["hello negative long", -999999999999999999, PHP_INT_MIN] ) ); +var_dump( implode(" ", ["hello small long", -101, -100, -99, -90, -11, -10, -9, -1, 0, 1, 2, 9, 10, 11, 90, 99, 100, 101] ) ); +echo "Done\n"; +?> +--EXPECT-- +string(49) "hello long 999999999999999999 9223372036854775807" +string(60) "hello negative long -999999999999999999 -9223372036854775808" +string(76) "hello small long -101 -100 -99 -90 -11 -10 -9 -1 0 1 2 9 10 11 90 99 100 101" +Done diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt index d050ae80e8..f1f47b932c 100644 --- a/ext/standard/tests/strings/str_pad_variation5.phpt +++ b/ext/standard/tests/strings/str_pad_variation5.phpt @@ -31,4 +31,4 @@ var_dump( str_pad($input, $pad_length) ); --EXPECTF-- *** Testing str_pad() function: with large value for for 'pad_length' argument *** -Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate 2147483648 bytes) in %s on line %d +Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/ext/standard/tests/strings/stripos_basic2.phpt b/ext/standard/tests/strings/stripos_basic2.phpt index 3022bae168..226d3f61d2 100644 --- a/ext/standard/tests/strings/stripos_basic2.phpt +++ b/ext/standard/tests/strings/stripos_basic2.phpt @@ -18,6 +18,9 @@ var_dump( stripos("Hello, World", "Hello", 0) ); var_dump( stripos("Hello, World", 'Hello', 1) ); var_dump( stripos('Hello, World', 'WORLD', 1) ); var_dump( stripos('Hello, World', "WoRld", 5) ); +var_dump( stripos('Hello, World', "WoRld", -6) ); +var_dump( stripos('Hello, World', "WoRld", -3) ); +var_dump( stripos('Hello, World', "WoRld", -12) ); //heredoc string for haystack & needle, with various offsets var_dump( stripos($heredoc_str, "Hello, World", 0) ); @@ -25,12 +28,19 @@ var_dump( stripos($heredoc_str, 'Hello', 0) ); var_dump( stripos($heredoc_str, 'Hello', 1) ); var_dump( stripos($heredoc_str, $heredoc_str, 0) ); var_dump( stripos($heredoc_str, $heredoc_str, 1) ); +var_dump( stripos($heredoc_str, $heredoc_str, -strlen($heredoc_str)) ); +var_dump( stripos($heredoc_str, $heredoc_str, -strlen($heredoc_str)+1) ); //various offsets var_dump( stripos("Hello, World", "o", 3) ); var_dump( stripos("Hello, World", "O", 5) ); var_dump( stripos("Hello, World", "o", 6) ); var_dump( stripos("Hello, World", "o", 10) ); +var_dump( stripos("Hello, World", "o", -7) ); +var_dump( stripos("Hello, World", "o", -8) ); +var_dump( stripos("Hello, World", "o", -10) ); +var_dump( stripos("Hello, World", "o", -4) ); +var_dump( stripos("Hello, World", "o", -3) ); echo "*** Done ***"; ?> --EXPECTF-- @@ -40,13 +50,23 @@ int(0) bool(false) int(7) int(7) +int(7) +bool(false) +int(7) int(0) int(0) bool(false) int(0) bool(false) +int(0) +bool(false) int(4) int(8) int(8) bool(false) +int(8) +int(4) +int(4) +int(8) +bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt index ef6ad9e6ec..c59473046d 100644 --- a/ext/standard/tests/strings/stripos_error.phpt +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -16,6 +16,13 @@ var_dump( stripos("String") ); echo "\n-- With more than expected number of arguments --"; var_dump( stripos("string", "String", 1, 'extra_arg') ); + +echo "\n-- Offset beyond the end of the string --"; +var_dump( stripos("Hello World", "o", 12) ); + +echo "\n-- Offset before the start of the string --"; +var_dump( stripos("Hello World", "o", -12) ); + echo "*** Done ***"; ?> --EXPECTF-- @@ -32,4 +39,12 @@ NULL -- With more than expected number of arguments -- Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d NULL + +-- Offset beyond the end of the string -- +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) + +-- Offset before the start of the string -- +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation14.phpt b/ext/standard/tests/strings/stripos_variation14.phpt index aabf0e62ea..3339e2f27e 100644 --- a/ext/standard/tests/strings/stripos_variation14.phpt +++ b/ext/standard/tests/strings/stripos_variation14.phpt @@ -1,7 +1,5 @@ --TEST-- Test stripos() function : usage variations - unexpected inputs for 'offset' argument ---SKIPIF-- -<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); --FILE-- <?php /* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); @@ -37,7 +35,7 @@ $offsets = array ( // float values 1.5, -1.5, - 1.5e10, + 1.5e6, 1.6E-10, .5, @@ -91,8 +89,6 @@ echo "*** Done ***"; -- Iteration 1 -- int(6) -- Iteration 2 -- - -Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 3 -- diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex 36854d1b37..f5d60a69b5 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt index f880e9481e..c7c96fd55b 100644 --- a/ext/standard/tests/strings/substr_count_basic.phpt +++ b/ext/standard/tests/strings/substr_count_basic.phpt @@ -9,12 +9,17 @@ var_dump(@substr_count("a", "")); var_dump(@substr_count("", "a")); var_dump(@substr_count("", "a")); var_dump(@substr_count("", chr(0))); + $a = str_repeat("abcacba", 100); var_dump(@substr_count($a, "bca")); + $a = str_repeat("abcacbabca", 100); var_dump(@substr_count($a, "bca")); var_dump(substr_count($a, "bca", 200)); var_dump(substr_count($a, "bca", 200, 50)); +var_dump(substr_count($a, "bca", -200)); +var_dump(substr_count($a, "bca", -200, 50)); +var_dump(substr_count($a, "bca", -200, -50)); echo "Done\n"; @@ -30,4 +35,7 @@ int(100) int(200) int(160) int(10) +int(40) +int(10) +int(30) Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt index f6924217b9..881da391e6 100644 --- a/ext/standard/tests/strings/substr_count_error.phpt +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -4,27 +4,31 @@ Test substr_count() function (error conditions) <?php echo "\n*** Testing error conditions ***\n"; +$str = 'abcdefghik'; + /* Zero argument */ var_dump( substr_count() ); /* more than expected no. of args */ var_dump( substr_count($str, "t", 0, 15, 30) ); -/* offset as negative value */ -var_dump(substr_count($str, "t", -5)); +/* offset before start */ +var_dump(substr_count($str, "t", -20)); /* offset > size of the string */ var_dump(substr_count($str, "t", 25)); /* Using offset and length to go beyond the size of the string: Warning message expected, as length+offset > length of string */ -var_dump( substr_count($str, "i", 5, 15) ); +var_dump( substr_count($str, "i", 5, 7) ); -/* length as Null */ -var_dump( substr_count($str, "t", "", "") ); -var_dump( substr_count($str, "i", NULL, NULL) ); - -echo "Done\n"; +/* Invalid offset argument */ +var_dump( substr_count($str, "t", "") ); + +/* length too small */ +var_dump( substr_count($str, "t", 2, -20) ); + +echo "Done\n"; ?> --EXPECTF-- @@ -33,33 +37,21 @@ echo "Done\n"; Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d NULL -Notice: Undefined variable: str in %s on line %d - Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d NULL -Notice: Undefined variable: str in %s on line %d - -Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d +Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) -Notice: Undefined variable: str in %s on line %d - -Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d +Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) -Notice: Undefined variable: str in %s on line %d - -Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d +Warning: substr_count(): Invalid length value in %s on line %d bool(false) -Notice: Undefined variable: str in %s on line %d - Warning: substr_count() expects parameter 3 to be integer, string given in %s on line %d NULL -Notice: Undefined variable: str in %s on line %d - -Warning: substr_count(): Length should be greater than 0 in %s on line %d +Warning: substr_count(): Invalid length value in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index fd314cbd9d..0a15035af2 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -52,19 +52,19 @@ NULL -- Testing substr_replace() function with start and length different types -- -Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d string(12) "Good morning" -Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d string(12) "Good morning" -- Testing substr_replace() function with start and length with a different number of elements -- -Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d +Warning: substr_replace(): 'start' and 'length' should have the same number of elements in %s on line %d string(12) "Good morning" -- Testing substr_replace() function with start and length as arrays but string not-- -Warning: substr_replace(): Functionality of 'from' and 'len' as arrays is not implemented in %s on line %d +Warning: substr_replace(): Functionality of 'start' and 'length' as arrays is not implemented in %s on line %d string(12) "Good morning" -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt index 1ef97ccbaf..3a4f334c3b 100644 --- a/ext/standard/tests/strings/unpack_error.phpt +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -15,7 +15,7 @@ var_dump( unpack() ); echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; $extra_arg = 10; -var_dump(unpack("I", pack("I", 65534), $extra_arg)); +var_dump(unpack("I", pack("I", 65534), 0, $extra_arg)); echo "\n-- Testing unpack() function with invalid format character --\n"; $extra_arg = 10; @@ -27,12 +27,12 @@ var_dump(unpack("G", pack("I", 65534))); -- Testing unpack() function with no arguments -- -Warning: unpack() expects exactly 2 parameters, 0 given in %s on line %d +Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d NULL -- Testing unpack() function with more than expected no. of arguments -- -Warning: unpack() expects exactly 2 parameters, 3 given in %s on line %d +Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d NULL -- Testing unpack() function with invalid format character -- diff --git a/ext/standard/tests/strings/unpack_offset.phpt b/ext/standard/tests/strings/unpack_offset.phpt new file mode 100644 index 0000000000..c8c08e74f2 --- /dev/null +++ b/ext/standard/tests/strings/unpack_offset.phpt @@ -0,0 +1,17 @@ +--TEST-- +unpack() with offset +--FILE-- +<?php +$data = "pad" . pack("ll", 0x01020304, 0x05060708); + +$a = unpack("l2", $data, 3); +printf("0x%08x 0x%08x\n", $a[1], $a[2]); + +printf("0x%08x 0x%08x\n", + unpack("l", $data, 3)[1], + unpack("@4/l", $data, 3)[1]); +?> +--EXPECT-- +0x01020304 0x05060708 +0x01020304 0x05060708 + |
