diff options
Diffstat (limited to 'ext/standard/tests/file')
23 files changed, 121 insertions, 21 deletions
diff --git a/ext/standard/tests/file/bug20424.phpt b/ext/standard/tests/file/bug20424.phpt index df10d4abd..b8f9dfd8f 100644 --- a/ext/standard/tests/file/bug20424.phpt +++ b/ext/standard/tests/file/bug20424.phpt @@ -2,7 +2,7 @@ Bug #20424 (stream_get_meta_data crashes on a normal file stream) --FILE-- <?php -$f = fopen(dirname(__FILE__) . "/../../../../run-tests.php", "r"); +$f = fopen(__FILE__, "r"); $dummy = var_export(stream_get_meta_data($f), TRUE); echo "I'm alive!\n"; ?> diff --git a/ext/standard/tests/file/bug52624.phpt b/ext/standard/tests/file/bug52624.phpt new file mode 100644 index 000000000..ee61eb90e --- /dev/null +++ b/ext/standard/tests/file/bug52624.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #52624 (tempnam() by-pass open_basedir with inexistent directory) +--INI-- +open_basedir=. +--FILE-- +<?php + +echo tempnam("directory_that_not_exists", "prefix_"); + +?> +--EXPECTF-- +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/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt new file mode 100644 index 000000000..8915bb833 --- /dev/null +++ b/ext/standard/tests/file/bug60120.phpt @@ -0,0 +1,74 @@ +--TEST--
+Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 1024 * 16) . '!';
+$stdin = str_repeat('*', 2049 );
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+echo "OK.";
+?>
+--EXPECT--
+OK.
diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt index ced0da032..127901ad7 100644 --- a/ext/standard/tests/file/file_get_contents_error001.phpt +++ b/ext/standard/tests/file/file_get_contents_error001.phpt @@ -7,6 +7,7 @@ file_get_contents() test using offset parameter out of range display_errors=false --SKIPIF-- <?php + if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (!function_exists("file_get_contents")) die ("skip file_get_contents function is not found"); ?> diff --git a/ext/standard/tests/file/fread_socket_variation1.phpt b/ext/standard/tests/file/fread_socket_variation1.phpt index 50ee79bbf..a615d2f41 100644 --- a/ext/standard/tests/file/fread_socket_variation1.phpt +++ b/ext/standard/tests/file/fread_socket_variation1.phpt @@ -1,15 +1,11 @@ --TEST-- Testing fread() on a TCP server socket ---SKIPIF-- -<?php -if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); -?> --FILE-- <?php $tcp_socket = stream_socket_server('tcp://127.0.0.1:31337'); -socket_set_timeout($tcp_socket, 1); +socket_set_timeout($tcp_socket, 0, 1000); var_dump(fread($tcp_socket, 1)); diff --git a/ext/standard/tests/file/lstat_stat_basic.phpt b/ext/standard/tests/file/lstat_stat_basic.phpt index 362fcfe86..0d1476d68 100644 --- a/ext/standard/tests/file/lstat_stat_basic.phpt +++ b/ext/standard/tests/file/lstat_stat_basic.phpt @@ -2,6 +2,7 @@ Test lstat() & stat() functions: basic functionality --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. lstat() not available on Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation10.phpt b/ext/standard/tests/file/lstat_stat_variation10.phpt index a30b3c51f..51ebc25e7 100644 --- a/ext/standard/tests/file/lstat_stat_variation10.phpt +++ b/ext/standard/tests/file/lstat_stat_variation10.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of is_dir() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation11.phpt b/ext/standard/tests/file/lstat_stat_variation11.phpt index df1b8ac12..a75504b47 100644 --- a/ext/standard/tests/file/lstat_stat_variation11.phpt +++ b/ext/standard/tests/file/lstat_stat_variation11.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effect of is_file() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation12.phpt b/ext/standard/tests/file/lstat_stat_variation12.phpt index c1e37b543..8e1edd66c 100644 --- a/ext/standard/tests/file/lstat_stat_variation12.phpt +++ b/ext/standard/tests/file/lstat_stat_variation12.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of is_link() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. lstat() not available on Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation13.phpt b/ext/standard/tests/file/lstat_stat_variation13.phpt index 474ddc516..288e0b5ec 100644 --- a/ext/standard/tests/file/lstat_stat_variation13.phpt +++ b/ext/standard/tests/file/lstat_stat_variation13.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - file opened using w and r mode --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation15.phpt b/ext/standard/tests/file/lstat_stat_variation15.phpt index 45912ae58..8b67338ab 100644 --- a/ext/standard/tests/file/lstat_stat_variation15.phpt +++ b/ext/standard/tests/file/lstat_stat_variation15.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects changing permissions of link --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. lstat() not available on Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation16.phpt b/ext/standard/tests/file/lstat_stat_variation16.phpt index 641ccd58d..9f1276548 100644 --- a/ext/standard/tests/file/lstat_stat_variation16.phpt +++ b/ext/standard/tests/file/lstat_stat_variation16.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects changing permissions of file --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation17.phpt b/ext/standard/tests/file/lstat_stat_variation17.phpt index e50abf3f8..f2306de79 100644 --- a/ext/standard/tests/file/lstat_stat_variation17.phpt +++ b/ext/standard/tests/file/lstat_stat_variation17.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects changing permissions of dir --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation21.phpt b/ext/standard/tests/file/lstat_stat_variation21.phpt index 1009c92c5..8620ab00d 100644 --- a/ext/standard/tests/file/lstat_stat_variation21.phpt +++ b/ext/standard/tests/file/lstat_stat_variation21.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of truncate() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation4.phpt b/ext/standard/tests/file/lstat_stat_variation4.phpt index 7407a63bf..259beca00 100755 --- a/ext/standard/tests/file/lstat_stat_variation4.phpt +++ b/ext/standard/tests/file/lstat_stat_variation4.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of touch() on file --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation5.phpt b/ext/standard/tests/file/lstat_stat_variation5.phpt index 895e606b9..d0c096ef1 100755 --- a/ext/standard/tests/file/lstat_stat_variation5.phpt +++ b/ext/standard/tests/file/lstat_stat_variation5.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of touch() on dir --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation6.phpt b/ext/standard/tests/file/lstat_stat_variation6.phpt index b7913e0b3..7e557d034 100755 --- a/ext/standard/tests/file/lstat_stat_variation6.phpt +++ b/ext/standard/tests/file/lstat_stat_variation6.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of touch() on link --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (!(stristr(PHP_OS, 'linux'))) { die('skip.. test valid for linux only'); } @@ -47,7 +48,7 @@ clearstatcache(); var_dump( touch($link_name) ); -$new_stat = lstat($link_name); +$new_stat = stat($file_name); // compare self stats var_dump( compare_self_stat($old_stat) ); diff --git a/ext/standard/tests/file/lstat_stat_variation8.phpt b/ext/standard/tests/file/lstat_stat_variation8.phpt index 412c3bf03..b0f170d1f 100644 --- a/ext/standard/tests/file/lstat_stat_variation8.phpt +++ b/ext/standard/tests/file/lstat_stat_variation8.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - creating file/subdir --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/readlink_realpath_variation3.phpt b/ext/standard/tests/file/readlink_realpath_variation3.phpt index 70e8d0c94..3766a5b43 100644 --- a/ext/standard/tests/file/readlink_realpath_variation3.phpt +++ b/ext/standard/tests/file/readlink_realpath_variation3.phpt @@ -46,32 +46,32 @@ echo "Done\n"; *** Testing readlink() and realpath() with linkname as empty string, NULL and single space *** -- Iteration1 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) %s -- Iteration2 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) %s -- Iteration3 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" -- Iteration4 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" -- Iteration5 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" -- Iteration6 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" Done diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index 49dc6a540..1dae17cbd 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -50,28 +50,28 @@ unlink($file_path."/readlink_variation2.tmp"); --EXPECTF-- *** Testing Invalid file types *** -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d NULL -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt index 2cd9dbdd9..8e86d27a2 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt @@ -36,6 +36,9 @@ $names_arr = array( ); +/* disable notice so we don't get the array to string conversion notice for "$name" where $name = array() */ +error_reporting(E_ALL ^ E_NOTICE); + echo "*** Testing rename() with obscure files ***\n"; $file_path = dirname(__FILE__)."/renameVar13"; $aFile = $file_path.'/afile.tmp'; diff --git a/ext/standard/tests/file/rename_variation6-win32.phpt b/ext/standard/tests/file/rename_variation6-win32.phpt index 14d59d0ad..9aab0a7a8 100644 --- a/ext/standard/tests/file/rename_variation6-win32.phpt +++ b/ext/standard/tests/file/rename_variation6-win32.phpt @@ -33,7 +33,7 @@ var_dump(file_exists($tmp_file)); echo "Done\n"; ?> --EXPECTF-- -Warning: readlink(): Could not open file (error 2) in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%srename_variation6-win32.php.tmp" bool(true) diff --git a/ext/standard/tests/file/touch_basic.phpt b/ext/standard/tests/file/touch_basic.phpt index fb042df67..c41fdf1d7 100644 --- a/ext/standard/tests/file/touch_basic.phpt +++ b/ext/standard/tests/file/touch_basic.phpt @@ -4,6 +4,7 @@ Test touch() function : basic functionality Dave Kelsey <d_kelsey@uk.ibm.com> --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for Non Windows'); } |
