1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 11:42:17 +02:00

Fix Windows tests after #47037

This commit is contained in:
andy wharmby
2009-01-12 15:59:20 +00:00
parent 1ea392bb55
commit e2e013662d
4 changed files with 152 additions and 101 deletions

View File

@@ -65,6 +65,7 @@ for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
}
?>
===Done===
--EXPECTF--
*** Testing error conditions for fopen(), fclsoe() & feof() ***
@@ -74,7 +75,7 @@ bool(false)
Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
bool(false)
Warning: fclose(): 5 is not a valid stream resource in %s on line %d
Warning: fclose(): %d is not a valid stream resource in %s on line %d
bool(false)
Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d
@@ -83,7 +84,7 @@ bool(false)
Warning: Wrong parameter count for fclose() in %s on line %d
NULL
Warning: feof(): 5 is not a valid stream resource in %s on line %d
Warning: feof(): %d is not a valid stream resource in %s on line %d
bool(false)
Warning: feof(): supplied argument is not a valid stream resource in %s on line %d
@@ -181,3 +182,4 @@ bool(false)
Warning: feof(): supplied argument is not a valid stream resource in %s on line %d
bool(false)
===Done===

View File

@@ -16,64 +16,82 @@ if(substr(PHP_OS, 0, 3) != "WIN")
*/
echo "*** Testing file_get_contents() : variation ***\n";
/* An array of filenames */
$names_arr = array(
/* Invalid args */
-1,
TRUE,
FALSE,
NULL,
"",
" ",
"\0",
array(),
/* Invalid args */
"-1" => -1,
"TRUE" => TRUE,
"FALSE" => FALSE,
"NULL" => NULL,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
"array()" => array(),
/* prefix with path separator of a non existing directory*/
"/no/such/file/dir",
"php/php"
/* prefix with path separator of a non existing directory*/
"/no/such/file/dir" => "/no/such/file/dir",
"php/php"=> "php/php"
);
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
var_dump(file_get_contents($names_arr[$i]));
foreach($names_arr as $key =>$value) {
echo "\n-- Filename: $key --\n";
var_dump(file_get_contents($value));
}
echo "\n*** Done ***\n";
?>
===Done===
--EXPECTF--
*** Testing file_get_contents() : variation ***
-- Iteration 0 --
-- Filename: -1 --
Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 1 --
-- Filename: TRUE --
Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 2 --
-- Filename: FALSE --
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
bool(false)
-- Iteration 3 --
-- Filename: NULL --
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
bool(false)
-- Iteration 4 --
-- Filename: "" --
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
bool(false)
-- Iteration 5 --
-- Filename: " " --
Warning: file_get_contents( ): failed to open stream: Permission denied in %s on line %d
bool(false)
-- Iteration 6 --
-- Filename: \0 --
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
bool(false)
-- Iteration 7 --
-- Filename: array() --
Warning: file_get_contents() expects parameter 1 to be string, array given in %s on line %d
NULL
-- Iteration 8 --
-- Filename: /no/such/file/dir --
Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 9 --
-- Filename: php/php --
Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
bool(false)
*** Done ***
===Done===

View File

@@ -19,64 +19,80 @@ echo "*** Testing file_put_contents() : usage variation ***\n";
/* An array of filenames */
$names_arr = array(
-1,
TRUE,
FALSE,
NULL,
"",
" ",
"\0",
array(),
"-1" => -1,
"TRUE" => TRUE,
"FALSE" => FALSE,
"NULL" => NULL,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
"array()" => array(),
//the next 2 generate java messages so we don't replicate the php messages
"/no/such/file/dir",
"php/php"
/* prefix with path separator of a non existing directory*/
"/no/such/file/dir" => "/no/such/file/dir",
"php/php"=> "php/php"
);
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
$res = file_put_contents($names_arr[$i], "Some data");
if ($res !== false && $res != null) {
echo "$res bytes written to: $names_arr[$i]\n";
unlink($names_arr[$i]);
}
else {
echo "Failed to write data to: $names_arr[$i]\n";
}
}
foreach($names_arr as $key =>$value) {
echo "\n-- Filename: $key --\n";
$res = file_put_contents($value, "Some data");
if ($res !== false && $res != null) {
echo "$res bytes written to: $value\n";
unlink($value);
} else {
echo "Failed to write data to: $key\n";
}
};
echo "\n*** Done ***\n";
?>
===Done===
--EXPECTF--
*** Testing file_put_contents() : usage variation ***
-- Iteration 0 --
-- Filename: -1 --
9 bytes written to: -1
-- Iteration 1 --
-- Filename: TRUE --
9 bytes written to: 1
-- Iteration 2 --
Failed to write data to:
-- Iteration 3 --
Failed to write data to:
-- Iteration 4 --
Failed to write data to:
-- Iteration 5 --
-- Filename: FALSE --
Warning: file_put_contents(): Filename cannot be empty in %s on line %d
Failed to write data to: FALSE
-- Filename: NULL --
Warning: file_put_contents(): Filename cannot be empty in %s on line %d
Failed to write data to: NULL
-- Filename: "" --
Warning: file_put_contents(): Filename cannot be empty in %s on line %d
Failed to write data to: ""
-- Filename: " " --
Warning: file_put_contents( ): failed to open stream: Permission denied in %s on line %d
Failed to write data to:
-- Iteration 6 --
Failed to write data to:%s
-- Iteration 7 --
Failed to write data to: " "
-- Filename: \0 --
Warning: file_put_contents(): Filename cannot be empty in %s on line %d
Failed to write data to: \0
-- Filename: array() --
Warning: file_put_contents() expects parameter 1 to be string, array given in %s on line %d
Failed to write data to: Array
-- Iteration 8 --
Failed to write data to: array()
-- Filename: /no/such/file/dir --
Warning: file_put_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d
Failed to write data to: /no/such/file/dir
-- Iteration 9 --
-- Filename: php/php --
Warning: file_put_contents(php/php): failed to open stream: %s in %s on line %d
Failed to write data to: php/php
*** Done ***
===Done===

View File

@@ -17,56 +17,71 @@ if(substr(PHP_OS, 0, 3) != "WIN")
echo "*** Testing readfile() : variation ***\n";
/* An array of files */
$names_arr = array(
/* Invalid args */
-1,
TRUE,
FALSE,
NULL,
"",
" ",
"\0",
array(),
/* Invalid args */
"-1" => -1,
"TRUE" => TRUE,
"FALSE" => FALSE,
"NULL" => NULL,
"\"\"" => "",
"\" \"" => " ",
"\\0" => "\0",
"array()" => array(),
/* prefix with path separator of a non existing directory*/
"/no/such/file/dir",
"php/php"
"/no/such/file/dir" => "/no/such/file/dir",
"php/php"=> "php/php"
);
for( $i=0; $i<count($names_arr); $i++ ) {
$name = $names_arr[$i];
echo "-- testing '$name' --\n";
readfile($name);
}
foreach($names_arr as $key => $value) {
echo "\n-- Filename: $key --\n";
readfile($value);
};
echo "\n*** Done ***\n";
?>
===Done===
--EXPECTF--
*** Testing readfile() : variation ***
-- testing '-1' --
-- Filename: -1 --
Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d
-- testing '1' --
-- Filename: TRUE --
Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d
-- testing '' --
-- testing '' --
-- testing '' --
-- testing ' ' --
-- Filename: FALSE --
Warning: readfile(): Filename cannot be empty in %s on line %d
-- Filename: NULL --
Warning: readfile(): Filename cannot be empty in %s on line %d
-- Filename: "" --
Warning: readfile(): Filename cannot be empty in %s on line %d
-- Filename: " " --
Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
-- testing '%s' --
-- testing 'Array' --
-- Filename: \0 --
Warning: readfile(): Filename cannot be empty in %s on line %d
-- Filename: array() --
Warning: readfile() expects parameter 1 to be string, array given in %s on line %d
-- testing '/no/such/file/dir' --
-- Filename: /no/such/file/dir --
Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
-- testing 'php/php' --
-- Filename: php/php --
Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
*** Done ***
===Done===