diff options
author | Anatol Belski <ab@php.net> | 2016-06-20 09:32:19 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-06-20 12:45:39 +0200 |
commit | 3d3f11ede4cc7c83d64cc5edaae7c29ce9c6986f (patch) | |
tree | 0a569a11fc09514f52e08a887e82a4ad91ff2afd /ext/standard/tests | |
parent | 3abd9c34c1e7249db92014a82b4430393c53928c (diff) | |
download | php-git-3d3f11ede4cc7c83d64cc5edaae7c29ce9c6986f.tar.gz |
Fixed the UTF-8 and long path support in the streams on Windows.
Since long the default PHP charset is UTF-8, however the Windows part is
out of step with this important point. The current implementation in PHP
doesn't technically permit to handle UTF-8 filepath and several other
things. Till now, only the ANSI compatible APIs are being used. Here is more
about it
https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752%28v=vs.85%29.aspx
The patch fixes not only issues with multibyte filenames under
incompatible codepages, but indirectly also issues with some other multibyte
encodings like BIG5, Shift-JIS, etc. by providing a clean way to access
filenames in UTF-8. Below is a small list of issues from the bug tracker,
that are getting fixed:
https://bugs.php.net/63401
https://bugs.php.net/41199
https://bugs.php.net/50203
https://bugs.php.net/71509
https://bugs.php.net/64699
https://bugs.php.net/64506
https://bugs.php.net/30195
https://bugs.php.net/65358
https://bugs.php.net/61315
https://bugs.php.net/70943
https://bugs.php.net/70903
https://bugs.php.net/63593
https://bugs.php.net/54977
https://bugs.php.net/54028
https://bugs.php.net/43148
https://bugs.php.net/30730
https://bugs.php.net/33350
https://bugs.php.net/35300
https://bugs.php.net/46990
https://bugs.php.net/61309
https://bugs.php.net/69333
https://bugs.php.net/45517
https://bugs.php.net/70551
https://bugs.php.net/50197
https://bugs.php.net/72200
https://bugs.php.net/37672
Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow
and Github. Some of the bugs are pretty recent, some descend to early
2000th, but the user comments in there last even till today. Just for example,
bug #30195 was opened in 2004, the latest comment in there was made in 2014. It
is certain, that these bugs descend not only to pure PHP use cases, but get also
redirected from the popular PHP based projects. Given the modern systems (and
those supported by PHP) are always based on NTFS, there is no excuse to keep
these issues unresolved.
The internalization approach on Windows is in many ways different from
UNIX and Linux, while it supports and is based on Unicode. It depends on the
current system code page, APIs used and exact kind how the binary was compiled
The locale doesn't affect the way Unicode or ANSI API work. PHP in particular
is being compiled without _UNICODE defined and this is conditioned by the
way we handle strings. Here is more about it
https://msdn.microsoft.com/en-us/library/tsbaswba.aspx
However, with any system code page ANSI functions automatically convert
paths to UTF-16. Paths in some encodings incompatible with the
current system code page, won't work correctly with ANSI APIs. PHP
till now only uses the ANSI Windows APIs.
For example, on a system with the current code page 1252, the paths
in cp1252 are supported and transparently converted to UTF-16 by the
ANSI functions. Once one wants to handle a filepath encoded with cp932 on
that particular system, an ANSI or a POSIX compatible function used in
PHP will produce an erroneous result. When trying to convert that cp932 path
to UTF-8 and passing to the ANSI functions, an ANSI function would
likely interpret the UTF-8 string as some string in the current code page and
create a filepath that represents every single byte of the UTF-8 string.
These behaviors are not only broken but also disregard the documented
INI settings.
This patch solves the issies with the multibyte paths on Windows by
intelligently enforcing the usage of the Unicode aware APIs. For
functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments
will be converted to UTF-16 wide chars. For functions returning Unicode
aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is
converted back to char's depending on the current PHP charset settings,
either to the current ANSI codepage (this is the behavior prior to this patch)
or to UTF-8 (the default behavior).
In a particular case, users might have to explicitly set
internal_encoding or default_charset, if filenames in ANSI codepage are
necessary. Current tests show no regressions and witness that this will be an
exotic case, the current default UTF-8 encoding is compatible with any
supported system. The dependency libraries are long switching to Unicode APIs,
so some tests were also added for extensions not directly related to streams.
At large, the patch brings over 150 related tests into the core. Those target
and was run on various environments with European, Asian, etc. codepages.
General PHP frameworks was tested and showed no regressions.
The impact on the current C code base is low, the most places affected
are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c
and plain_wrapper.c. The actual implementation of the most of the wide
char supporting functionality is in win32/ioutil.* and win32/codepage.*,
several low level functionsare extended in place to avoid reimplementation for
now. No performance impact was sighted. As previously mentioned, the ANSI APIs
used prior the patch perform Unicode conversions internally. Using the
Unicode APIs directly while doing custom conversions just retains the status
quo. The ways to optimize it are open (fe. by implementing caching for the
strings converted to wide variants).
The long path implementation is user transparent. If a path exceeds the
length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN
is set to 2048 bytes.
Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas
and testing.
Thanks.
Diffstat (limited to 'ext/standard/tests')
171 files changed, 19010 insertions, 5 deletions
diff --git a/ext/standard/tests/dir/chdir_basic-win32-mb.phpt b/ext/standard/tests/dir/chdir_basic-win32-mb.phpt new file mode 100644 index 0000000000..db08d51f40 --- /dev/null +++ b/ext/standard/tests/dir/chdir_basic-win32-mb.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test chdir() function : basic functionality +--FILE-- +<?php +/* Prototype : bool chdir(string $directory) + * Description: Change the current directory + * Source code: ext/standard/dir.c + */ + +/* + * Test basic functionality of chdir() with absolute and relative paths + */ + +echo "*** Testing chdir() : basic functionality ***\n"; +$base_dir_path = dirname(__FILE__); + +$level_one_dir_name = "私はガラスを食べられますlevel_one"; +$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; + +$level_two_dir_name = "私はガラスを食べられますlevel_two"; +$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; + +// create directories +mkdir($level_one_dir_path); +mkdir($level_two_dir_path); + +echo "\n-- Testing chdir() with absolute path: --\n"; +chdir($base_dir_path); +var_dump(chdir($level_one_dir_path)); +var_dump(getcwd()); + +echo "\n-- Testing chdir() with relative paths: --\n"; +var_dump(chdir($level_two_dir_name)); +var_dump(getcwd()); +?> +===DONE=== +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +chdir($file_path); +rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); +rmdir("$file_path/私はガラスを食べられますlevel_one"); +?> +--EXPECTF-- +*** Testing chdir() : basic functionality *** + +-- Testing chdir() with absolute path: -- +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one" + +-- Testing chdir() with relative paths: -- +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two" +===DONE=== diff --git a/ext/standard/tests/dir/chdir_error2-win32-mb.phpt b/ext/standard/tests/dir/chdir_error2-win32-mb.phpt new file mode 100644 index 0000000000..a1f08939ed --- /dev/null +++ b/ext/standard/tests/dir/chdir_error2-win32-mb.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test chdir() function : error conditions - Non-existent directory +--FILE-- +<?php +/* Prototype : bool chdir(string $directory) + * Description: Change the current directory + * Source code: ext/standard/dir.c + */ + +/* + * Pass a directory that does not exist as $directory to chdir() to test behaviour + */ + +echo "*** Testing chdir() : error conditions ***\n"; + +$directory = __FILE__ . '/私はガラスを食べられますidonotexist'; + +var_dump(chdir($directory)); +?> +===DONE=== +--EXPECTF-- +*** Testing chdir() : error conditions *** + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation1-win32-mb.phpt b/ext/standard/tests/dir/chdir_variation1-win32-mb.phpt new file mode 100644 index 0000000000..04fbc0bc18 --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation1-win32-mb.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test chdir() function : usage variations - different data type as $directory arg +--FILE-- +<?php +/* Prototype : bool chdir(string $directory) + * Description: Change the current directory + * Source code: ext/standard/dir.c + */ + +/* + * Pass different data types as $directory argument to test behaviour + */ + +echo "*** Testing chdir() : usage variations ***\n"; + +// create the temporary directory +$file_path = dirname(__FILE__); +$dir_path = $file_path."/私はガラスを食べられますchdir_basic"; +@mkdir($dir_path); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA { + var $dir_path; + + function __construct($dir) { + $this->dir_path = $dir; + } + + public function __toString() { + return "$this->dir_path"; + } +} + +// heredoc string +$heredoc = <<<EOT +$dir_path +EOT; + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// unexpected values to be passed to $directory argument +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + array(), + + // string data +/*19*/ "$dir_path", + 'string', + $heredoc, + + // object data +/*22*/ new classA($dir_path), + + // undefined data +/*23*/ @$undefined_var, + + // unset data +/*24*/ @$unset_var, + + // resource variable +/*25*/ $fp +); + +// loop through each element of $inputs to check the behavior of chdir() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( chdir($input) ); + $iterator++; +}; + +fclose($fp); + +?> +===DONE=== +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$dir_path = $file_path."/私はガラスを食べられますchdir_basic"; + +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- Iteration 1 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: chdir() expects parameter 1 to be a valid path, array given in %s on line %d +bool(false) + +-- Iteration 19 -- +bool(true) + +-- Iteration 20 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 21 -- +bool(true) + +-- Iteration 22 -- +bool(true) + +-- Iteration 23 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: chdir(): %s (errno %d) in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: chdir() expects parameter 1 to be a valid path, resource given in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt b/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..ad1f6b665a --- /dev/null +++ b/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test chdir() function : usage variations - relative paths +--FILE-- +<?php +/* Prototype : bool chdir(string $directory) + * Description: Change the current directory + * Source code: ext/standard/dir.c + */ + +/* + * Test chdir() with variations of relative paths + */ + +echo "*** Testing chdir() : usage variations ***\n"; + +$base_dir_path = dirname(__FILE__); + +$level_one_dir_name = "私はガラスを食べられますlevel_one"; +$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; + +$level_two_dir_name = "私はガラスを食べられますlevel_two"; +$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; + +// create directories +mkdir($level_one_dir_path); +mkdir($level_two_dir_path); + +echo "\n-- \$directory = './私はガラスを食べられますlevel_one': --\n"; +var_dump(chdir($base_dir_path)); +var_dump(chdir("./$level_one_dir_name")); +var_dump(getcwd()); + +echo "\n-- \$directory = '私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two': --\n"; +var_dump(chdir($base_dir_path)); +var_dump(chdir("$level_one_dir_name/$level_two_dir_name")); +var_dump(getcwd()); + +echo "\n-- \$directory = '..': --\n"; +var_dump(chdir('..')); +var_dump(getcwd()); + +echo "\n-- \$directory = '私はガラスを食べられますlevel_two', '.': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(chdir('.')); +var_dump(getcwd()); + +echo "\n-- \$directory = '../': --\n"; +var_dump(chdir('../')); +var_dump(getcwd()); + +echo "\n-- \$directory = './': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(chdir('./')); +var_dump(getcwd()); + +echo "\n-- \$directory = '../../'私はガラスを食べられますlevel_one': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(chdir("../../$level_one_dir_name")); +var_dump(getcwd()); + +$file_path = dirname(__FILE__); +chdir($file_path);/* not that PWD is accidentialy one of the dirs to be deleted. */ +rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); +rmdir("$file_path/私はガラスを食べられますlevel_one"); +?> +===DONE=== +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +chdir($file_path);/* not that PWD is accidentialy one of the dirs to be deleted. */ +rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); +rmdir("$file_path/私はガラスを食べられますlevel_one"); +?> +--EXPECTF-- +*** Testing chdir() : usage variations *** + +-- $directory = './私はガラスを食べられますlevel_one': -- +bool(true) +bool(true) +string(%d) "%slevel_one" + +-- $directory = '私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two': -- +bool(true) +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two" + +-- $directory = '..': -- +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one" + +-- $directory = '私はガラスを食べられますlevel_two', '.': -- +bool(true) +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two" + +-- $directory = '../': -- +bool(true) +string(%d) "%slevel_one" + +-- $directory = './': -- +bool(true) +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two" + +-- $directory = '../../'私はガラスを食べられますlevel_one': -- +bool(true) +bool(true) +string(%d) "%s私はガラスを食べられますlevel_one" +===DONE=== diff --git a/ext/standard/tests/dir/closedir_basic-win32-mb.phpt b/ext/standard/tests/dir/closedir_basic-win32-mb.phpt new file mode 100644 index 0000000000..4a871dbe74 --- /dev/null +++ b/ext/standard/tests/dir/closedir_basic-win32-mb.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test closedir() function : basic functionality +--FILE-- +<?php +/* Prototype : void closedir([resource $dir_handle]) + * Description: Close directory connection identified by the dir_handle + * Source code: ext/standard/dir.c + * Alias to functions: close + */ + +/* + * Test basic functionality of closedir() + */ + +echo "*** Testing closedir() : basic functionality ***\n"; + +$base_dir = dirname(__FILE__); +$dir_path = $base_dir . '/私はガラスを食べられますclosedir_basic'; +mkdir($dir_path); + +echo "\n-- Call closedir() with no arguments: --\n"; +$dh1 = opendir($dir_path); +var_dump(closedir()); +echo "-- Check Directory Handle: --\n"; +var_dump($dh1); + +echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n"; +$dh2 = opendir($dir_path); + +if ((int)$dh1 === (int)$dh2) { + echo "\nNo new resource created\n"; +} +var_dump(closedir($dh2)); +echo "-- Check Directory Handle: --\n"; +var_dump($dh2); +?> +===DONE=== +--CLEAN-- +<?php +$base_dir = dirname(__FILE__); +$dir_path = $base_dir . '/私はガラスを食べられますclosedir_basic'; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing closedir() : basic functionality *** + +-- Call closedir() with no arguments: -- +NULL +-- Check Directory Handle: -- +resource(%d) of type (Unknown) + +-- Call closedir() with $dir_handle argument supplied: -- +NULL +-- Check Directory Handle: -- +resource(%d) of type (Unknown) +===DONE=== diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt new file mode 100644 index 0000000000..15e646e124 --- /dev/null +++ b/ext/standard/tests/dir/closedir_error-win32-mb.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test closedir() function : error conditions - Pass incorrect number of arguments +--FILE-- +<?php +/* Prototype : void closedir([resource $dir_handle]) + * Description: Close directory connection identified by the dir_handle + * Source code: ext/standard/dir.c + * Alias to functions: close + */ + +/* + * Pass incorrect number of arguments to closedir() to test behaviour + */ + +echo "*** Testing closedir() : error conditions ***\n"; + + +//Test closedir with one more than the expected number of arguments +echo "\n-- Testing closedir() function with more than expected no. of arguments --\n"; + +$dir_path = dirname(__FILE__) . '\私はガラスを食べられますclosedir_error'; +mkdir($dir_path); +$dir_handle = opendir($dir_path); + +$extra_arg = 10; +var_dump( closedir($dir_handle, $extra_arg) ); + +//successfully close the directory handle so can delete in CLEAN section +closedir($dir_handle); +?> +===DONE=== +--CLEAN-- +<?php +$base_dir = dirname(__FILE__); +$dir_path = $base_dir . '\私はガラスを食べられますclosedir_error'; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing closedir() : error conditions *** + +-- Testing closedir() function with more than expected no. of arguments -- + +Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..f166bd9f0d --- /dev/null +++ b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test closedir() function : usage variations - close directory handle twice +--FILE-- +<?php +/* Prototype : void closedir([resource $dir_handle]) + * Description: Close directory connection identified by the dir_handle + * Source code: ext/standard/dir.c + * Alias to functions: close + */ + +/* + * close the directory handle twice using closedir() to test behaviour + */ + +echo "*** Testing closedir() : usage variations ***\n"; + +//create temporary directory for test, removed in CLEAN section +$directory = dirname(__FILE__) . "/私はガラスを食べられますclosedir_variation2"; +mkdir($directory); + +$dh = opendir($directory); + +echo "\n-- Close directory handle first time: --\n"; +var_dump(closedir($dh)); +echo "Directory Handle: "; +var_dump($dh); + +echo "\n-- Close directory handle second time: --\n"; +var_dump(closedir($dh)); +echo "Directory Handle: "; +var_dump($dh); +?> +===DONE=== +--CLEAN-- +<?php +$directory = dirname(__FILE__) . "/私はガラスを食べられますclosedir_variation2"; +rmdir($directory); +?> +--EXPECTF-- +*** Testing closedir() : usage variations *** + +-- Close directory handle first time: -- +NULL +Directory Handle: resource(%d) of type (Unknown) + +-- Close directory handle second time: -- + +Warning: closedir(): %s is not a valid Directory resource in %s on line %d +bool(false) +Directory Handle: resource(%d) of type (Unknown) +===DONE=== diff --git a/ext/standard/tests/dir/dir_basic-win32-mb.phpt b/ext/standard/tests/dir/dir_basic-win32-mb.phpt new file mode 100644 index 0000000000..a491d23abc --- /dev/null +++ b/ext/standard/tests/dir/dir_basic-win32-mb.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test dir() function : basic functionality +--FILE-- +<?php +/* + * Prototype : object dir(string $directory[, resource $context]) + * Description: Directory class with properties, handle and class and methods read, rewind and close + * Source code: ext/standard/dir.c + */ + +echo "*** Testing dir() : basic functionality ***\n"; + +// include the file.inc for Function: function create_files() +include(dirname(__FILE__)."/../file/file.inc"); + +// create the temporary directory +$file_path = dirname(__FILE__); +$dir_path = $file_path."/私はガラスを食べられますdir_basic"; +@mkdir($dir_path); + +// create files within the temporary directory +create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "私はガラスを食べられますdir_basic"); + +echo "Get Directory instance:\n"; +$d = dir($dir_path); +var_dump( $d ); + +echo "\nRead and rewind:\n"; +var_dump( $d->read() ); +var_dump( $d->read() ); +var_dump( $d->rewind() ); + +echo "\nTest using handle directly:\n"; +var_dump( readdir($d->handle) ); +var_dump( readdir($d->handle) ); + +echo "\nClose directory:\n"; +var_dump( $d->close() ); +var_dump( $d ); + +echo "\nTest read after closing the dir:"; +var_dump( $d->read() ); + +// delete temp files +delete_files($dir_path, 3, "私はガラスを食べられますdir_basic", 1, ".tmp"); +echo "Done"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$dir_path = $file_path."/私はガラスを食べられますdir_basic"; + +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing dir() : basic functionality *** +Get Directory instance: +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/私はガラスを食べられますdir_basic" + ["handle"]=> + resource(%d) of type (stream) +} + +Read and rewind: +string(%d) "%s" +string(%d) "%s" +NULL + +Test using handle directly: +string(%d) "%s" +string(%d) "%s" + +Close directory: +NULL +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s私はガラスを食べられますdir_basic" + ["handle"]=> + resource(%d) of type (Unknown) +} + +Test read after closing the dir: +Warning: Directory::read(): %s is not a valid Directory resource in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/dir/dir_variation2-win32-mb.phpt b/ext/standard/tests/dir/dir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..35f63cb649 --- /dev/null +++ b/ext/standard/tests/dir/dir_variation2-win32-mb.phpt @@ -0,0 +1,223 @@ +--TEST-- +Test dir() function : usage variations - unexpected value for 'context' argument +--FILE-- +<?php +/* + * Prototype : object dir(string $directory[, resource $context]) + * Description: Directory class with properties, handle and class and methods read, rewind and close + * Source code: ext/standard/dir.c + */ + +/* + * Passing non resource values to 'context' argument of dir() and see + * that the function outputs proper warning messages wherever expected. + */ + +echo "*** Testing dir() : unexpected values for \$context argument ***\n"; + +// create the temporary directory +$file_path = dirname(__FILE__); +$directory = $file_path."/私はガラスを食べられますdir_variation2"; +@mkdir($directory); + +// get an unset variable +$unset_var = stream_context_create(); +unset($unset_var); + +class classA +{ + public $var; + public function init() { + $this->var = 10; + } +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// unexpected values to be passed to $directory argument +$unexpected_values = array ( + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // array data +/*10*/ array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data +/*23*/ "string", + 'string', + $heredoc, + + // object data +/*26*/ new classA(), + + // undefined data +/*27*/ @$undefined_var, + + // unset data +/*28*/ @$unset_var +); + +// loop through various elements of $unexpected_values to check the behavior of dir() +$iterator = 1; +foreach( $unexpected_values as $unexpected_value ) { + echo "\n-- Iteration $iterator --"; + var_dump( dir($directory, $unexpected_value) ); + $iterator++; +} + +echo "Done"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$directory = $file_path."/私はガラスを食べられますdir_variation2"; + +rmdir($directory); +?> +--EXPECTF-- +*** Testing dir() : unexpected values for $context argument *** + +-- Iteration 1 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- +Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- +Warning: dir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 6 -- +Warning: dir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 7 -- +Warning: dir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 8 -- +Warning: dir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 9 -- +Warning: dir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 10 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 11 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 12 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 13 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 14 -- +Warning: dir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 15 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 16 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 17 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 18 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 19 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 20 -- +Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 21 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 23 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 24 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 25 -- +Warning: dir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 26 -- +Warning: dir() expects parameter 2 to be resource, object given in %s on line %d +NULL + +-- Iteration 27 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 28 -- +Warning: dir() expects parameter 2 to be resource, null given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/dir/dir_variation4-win32-mb.phpt b/ext/standard/tests/dir/dir_variation4-win32-mb.phpt new file mode 100644 index 0000000000..c5bd263f7b --- /dev/null +++ b/ext/standard/tests/dir/dir_variation4-win32-mb.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test dir() function : usage variations - operate on previously opened directory +--FILE-- +<?php +/* + * Prototype : object dir(string $directory[, resource $context]) + * Description: Directory class with properties, handle and class and methods read, rewind and close + * Source code: ext/standard/dir.c + */ + +/* + * Testing the behavior of dir() function by trying to open a + * directory which is already open. + */ + +echo "*** Testing dir() : operate on previously opened directory ***\n"; + +// include the file.inc for Function: function create_files() +include( dirname(__FILE__)."/../file/file.inc"); + +// create the temporary directory +$file_path = dirname(__FILE__); +$dir_path = $file_path."/私はガラスを食べられますdir_variation4"; +@mkdir($dir_path); + +// create files within the temporary directory +create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "私はガラスを食べられますdir_variation4"); + +// open the directory +$d = dir($dir_path); +var_dump( $d ); + +// open the same directory again without closing it +$e = dir($dir_path); +var_dump( $e ); + +echo "-- reading directory contents with previous handle --\n"; +var_dump( $d->read() ); // with previous handle + +echo "-- reading directory contents with current handle --\n"; +var_dump( $e->read() ); // with current handle + +// delete temporary files +delete_files($dir_path, 3, "私はガラスを食べられますdir_variation4"); +echo "Done"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$dir_path = $file_path."/私はガラスを食べられますdir_variation4"; + +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing dir() : operate on previously opened directory *** +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/私はガラスを食べられますdir_variation4" + ["handle"]=> + resource(%d) of type (stream) +} +object(Directory)#%d (2) { + ["path"]=> + string(%d) "%s/私はガラスを食べられますdir_variation4" + ["handle"]=> + resource(%d) of type (stream) +} +-- reading directory contents with previous handle -- +string(%d) "%s" +-- reading directory contents with current handle -- +string(%d) "%s" +Done diff --git a/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt b/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt new file mode 100644 index 0000000000..8a00959049 --- /dev/null +++ b/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test getcwd() function : basic functionality +--FILE-- +<?php +/* Prototype : mixed getcwd(void) + * Description: Gets the current directory + * Source code: ext/standard/dir.c + */ + +/* + * Test basic functionality of getcwd() + */ + +echo "*** Testing getcwd() : basic functionality ***\n"; + +//create temporary directory for test, removed in CLEAN section +$directory = dirname(__FILE__) . "/私はガラスを食べられますgetcwd_basic"; +mkdir($directory); + +var_dump(getcwd()); +chdir($directory); +var_dump(getcwd()); +?> +===DONE=== +--CLEAN-- +<?php +$directory = dirname(__FILE__) . "/私はガラスを食べられますgetcwd_basic"; +rmdir($directory); +?> +--EXPECTF-- +*** Testing getcwd() : basic functionality *** +string(%d) "%s" +string(%d) "%s%e私はガラスを食べられますgetcwd_basic" +===DONE=== diff --git a/ext/standard/tests/dir/opendir_basic-win32-mb.phpt b/ext/standard/tests/dir/opendir_basic-win32-mb.phpt new file mode 100644 index 0000000000..0c94c250be --- /dev/null +++ b/ext/standard/tests/dir/opendir_basic-win32-mb.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test opendir() function : basic functionality +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Test basic functionality of opendir() with absolute and relative paths as $path argument + */ + +echo "*** Testing opendir() : basic functionality ***\n"; + +$base_dir_path = dirname(__FILE__); + +$level_one_dir_name = "私はガラスを食べられますlevel_one"; +$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; + +$level_two_dir_name = "私はガラスを食べられますlevel_two"; +$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; + +// create temporary directories - will remove in CLEAN section +mkdir($level_one_dir_path); +mkdir($level_two_dir_path); + +echo "\n-- Testing opendir() with absolute path: --\n"; +var_dump($dh1 = opendir($level_one_dir_path)); + + +echo "\n-- Testing opendir() with relative paths: --\n"; +var_dump(chdir($level_one_dir_path)); +var_dump($dh2 = opendir($level_two_dir_name)); + +echo "\n-- Close directory handles: --\n"; +closedir($dh1); +var_dump($dh1); +closedir($dh2); +var_dump($dh2); +?> +===DONE=== +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); +rmdir("$file_path/私はガラスを食べられますlevel_one"); +?> +--EXPECTF-- +*** Testing opendir() : basic functionality *** + +-- Testing opendir() with absolute path: -- +resource(%d) of type (stream) + +-- Testing opendir() with relative paths: -- +bool(true) +resource(%d) of type (stream) + +-- Close directory handles: -- +resource(%d) of type (Unknown) +resource(%d) of type (Unknown) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_error1-win32-mb.phpt b/ext/standard/tests/dir/opendir_error1-win32-mb.phpt new file mode 100644 index 0000000000..71d07073ae --- /dev/null +++ b/ext/standard/tests/dir/opendir_error1-win32-mb.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test opendir() function : error conditions - Incorrect number of args +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass incorrect number of arguments to opendir() to test behaviour + */ + +echo "*** Testing opendir() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing opendir() function with Zero arguments --\n"; +var_dump( opendir() ); + +//Test opendir with one more than the expected number of arguments +echo "\n-- Testing opendir() function with more than expected no. of arguments --\n"; +$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_error"; +mkdir($path); +$context = stream_context_create(); + +$extra_arg = 10; +var_dump( opendir($path, $context, $extra_arg) ); +?> +===DONE=== +--CLEAN-- +<?php +$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_error"; +rmdir($path); +?> +--EXPECTF-- +*** Testing opendir() : error conditions *** + +-- Testing opendir() function with Zero arguments -- + +Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing opendir() function with more than expected no. of arguments -- + +Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation2-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..e82d32ee5f --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation2-win32-mb.phpt @@ -0,0 +1,239 @@ +--TEST-- +Test opendir() function : usage variations - different data types as $context arg +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass different data types as $context argument to opendir() to test behaviour + */ + +echo "*** Testing opendir() : usage variation ***\n"; + + +// Initialise function arguments not being substituted (if any) +// create temporary directory for test, removed in CLEAN section +$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_variation2"; +mkdir($path); + + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() + { + return "Class A object"; + } +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// unexpected values to be passed to $context argument +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + array(), + + // string data +/*19*/ "string", + 'string', + $heredoc, + + // object data +/*22*/ new classA(), + + // undefined data +/*23*/ @$undefined_var, + + // unset data +/*24*/ @$unset_var, + + // resource variable +/*25*/ $fp +); + +// loop through each element of $inputs to check the behavior of opendir() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump($dh = opendir($path, $input) );# + if ($dh) { + closedir($dh); + } + $iterator++; +}; + +fclose($fp); +?> +===DONE=== +--CLEAN-- +<?php +$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_variation2"; +rmdir($path); +?> +--EXPECTF-- +*** Testing opendir() : usage variation *** + +-- Iteration 1 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: opendir() expects parameter 2 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: opendir() expects parameter 2 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: opendir(): supplied resource is not a valid Stream-Context resource in %s on line %d +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt new file mode 100644 index 0000000000..af6d4fb1b4 --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test opendir() function : usage variations - open a directory twice +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Call opendir() twice with the same directory as $path argument + */ + +echo "*** Testing opendir() : usage variation ***\n"; + +$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_variation3"; +mkdir($path); + +echo "\n-- Open directory first time: --\n"; +var_dump($dh1 = opendir($path)); + +echo "\n-- Open directory second time: --\n"; +var_dump($dh2 = opendir($path)); + +if ($dh1 !== $dh2) { + echo "\nNew resource created\n"; +} else { + echo "\nNo new resource created\n"; +} + +closedir($dh1); +closedir($dh2); +?> +===DONE=== +--CLEAN-- +<?php +$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_variation3"; +rmdir($path); +?> +--EXPECTF-- +*** Testing opendir() : usage variation *** + +-- Open directory first time: -- +resource(%d) of type (stream) + +-- Open directory second time: -- +resource(%d) of type (stream) + +New resource created +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt new file mode 100644 index 0000000000..11ededf573 --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test opendir() function : usage variations - different relative paths +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Test opendir() with different relative paths as $path argument + */ + +echo "*** Testing opendir() : usage variation ***\n"; + +$base_dir_path = dirname(__FILE__); + +$level_one_dir_name = "私はガラスを食べられますlevel_one"; +$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; + +$level_two_dir_name = "私はガラスを食べられますlevel_two"; +$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; + +// create directories +mkdir($level_one_dir_path); +mkdir($level_two_dir_path); + +echo "\n-- \$path = './私はガラスを食べられますlevel_one': --\n"; +var_dump(chdir($base_dir_path)); +var_dump($dh = opendir("./$level_one_dir_name")); +clean_dh($dh); + +echo "\n-- \$path = '私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two': --\n"; +var_dump(chdir($base_dir_path)); +var_dump($dh = opendir("$level_one_dir_name/$level_two_dir_name")); +clean_dh($dh); + +echo "\n-- \$path = '..': --\n"; +var_dump($dh = opendir('..')); +clean_dh($dh); + +echo "\n-- \$path = 'level_two', '.': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump($dh = opendir('.')); +clean_dh($dh); + +echo "\n-- \$path = '../': --\n"; +var_dump($dh = opendir('../')); +clean_dh($dh); + +echo "\n-- \$path = './': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump($dh = opendir('./')); +clean_dh($dh); + +echo "\n-- \$path = '../../'私はガラスを食べられますlevel_one': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump($dh = opendir("../../$level_one_dir_name")); +clean_dh($dh); + +/* + * function to remove directory handle before re-using variable name in test + * and to ensure directory is not in use at CLEAN section so can me removed + */ +function clean_dh($dh){ + if (is_resource($dh)) { + closedir($dh); + } + unset($dh); +} +?> +===DONE=== +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); +rmdir("$file_path/私はガラスを食べられますlevel_one"); +?> +--EXPECTF-- +*** Testing opendir() : usage variation *** + +-- $path = './私はガラスを食べられますlevel_one': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '..': -- +resource(%d) of type (stream) + +-- $path = 'level_two', '.': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '../': -- +resource(%d) of type (stream) + +-- $path = './': -- +bool(true) +resource(%d) of type (stream) + +-- $path = '../../'私はガラスを食べられますlevel_one': -- +bool(true) +resource(%d) of type (stream) +===DONE=== diff --git a/ext/standard/tests/dir/opendir_variation6-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation6-win32-mb.phpt new file mode 100644 index 0000000000..f54a2ad4ae --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation6-win32-mb.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test opendir() function : usage variations - Different wildcards +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die("skip Valid only on Windows"); +} +?> +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass paths containing wildcards to test if opendir() recognises them + */ + +echo "*** Testing opendir() : usage variations ***\n"; +// create the temporary directories +$file_path = dirname(__FILE__); +$dir_path = $file_path . "/opendir_variation6"; +$sub_dir_path = $dir_path . "/sub_dir1"; + +mkdir($dir_path); +mkdir($sub_dir_path); + +// with different wildcard characters + +echo "\n-- Wildcard = '*' --\n"; +var_dump( opendir($file_path . "/opendir_var*") ); +var_dump( opendir($file_path . "/*") ); + +echo "\n-- Wildcard = '?' --\n"; +var_dump( opendir($dir_path . "/sub_dir?") ); +var_dump( opendir($dir_path . "/sub?dir1") ); + +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . "/opendir_variation6"; +$sub_dir_path = $dir_path . "/sub_dir1"; + +rmdir($sub_dir_path); +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: opendir(%s/opendir_var*,%s/opendir_var*): %s in %s on line %d + +Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/*,%s/*): %s in %s on line %d + +Warning: opendir(%s/*): failed to open dir: %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: opendir(%s/opendir_variation6/sub_dir?,%s/opendir_variation6/sub_dir?): %s in %s on line %d + +Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/opendir_variation6/sub?dir1,%s/opendir_variation6/sub?dir1): %s in %s on line %d + +Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/readdir_basic-win32-mb.phpt b/ext/standard/tests/dir/readdir_basic-win32-mb.phpt new file mode 100644 index 0000000000..36f96604e1 --- /dev/null +++ b/ext/standard/tests/dir/readdir_basic-win32-mb.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test readdir() function : basic functionality +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.C + */ + +/* + * Test basic functionality of readdir() + */ + +echo "*** Testing readdir() : basic functionality ***\n"; + +// include the file.inc for Function: function create_files() +chdir(dirname(__FILE__)); +include(dirname(__FILE__)."/../file/file.inc"); + +$path = dirname(__FILE__) . '/私はガラスを食べられますreaddir_basic'; +mkdir($path); +create_files($path, 3); + +echo "\n-- Call readdir() with \$path argument --\n"; +var_dump($dh = opendir($path)); +$a = array(); +while( FALSE !== ($file = readdir($dh)) ) { + $a[] = $file; +} +sort($a); +foreach($a as $file) { + var_dump($file); +} + +echo "\n-- Call readdir() without \$path argument --\n"; +var_dump($dh = opendir($path)); +$a = array(); +while( FALSE !== ( $file = readdir() ) ) { + $a[] = $file; +} +sort($a); +foreach($a as $file) { + var_dump($file); +} + +delete_files($path, 3); +closedir($dh); +?> +===DONE=== +--CLEAN-- +<?php +$path = dirname(__FILE__) . '/私はガラスを食べられますreaddir_basic'; +rmdir($path); +?> +--EXPECTF-- +*** Testing readdir() : basic functionality *** + +-- Call readdir() with $path argument -- +resource(%d) of type (stream) +string(1) "." +string(2) ".." +string(9) "file1.tmp" +string(9) "file2.tmp" +string(9) "file3.tmp" + +-- Call readdir() without $path argument -- +resource(%d) of type (stream) +string(1) "." +string(2) ".." +string(9) "file1.tmp" +string(9) "file2.tmp" +string(9) "file3.tmp" +===DONE=== diff --git a/ext/standard/tests/dir/readdir_error-win32-mb.phpt b/ext/standard/tests/dir/readdir_error-win32-mb.phpt new file mode 100644 index 0000000000..511d74c642 --- /dev/null +++ b/ext/standard/tests/dir/readdir_error-win32-mb.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test readdir() function : error conditions - Incorrect number of args +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass incorrect number of arguments to readdir() to test behaviour + */ + +echo "*** Testing readdir() : error conditions ***\n"; + + +//Test readdir with one more than the expected number of arguments +echo "\n-- Testing readdir() function with more than expected no. of arguments --\n"; + +$path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_error"; +mkdir($path); +$dir_handle = opendir($path); +$extra_arg = 10; + +var_dump( readdir($dir_handle, $extra_arg) ); + +// close the handle so can remove dir in CLEAN section +closedir($dir_handle); +?> +===DONE=== +--CLEAN-- +<?php +$path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_error"; +rmdir($path); +?> +--EXPECTF-- +*** Testing readdir() : error conditions *** + +-- Testing readdir() function with more than expected no. of arguments -- + +Warning: readdir() expects at most 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..59ea129e2e --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test readdir() function : usage variations - empty directories +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass readdir() a directory handle pointing to an empty directory to test behaviour + */ + +echo "*** Testing readdir() : usage variations ***\n"; + +$path = dirname(__FILE__) . '/私はガラスを食べられますreaddir_variation2'; +mkdir($path); +$dir_handle = opendir($path); + +echo "\n-- Pass an empty directory to readdir() --\n"; +function mysort($a,$b) { + return strlen($a) > strlen($b) ? 1 : -1; +} +$entries = array(); +while(FALSE !== ($file = readdir($dir_handle))){ + $entries[] = $file; +} + +closedir($dir_handle); + +usort($entries, "mysort"); +foreach($entries as $entry) { + var_dump($entry); +} +?> +===DONE=== +--CLEAN-- +<?php +$path = dirname(__FILE__) . '/私はガラスを食べられますreaddir_variation2'; +rmdir($path); +?> +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Pass an empty directory to readdir() -- +string(1) "." +string(2) ".." +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt new file mode 100644 index 0000000000..c2bc84949e --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test readdir() function : usage variations - sub-directories +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass a directory handle pointing to a directory that has a sub-directory + * to test behaviour of readdir() + */ + +echo "*** Testing readdir() : usage variations ***\n"; + +// include the file.inc for Function: function create_files() +chdir(dirname(__FILE__)); +include(dirname(__FILE__)."/../file/file.inc"); + +$path_top = dirname(__FILE__) . '/readdir_variation3'; +$path_sub = $path_top . '/私はガラスを食べられますsub_folder'; +mkdir($path_top); +mkdir($path_sub); + +create_files($path_top, 2); +create_files($path_sub, 2); + +$dir_handle = opendir($path_top); +while(FALSE !== ($file = readdir($dir_handle))) { + + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; +} + +// more important to check that all contents are present than order they are returned in +sort($contents); +var_dump($contents); + +delete_files($path_top, 2); +delete_files($path_sub, 2); + +closedir($dir_handle); +?> +===DONE=== +--CLEAN-- +<?php +$path_top = dirname(__FILE__) . '/readdir_variation3'; +$path_sub = $path_top . '/私はガラスを食べられますsub_folder'; +rmdir($path_sub); +rmdir($path_top); +?> +--EXPECTF-- +*** Testing readdir() : usage variations *** +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" + [4]=> + string(46) "私はガラスを食べられますsub_folder" +} +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt new file mode 100644 index 0000000000..e8c4ff224c --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt @@ -0,0 +1,178 @@ +--TEST-- +Test readdir() function : usage variations - different file names +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass a directory handle pointing to a directory that contains + * files with different file names to test how readdir() reads them + */ + +echo "*** Testing readdir() : usage variations ***\n"; + +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_variation4/"; +mkdir($dir_path); + +// heredoc string +$heredoc = <<<EOT +hd_file +EOT; + +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // empty data +/*10*/ "", + array(), + + // string data +/*12*/ "double_file", + 'single_file', + $heredoc, +); + +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = @fopen($dir_path . "私はガラスを食べられます$input.tmp", 'w') ); + var_dump( fwrite($$handle, $key)); + fclose($$handle); + $iterator++; +}; + +echo "\n-- Call to readdir() --\n"; +$dir_handle = opendir($dir_path); +while(FALSE !== ($file = readdir($dir_handle))){ + + // different OS order files differently so will + // store file names into an array so can use sorted in expected output + $contents[] = $file; + + // remove files while going through directory + @unlink($dir_path . $file); +} + +// more important to check that all contents are present than order they are returned in +sort($contents); +var_dump($contents); + +closedir($dir_handle); +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_variation4/"; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Iteration 1 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 2 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 3 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 4 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 5 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 6 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 7 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 8 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 9 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 10 -- +resource(%d) of type (stream) +int(1) + +-- Iteration 11 -- +resource(%d) of type (stream) +int(2) + +-- Iteration 12 -- +resource(%d) of type (stream) +int(2) + +-- Iteration 13 -- +resource(%d) of type (stream) +int(2) + +-- Iteration 14 -- +resource(%d) of type (stream) +int(2) + +-- Call to readdir() -- +array(16) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられます-10.5.tmp" + [3]=> + string(45) "私はガラスを食べられます-2345.tmp" + [4]=> + string(40) "私はガラスを食べられます.tmp" + [5]=> + string(43) "私はガラスを食べられます0.5.tmp" + [6]=> + string(41) "私はガラスを食べられます0.tmp" + [7]=> + string(53) "私はガラスを食べられます1.23456789E-9.tmp" + [8]=> + string(41) "私はガラスを食べられます1.tmp" + [9]=> + string(44) "私はガラスを食べられます10.5.tmp" + [10]=> + string(45) "私はガラスを食べられます12345.tmp" + [11]=> + string(52) "私はガラスを食べられます123456789000.tmp" + [12]=> + string(45) "私はガラスを食べられますArray.tmp" + [13]=> + string(51) "私はガラスを食べられますdouble_file.tmp" + [14]=> + string(47) "私はガラスを食べられますhd_file.tmp" + [15]=> + string(51) "私はガラスを食べられますsingle_file.tmp" +} +===DONE=== diff --git a/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt new file mode 100644 index 0000000000..4faadcaf86 --- /dev/null +++ b/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test readdir() function : usage variations - operate on previously opened directory +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Open two directory handles on the same directory and pass both + * to readdir() to test behaviour + */ + +echo "*** Testing readdir() : usage variations ***\n"; + +// include the file.inc for Function: function create_files() +include( dirname(__FILE__)."/../file/file.inc"); + +// create the temporary directory +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_variation6"; +mkdir($dir_path); + +// create files within the temporary directory +create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "私はガラスを食べられますreaddir_variation6"); + +// open the directory +$dir_handle1 = opendir($dir_path); + +// open the same directory again without closing it +opendir($dir_path); + +echo "\n-- Reading Directory Contents with Previous Handle --\n"; +$a = array(); +while (FALSE !== ($file = readdir($dir_handle1))) { + $a[] = $file; +} +sort($a); +foreach ($a as $file) { + var_dump($file); +} + +echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n"; +$a = array(); +while (FALSE !== ($file = readdir())) { + $a[] = $file; +} +sort($a); +foreach ($a as $file) { + var_dump($file); +} + +// delete temporary files +delete_files($dir_path, 3, "私はガラスを食べられますreaddir_variation6"); +closedir($dir_handle1); +closedir(); +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_variation6"; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing readdir() : usage variations *** + +-- Reading Directory Contents with Previous Handle -- +string(1) "." +string(2) ".." +string(59) "私はガラスを食べられますreaddir_variation61.tmp" +string(59) "私はガラスを食べられますreaddir_variation62.tmp" +string(59) "私はガラスを食べられますreaddir_variation63.tmp" + +-- Reading Directory Contents with Current Handle (no arguments supplied) -- +string(1) "." +string(2) ".." +string(59) "私はガラスを食べられますreaddir_variation61.tmp" +string(59) "私はガラスを食べられますreaddir_variation62.tmp" +string(59) "私はガラスを食べられますreaddir_variation63.tmp" +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt new file mode 100644 index 0000000000..e1f134a707 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test rewinddir() function : basic functionality +--FILE-- +<?php +/* Prototype : void rewinddir([resource $dir_handle]) + * Description: Rewind dir_handle back to the start + * Source code: ext/standard/dir.c + * Alias to functions: rewind + */ + +/* + * Test basic functionality of rewinddir() + */ + +echo "*** Testing rewinddir() : basic functionality ***\n"; + +// include file.inc for create_files function +include(dirname(__FILE__) . "/../file/file.inc"); + +$dir_path1 = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_basic_dir1"; +$dir_path2 = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_basic_dir2"; +mkdir($dir_path1); +mkdir($dir_path2); + +@create_files($dir_path1, 1, "numeric", 0755, 1, "w", "私はガラスを食べられますfile"); +@create_files($dir_path2, 1, 'numeric', 0755, 1, 'w', "私はガラスを食べられますfile", 2); +var_dump($dh1 = opendir($dir_path1)); +var_dump($dh2 = opendir($dir_path2)); + +$data = array(); +echo "\n-- Read and rewind first directory (argument supplied) --\n"; +while(FALSE !== $file1 = readdir($dh1)) { + $data[] = $file1; +} +$first = $data[0]; +sort($data); +var_dump($data); + +var_dump(rewinddir($dh1)); +var_dump(readdir($dh1) == $first); + +$data = array(); +echo "\n-- Read and rewind second directory (no argument supplied) --\n"; +while(FALSE !== $file2 = readdir()) { + $data[] = $file2; +} +$first = $data[0]; +sort($data); +var_dump($data); + +var_dump(rewinddir()); +var_dump(readdir() == $first); + +closedir($dh1); +closedir($dh2); + +delete_files($dir_path1, 1, "私はガラスを食べられますfile"); +delete_files($dir_path2, 1, "私はガラスを食べられますfile", 2); +?> +===DONE=== +--CLEAN-- +<?php +$dir_path1 = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_basic_dir1"; +$dir_path2 = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_basic_dir2"; +rmdir($dir_path1); +rmdir($dir_path2); +?> +--EXPECTF-- +*** Testing rewinddir() : basic functionality *** +resource(%d) of type (stream) +resource(%d) of type (stream) + +-- Read and rewind first directory (argument supplied) -- +array(3) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられますfile1.tmp" +} +NULL +bool(true) + +-- Read and rewind second directory (no argument supplied) -- +array(3) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられますfile2.tmp" +} +NULL +bool(true) +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_error-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_error-win32-mb.phpt new file mode 100644 index 0000000000..d78271e0f6 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_error-win32-mb.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test rewinddir() function : error conditions - incorrect number of args +--FILE-- +<?php +/* Prototype : void rewinddir([resource $dir_handle]) + * Description: Rewind dir_handle back to the start + * Source code: ext/standard/dir.c + * Alias to functions: rewind + */ + +/* + * Pass incorrect number of arguments to rewinddir() to test behaviour + */ + +echo "*** Testing rewinddir() : error conditions ***\n"; + + +//Test rewinddir with one more than the expected number of arguments +echo "\n-- Testing rewinddir() function with more than expected no. of arguments --\n"; + +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_error"; +mkdir($dir_path); +$dir_handle = opendir($dir_path); +$extra_arg = 10; + +var_dump( rewinddir($dir_handle, $extra_arg) ); +closedir($dir_handle); +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_error"; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing rewinddir() : error conditions *** + +-- Testing rewinddir() function with more than expected no. of arguments -- + +Warning: rewinddir() expects at most 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..71d40f1147 --- /dev/null +++ b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test rewinddir() function : usage variations - operate on a closed directory +--FILE-- +<?php +/* Prototype : void rewinddir([resource $dir_handle]) + * Description: Rewind dir_handle back to the start + * Source code: ext/standard/dir.c + * Alias to functions: rewind + */ + +/* + * Open and close a directory handle then call rewinddir() to test behaviour + */ + +echo "*** Testing rewinddir() : usage variations ***\n"; + +$dir_path = dirname(__FILE__) . '/私はガラスを食べられますrewinddir_variation2'; +mkdir($dir_path); + +echo "\n-- Create the directory handle, read and close the directory --\n"; +var_dump($dir_handle = opendir($dir_path)); +var_dump(readdir($dir_handle)); +closedir($dir_handle); + +echo "\n-- Call to rewinddir() --\n"; +var_dump(rewinddir($dir_handle)); +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . '/私はガラスを食べられますrewinddir_variation2'; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing rewinddir() : usage variations *** + +-- Create the directory handle, read and close the directory -- +resource(%d) of type (stream) +string(%d) "%s" + +-- Call to rewinddir() -- + +Warning: rewinddir(): %s is not a valid Directory resource in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_basic-win32-mb.phpt b/ext/standard/tests/dir/scandir_basic-win32-mb.phpt new file mode 100644 index 0000000000..ca99cf0ada --- /dev/null +++ b/ext/standard/tests/dir/scandir_basic-win32-mb.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test scandir() function : basic functionality +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Test basic functionality of scandir() + */ + +echo "*** Testing scandir() : basic functionality ***\n"; + +// include file.inc for create_files function +include (dirname(__FILE__) . '/../file/file.inc'); + +// set up directory +$directory = dirname(__FILE__) . '/私はガラスを食べられますscandir_basic'; +mkdir($directory); +create_files($directory, 3, "numeric", 0755, 1, "w", "私はガラスを食べられますfile"); + +echo "\n-- scandir() with mandatory arguments --\n"; +var_dump(scandir($directory)); + +echo "\n-- scandir() with all arguments --\n"; +$sorting_order = SCANDIR_SORT_DESCENDING; +$context = stream_context_create(); +var_dump(scandir($directory, $sorting_order, $context)); + +delete_files($directory, 3, "私はガラスを食べられますfile"); +?> +===DONE=== +--CLEAN-- +<?php +$directory = dirname(__FILE__) . '/私はガラスを食べられますscandir_basic'; +rmdir($directory); +?> +--EXPECTF-- +*** Testing scandir() : basic functionality *** + +-- scandir() with mandatory arguments -- +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられますfile1.tmp" + [3]=> + string(45) "私はガラスを食べられますfile2.tmp" + [4]=> + string(45) "私はガラスを食べられますfile3.tmp" +} + +-- scandir() with all arguments -- +array(5) { + [0]=> + string(45) "私はガラスを食べられますfile3.tmp" + [1]=> + string(45) "私はガラスを食べられますfile2.tmp" + [2]=> + string(45) "私はガラスを食べられますfile1.tmp" + [3]=> + string(2) ".." + [4]=> + string(1) "." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_error1-win32-mb.phpt b/ext/standard/tests/dir/scandir_error1-win32-mb.phpt new file mode 100644 index 0000000000..b0ed08a20d --- /dev/null +++ b/ext/standard/tests/dir/scandir_error1-win32-mb.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test scandir() function : error conditions - Incorrect number of args +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Pass incorrect number of arguments to scandir() to test behaviour + */ + +echo "*** Testing scandir() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing scandir() function with Zero arguments --\n"; +var_dump( scandir() ); + +//Test scandir with one more than the expected number of arguments +echo "\n-- Testing scandir() function with more than expected no. of arguments --\n"; +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_error'; +mkdir($dir); +$sorting_order = 10; +$context = stream_context_create(); +$extra_arg = 10; +var_dump( scandir($dir, $sorting_order, $context, $extra_arg) ); +?> +===DONE=== +--CLEAN-- +<?php +$directory = dirname(__FILE__) . '/私はガラスを食べられますscandir_error'; +rmdir($directory); +?> +--EXPECTF-- +*** Testing scandir() : error conditions *** + +-- Testing scandir() function with Zero arguments -- + +Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing scandir() function with more than expected no. of arguments -- + +Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt new file mode 100644 index 0000000000..435a710fbc --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test scandir() function : usage variations - different sorting constants +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +printf("SCANDIR_SORT_ASCENDING: %d\n", SCANDIR_SORT_ASCENDING); +printf("SCANDIR_SORT_DESCENDING: %d\n", SCANDIR_SORT_DESCENDING); +printf("SCANDIR_SORT_NONE: %d\n", SCANDIR_SORT_NONE); + +/* + * Pass different integers as $sorting_order argument to test how scandir() + * re-orders the array + */ + +echo "*** Testing scandir() : usage variations ***\n"; + +// include for create_files/delete_files functions +include(dirname(__FILE__) . '/../file/file.inc'); + +// create directory and files +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation10'; +mkdir($dir); +@create_files($dir, 2, "numeric", 0755, 1, "w", "私はガラスを食べられますfile"); + +// Deterministic tests. +var_dump(scandir($dir, SCANDIR_SORT_ASCENDING)); +var_dump(scandir($dir, SCANDIR_SORT_DESCENDING)); + +// Non-deterministic tests. +$files = scandir($dir, SCANDIR_SORT_NONE); +var_dump(count($files)); +var_dump(in_array('.', $files)); +var_dump(in_array('..', $files)); +var_dump(in_array('私はガラスを食べられますfile1.tmp', $files)); +var_dump(in_array('私はガラスを食べられますfile2.tmp', $files)); + +delete_files($dir, 2, "私はガラスを食べられますfile"); +?> +===DONE=== +--CLEAN-- +<?php +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation10'; +rmdir($dir); +?> +--EXPECTF-- +SCANDIR_SORT_ASCENDING: 0 +SCANDIR_SORT_DESCENDING: 1 +SCANDIR_SORT_NONE: 2 +*** Testing scandir() : usage variations *** +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられますfile1.tmp" + [3]=> + string(45) "私はガラスを食べられますfile2.tmp" +} +array(4) { + [0]=> + string(45) "私はガラスを食べられますfile2.tmp" + [1]=> + string(45) "私はガラスを食べられますfile1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +int(4) +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation2-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation2-win32-mb.phpt new file mode 100644 index 0000000000..4e32a85f95 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation2-win32-mb.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test scandir() function : usage variations - diff data types as $sorting_order arg +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Pass different data types as $sorting_order argument to test how scandir() behaves + */ + +echo "*** Testing scandir() : usage variations ***\n"; + +// Initialise function arguments not being substituted +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation2'; +mkdir($dir); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// unexpected values to be passed to $sorting_order argument +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + array(), + + // string data +/*19*/ "string", + 'string', + $heredoc, + + // object data +/*22*/ new classA(), + + // undefined data +/*23*/ @$undefined_var, + + // unset data +/*24*/ @$unset_var, + + // resource variable +/*25*/ $fp +); + +// loop through each element of $inputs to check the behavior of scandir() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( scandir($dir, $input) ); + $iterator++; +}; + +fclose($fp); +?> +===DONE=== +--CLEAN-- +<?php +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation2'; +rmdir($dir); +?> +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 2 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 3 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 4 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 5 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 6 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 7 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 8 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 9 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 10 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 11 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 12 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 13 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 14 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 15 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 16 -- + +Warning: scandir() expects parameter 2 to be integer, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 2 to be integer, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 2 to be integer, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 2 to be integer, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 2 to be integer, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 2 to be integer, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 2 to be integer, object given in %s on line %d +NULL + +-- Iteration 23 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 24 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 25 -- + +Warning: scandir() expects parameter 2 to be integer, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt new file mode 100644 index 0000000000..c6eae7cae1 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt @@ -0,0 +1,238 @@ +--TEST-- +Test scandir() function : usage variations - diff data types as $context arg +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Pass different data types as $context argument to test how scandir() behaves + */ + +echo "*** Testing scandir() : usage variations ***\n"; + +// Initialise function arguments not being substituted +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; +mkdir($dir); +$sorting_order = SCANDIR_SORT_ASCENDING; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// get a class +class classA +{ + public function __toString() { + return "Class A object"; + } +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// get a resource variable +$fp = fopen(__FILE__, "r"); + +// unexpected values to be passed to $context argument +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // null data +/*10*/ NULL, + null, + + // boolean data +/*12*/ true, + false, + TRUE, + FALSE, + + // empty data +/*16*/ "", + '', + array(), + + // string data +/*19*/ "string", + 'string', + $heredoc, + + // object data +/*22*/ new classA(), + + // undefined data +/*23*/ @$undefined_var, + + // unset data +/*24*/ @$unset_var, + + // resource variable +/*25*/ $fp +); + +// loop through each element of $inputs to check the behavior of scandir() +$iterator = 1; +foreach($inputs as $input) { + echo "\n-- Iteration $iterator --\n"; + var_dump( scandir($dir, $sorting_order, $input) ); + $iterator++; +}; + +fclose($fp); +?> +===DONE=== +--CLEAN-- +<?php +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; +rmdir($dir); +?> +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt new file mode 100644 index 0000000000..8090a276b7 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt @@ -0,0 +1,169 @@ +--TEST-- +Test scandir() function : usage variations - different relative paths +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Test scandir() with relative paths as $dir argument + */ + +echo "*** Testing scandir() : usage variations ***\n"; + +// include for create_files/delete_files functions +include (dirname(__FILE__) . '/../file/file.inc'); + +$base_dir_path = dirname(__FILE__); + +$level_one_dir_path = "$base_dir_path/私はガラスを食べられますlevel_one"; +$level_two_dir_path = "$level_one_dir_path/私はガラスを食べられますlevel_two"; + +// create directories and files +mkdir($level_one_dir_path); +create_files($level_one_dir_path, 2, 'numeric', 0755, 1, 'w', '私はガラスを食べられますlevel_one', 1); +mkdir($level_two_dir_path); +create_files($level_two_dir_path, 2, 'numeric', 0755, 1, 'w', '私はガラスを食べられますlevel_two', 1); + +echo "\n-- \$path = './私はガラスを食べられますlevel_one': --\n"; +var_dump(chdir($base_dir_path)); +var_dump(scandir('./私はガラスを食べられますlevel_one')); + +echo "\n-- \$path = 'level_one/私はガラスを食べられますlevel_two': --\n"; +var_dump(chdir($base_dir_path)); +var_dump(scandir('私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two')); + +echo "\n-- \$path = '..': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(scandir('..')); + +echo "\n-- \$path = '私はガラスを食べられますlevel_two', '.': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(scandir('.')); + +echo "\n-- \$path = '../': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(scandir('../')); + +echo "\n-- \$path = './': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(scandir('./')); + +echo "\n-- \$path = '../../'私はガラスを食べられますlevel_one': --\n"; +var_dump(chdir($level_two_dir_path)); +var_dump(scandir('../../私はガラスを食べられますlevel_one')); + +@delete_files($level_one_dir_path, 2, '私はガラスを食べられますlevel_one'); +@delete_files($level_two_dir_path, 2, '私はガラスを食べられますlevel_two'); +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__); +rmdir("$dir_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); +rmdir("$dir_path/私はガラスを食べられますlevel_one"); +?> +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- $path = './私はガラスを食べられますlevel_one': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_one1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_one2.tmp" + [4]=> + string(45) "私はガラスを食べられますlevel_two" +} + +-- $path = 'level_one/私はガラスを食べられますlevel_two': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_two1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_two2.tmp" +} + +-- $path = '..': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_one1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_one2.tmp" + [4]=> + string(45) "私はガラスを食べられますlevel_two" +} + +-- $path = '私はガラスを食べられますlevel_two', '.': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_two1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_two2.tmp" +} + +-- $path = '../': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_one1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_one2.tmp" + [4]=> + string(45) "私はガラスを食べられますlevel_two" +} + +-- $path = './': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_two1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_two2.tmp" +} + +-- $path = '../../'私はガラスを食べられますlevel_one': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(50) "私はガラスを食べられますlevel_one1.tmp" + [3]=> + string(50) "私はガラスを食べられますlevel_one2.tmp" + [4]=> + string(45) "私はガラスを食べられますlevel_two" +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt new file mode 100644 index 0000000000..7ae165fd92 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt @@ -0,0 +1,154 @@ +--TEST-- +Test scandir() function : usage variations - different file names +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Pass a directory containing files with different types of names to test how scandir() + * reads them + */ + +echo "*** Testing scandir() : usage variations ***\n"; + +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますscandir_variation8/"; +mkdir($dir_path); + +// heredoc string +$heredoc = <<<EOT +hd_file +EOT; + +$inputs = array( + + // int data +/*1*/ 0, + 1, + 12345, + -2345, + + // float data +/*5*/ 10.5, + -10.5, + 12.3456789000e10, + 12.3456789000E-10, + .5, + + // empty data +/*10*/ "", + array(), + + // string data +/*12*/ "double_file", + 'single_file', + $heredoc, +); + +$iterator = 1; +foreach($inputs as $key => $input) { + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = @fopen($dir_path . "/私はガラスを食べられます$input.tmp", 'w') ); + fclose($$handle); + $iterator++; +}; + +echo "\n-- Call to scandir() --\n"; +var_dump($content = scandir($dir_path)); + +// remove all files in directory so can remove directory in CLEAN section +foreach ($content as $file_name) { + // suppress errors as won't be able to remove "." and ".." entries + @unlink($dir_path . $file_name); +} +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . "/私はガラスを食べられますscandir_variation8"; +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +resource(%d) of type (stream) + +-- Iteration 2 -- +resource(%d) of type (stream) + +-- Iteration 3 -- +resource(%d) of type (stream) + +-- Iteration 4 -- +resource(%d) of type (stream) + +-- Iteration 5 -- +resource(%d) of type (stream) + +-- Iteration 6 -- +resource(%d) of type (stream) + +-- Iteration 7 -- +resource(%d) of type (stream) + +-- Iteration 8 -- +resource(%d) of type (stream) + +-- Iteration 9 -- +resource(%d) of type (stream) + +-- Iteration 10 -- +resource(%d) of type (stream) + +-- Iteration 11 -- +resource(%d) of type (stream) + +-- Iteration 12 -- +resource(%d) of type (stream) + +-- Iteration 13 -- +resource(%d) of type (stream) + +-- Iteration 14 -- +resource(%d) of type (stream) + +-- Call to scandir() -- +array(16) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられます-10.5.tmp" + [3]=> + string(45) "私はガラスを食べられます-2345.tmp" + [4]=> + string(40) "私はガラスを食べられます.tmp" + [5]=> + string(43) "私はガラスを食べられます0.5.tmp" + [6]=> + string(41) "私はガラスを食べられます0.tmp" + [7]=> + string(53) "私はガラスを食べられます1.23456789E-9.tmp" + [8]=> + string(41) "私はガラスを食べられます1.tmp" + [9]=> + string(44) "私はガラスを食べられます10.5.tmp" + [10]=> + string(45) "私はガラスを食べられます12345.tmp" + [11]=> + string(52) "私はガラスを食べられます123456789000.tmp" + [12]=> + string(45) "私はガラスを食べられますArray.tmp" + [13]=> + string(51) "私はガラスを食べられますdouble_file.tmp" + [14]=> + string(47) "私はガラスを食べられますhd_file.tmp" + [15]=> + string(51) "私はガラスを食べられますsingle_file.tmp" +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt new file mode 100644 index 0000000000..b4e1aee282 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test scandir() function : usage variations - different ints as $sorting_order arg +--FILE-- +<?php +/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) + * Description: List files & directories inside the specified path + * Source code: ext/standard/dir.c + */ + +/* + * Pass different integers as $sorting_order argument to test how scandir() + * re-orders the array + */ + +echo "*** Testing scandir() : usage variations ***\n"; + +// include for create_files/delete_files functions +include(dirname(__FILE__) . '/../file/file.inc'); + +// create directory and files +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation9'; +mkdir($dir); +@create_files($dir, 2, "numeric", 0755, 1, "w", "私はガラスを食べられますfile"); + +// different ints to pass as $sorting_order argument +$ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0); + +foreach($ints as $sorting_order) { + var_dump( scandir($dir, $sorting_order) ); +} + +delete_files($dir, 2, "私はガラスを食べられますfile"); +?> +===DONE=== +--CLEAN-- +<?php +$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation9'; +rmdir($dir); +?> +--EXPECTF-- +*** Testing scandir() : usage variations *** +array(4) { + [0]=> + string(45) "私はガラスを食べられますfile2.tmp" + [1]=> + string(45) "私はガラスを食べられますfile1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +array(4) { + [0]=> + string(45) "私はガラスを食べられますfile2.tmp" + [1]=> + string(45) "私はガラスを食べられますfile1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(45) "私はガラスを食べられますfile1.tmp" + [3]=> + string(45) "私はガラスを食べられますfile2.tmp" +} +===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt new file mode 100644 index 0000000000..cba61d3fbf --- /dev/null +++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt @@ -0,0 +1,69 @@ +--TEST-- +Directory class behaviour. +--FILE-- +<?php + +$d = getcwd().PATH_SEPARATOR."私はガラスを食べられます"; + +mkdir($d); + +echo "\n--> Try all methods with bad handle:\n"; +$d = new Directory($d); +$d->handle = "Havoc!"; +var_dump($d->read()); +var_dump($d->rewind()); +var_dump($d->close()); + +echo "\n--> Try all methods with no handle:\n"; +$d = new Directory($d); +unset($d->handle); +var_dump($d->read()); +var_dump($d->rewind()); +var_dump($d->close()); + +echo "\n--> Try all methods with wrong number of args:\n"; +$d = new Directory($d); +var_dump($d->read(1,2)); +var_dump($d->rewind(1,2)); +var_dump($d->close(1,2)); + +?> +--CLEAN-- +<?php +$d = getcwd().PATH_SEPARATOR."私はガラスを食べられます"; +rmdir($d); + +?> +--EXPECTF-- +--> Try all methods with bad handle: + +Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d +bool(false) + +Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d +bool(false) + +Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d +bool(false) + +--> Try all methods with no handle: + +Warning: Directory::read(): Unable to find my handle property in %s on line %d +bool(false) + +Warning: Directory::rewind(): Unable to find my handle property in %s on line %d +bool(false) + +Warning: Directory::close(): Unable to find my handle property in %s on line %d +bool(false) + +--> Try all methods with wrong number of args: + +Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d +NULL + +Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d +NULL + +Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d +NULL diff --git a/ext/standard/tests/file/001-win32-mb.phpt b/ext/standard/tests/file/001-win32-mb.phpt new file mode 100644 index 0000000000..eb3be23f83 --- /dev/null +++ b/ext/standard/tests/file/001-win32-mb.phpt @@ -0,0 +1,103 @@ +--TEST-- +File type functions +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only for Windows'); +} +?> +--FILE-- +<?php +chdir(dirname(__FILE__)); + +$fname = 'test_私はガラスを食べられます.file'; + +@unlink($fname); +if (file_exists($fname)) { + echo "$fname exists\n"; +} else { + echo "$fname does not exist\n"; +} +fclose (fopen($fname, 'w')); +chmod ($fname, 0744); +if (file_exists($fname)) { + echo "$fname exists\n"; +} else { + echo "$fname does not exist\n"; +} +if (is_link($fname)) { + echo "$fname is a symlink\n"; +} else { + echo "$fname is not a symlink\n"; +} +if (file_exists($fname)) { + echo "$fname exists\n"; +} else { + echo "$fname does not exist\n"; +} +$s = stat ($fname); +$ls = lstat ($fname); +for ($i = 0; $i <= 12; $i++) { + if ($ls[$i] != $s[$i]) { + echo "$fname lstat and stat differ at element $i\n"; + } +} +echo "$fname is " . filetype($fname) . "\n"; +printf ("$fname permissions are 0%o\n", 0777 & fileperms($fname)); +echo "$fname size is " . filesize($fname) . "\n"; +if (is_writeable($fname)) { + echo "$fname is writeable\n"; +} else { + echo "$fname is not writeable\n"; +} +if (is_readable($fname)) { + echo "$fname is readable\n"; +} else { + echo "$fname is not readable\n"; +} +if (is_file($fname)) { + echo "$fname is a regular file\n"; +} else { + echo "$fname is not a regular file\n"; +} +if (is_dir('../file')) { + echo "../file is a directory\n"; +} else { + echo "../file is not a directory\n"; +} +if (is_dir($fname)) { + echo "$fname is a directory\n"; +} else { + echo "$fname is not a directory\n"; +} +unlink($fname); +if (file_exists($fname)) { + echo "$fname exists (cached)\n"; +} else { + echo "$fname does not exist\n"; +} +clearstatcache(); +if (file_exists($fname)) { + echo "$fname exists\n"; +} else { + echo "$fname does not exist\n"; +} +?> +--EXPECT-- +test_私はガラスを食べられます.file does not exist +test_私はガラスを食べられます.file exists +test_私はガラスを食べられます.file is not a symlink +test_私はガラスを食べられます.file exists +test_私はガラスを食べられます.file is file +test_私はガラスを食べられます.file permissions are 0666 +test_私はガラスを食べられます.file size is 0 +test_私はガラスを食べられます.file is writeable +test_私はガラスを食べられます.file is readable +test_私はガラスを食べられます.file is a regular file +../file is a directory +test_私はガラスを食べられます.file is not a directory +test_私はガラスを食べられます.file does not exist +test_私はガラスを食べられます.file does not exist + diff --git a/ext/standard/tests/file/007_variation11-win32-mb.phpt b/ext/standard/tests/file/007_variation11-win32-mb.phpt new file mode 100644 index 0000000000..68a0e8ccd0 --- /dev/null +++ b/ext/standard/tests/file/007_variation11-win32-mb.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test fopen and fclose() functions - usage variations - "wt" mode +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != "WIN" ) + die('skip Run only on Windows'); +?> +--FILE-- +<?php +/* + fopen() function: + Prototype: resource fopen(string $filename, string $mode + [, bool $use_include_path [, resource $context]] ); + Description: Opens file or URL. +*/ +/* + fclose() function: + Prototype: bool fclose ( resource $handle ); + Description: Closes an open file pointer +*/ + +/* Test fopen() and fclose(): Opening the file in "wt" mode, + checking for the file creation, write & read operations, + checking for the file pointer position, + checking for the file truncation when trying to open an existing file in "wt" mode, + and fclose function +*/ +$file_path = dirname(__FILE__); +require($file_path."/file.inc"); + +create_files($file_path, 1, "text_with_new_line", 0755, 20, "wt", "007_variation_私はガラスを食べられます", 11, "bytes"); +$file = $file_path."/007_variation_私はガラスを食べられます11.tmp"; +$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789"; + +echo "*** Test fopen() & fclose() functions: with 'wt' mode ***\n"; +$file_handle = fopen($file, "wt"); //opening the file "wt" mode +var_dump($file_handle); //Check for the content of handle +var_dump( get_resource_type($file_handle) ); //Check for the type of resource +var_dump( ftell($file_handle) ); //Initial file pointer position, expected at the beginning of the file +var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string +var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file +rewind($file_handle); +var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string +var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the beginning of the file +var_dump( fclose($file_handle) ); //Check for close operation on the file handle +var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation + +var_dump( filesize($file) ); //Check for size of existing data file before opening the file in "wt" mode again, expected: size of content +clearstatcache(); +fclose( fopen($file, "wt") ); //Opening the existing data file again in "wt" mode +var_dump( filesize($file) ); //Check for size of existing data file after opening the file in "wt" mode again, expected: 0 bytes +clearstatcache(); + +unlink($file); //Deleting the file +fclose( fopen($file, "wt") ); //Opening the non-existing file in "wt" mode, which will be created +var_dump( file_exists($file) ); //Check for the existence of file +echo "*** Done ***\n"; +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$file = $file_path."/007_variation_私はガラスを食べられます11.tmp"; +unlink($file); +?> +--EXPECTF-- +*** Test fopen() & fclose() functions: with 'wt' mode *** +resource(%d) of type (stream) +string(6) "stream" +int(0) +int(37) +int(37) +string(0) "" +int(0) +bool(true) +string(7) "Unknown" +int(39) +int(0) +bool(true) +*** Done *** diff --git a/ext/standard/tests/file/bug43353-win32.phpt b/ext/standard/tests/file/bug43353-win32.phpt index 0667f6984e..2faabb92c0 100644 --- a/ext/standard/tests/file/bug43353-win32.phpt +++ b/ext/standard/tests/file/bug43353-win32.phpt @@ -21,5 +21,5 @@ bool(false) bool(false)
string(3) "foo"
-Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: Invalid argument in %s
+Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
bool(false)
diff --git a/ext/standard/tests/file/chmod_basic-win32-mb.phpt b/ext/standard/tests/file/chmod_basic-win32-mb.phpt new file mode 100644 index 0000000000..3970504ddb --- /dev/null +++ b/ext/standard/tests/file/chmod_basic-win32-mb.phpt @@ -0,0 +1,545 @@ +--TEST-- +chmod() basic functionality +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip Windows only chmod test'); +} +?> +--FILE-- +<?php + +define("PERMISSIONS_MASK", 0777); + +$filename = __FILE__ . "私はガラスを食べられます.tmp"; + +$fd = fopen($filename, "w+"); +fclose($fd); + +for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) { + chmod($filename, $perms_to_set); + $set_perms = (fileperms($filename) & PERMISSIONS_MASK); + clearstatcache(); + printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms); +} +var_dump(chmod($filename, 0777)); + +unlink($filename); +echo "done"; + +?> +--EXPECT-- +Setting mode 777 gives mode 666 +Setting mode 776 gives mode 666 +Setting mode 775 gives mode 666 +Setting mode 774 gives mode 666 +Setting mode 773 gives mode 666 +Setting mode 772 gives mode 666 +Setting mode 771 gives mode 666 +Setting mode 770 gives mode 666 +Setting mode 767 gives mode 666 +Setting mode 766 gives mode 666 +Setting mode 765 gives mode 666 +Setting mode 764 gives mode 666 +Setting mode 763 gives mode 666 +Setting mode 762 gives mode 666 +Setting mode 761 gives mode 666 +Setting mode 760 gives mode 666 +Setting mode 757 gives mode 666 +Setting mode 756 gives mode 666 +Setting mode 755 gives mode 666 +Setting mode 754 gives mode 666 +Setting mode 753 gives mode 666 +Setting mode 752 gives mode 666 +Setting mode 751 gives mode 666 +Setting mode 750 gives mode 666 +Setting mode 747 gives mode 666 +Setting mode 746 gives mode 666 +Setting mode 745 gives mode 666 +Setting mode 744 gives mode 666 +Setting mode 743 gives mode 666 +Setting mode 742 gives mode 666 +Setting mode 741 gives mode 666 +Setting mode 740 gives mode 666 +Setting mode 737 gives mode 666 +Setting mode 736 gives mode 666 +Setting mode 735 gives mode 666 +Setting mode 734 gives mode 666 +Setting mode 733 gives mode 666 +Setting mode 732 gives mode 666 +Setting mode 731 gives mode 666 +Setting mode 730 gives mode 666 +Setting mode 727 gives mode 666 +Setting mode 726 gives mode 666 +Setting mode 725 gives mode 666 +Setting mode 724 gives mode 666 +Setting mode 723 gives mode 666 +Setting mode 722 gives mode 666 +Setting mode 721 gives mode 666 +Setting mode 720 gives mode 666 +Setting mode 717 gives mode 666 +Setting mode 716 gives mode 666 +Setting mode 715 gives mode 666 +Setting mode 714 gives mode 666 +Setting mode 713 gives mode 666 +Setting mode 712 gives mode 666 +Setting mode 711 gives mode 666 +Setting mode 710 gives mode 666 +Setting mode 707 gives mode 666 +Setting mode 706 gives mode 666 +Setting mode 705 gives mode 666 +Setting mode 704 gives mode 666 +Setting mode 703 gives mode 666 +Setting mode 702 gives mode 666 +Setting mode 701 gives mode 666 +Setting mode 700 gives mode 666 +Setting mode 677 gives mode 666 +Setting mode 676 gives mode 666 +Setting mode 675 gives mode 666 +Setting mode 674 gives mode 666 +Setting mode 673 gives mode 666 +Setting mode 672 gives mode 666 +Setting mode 671 gives mode 666 +Setting mode 670 gives mode 666 +Setting mode 667 gives mode 666 +Setting mode 666 gives mode 666 +Setting mode 665 gives mode 666 +Setting mode 664 gives mode 666 +Setting mode 663 gives mode 666 +Setting mode 662 gives mode 666 +Setting mode 661 gives mode 666 +Setting mode 660 gives mode 666 +Setting mode 657 gives mode 666 +Setting mode 656 gives mode 666 +Setting mode 655 gives mode 666 +Setting mode 654 gives mode 666 +Setting mode 653 gives mode 666 +Setting mode 652 gives mode 666 +Setting mode 651 gives mode 666 +Setting mode 650 gives mode 666 +Setting mode 647 gives mode 666 +Setting mode 646 gives mode 666 +Setting mode 645 gives mode 666 +Setting mode 644 gives mode 666 +Setting mode 643 gives mode 666 +Setting mode 642 gives mode 666 +Setting mode 641 gives mode 666 +Setting mode 640 gives mode 666 +Setting mode 637 gives mode 666 +Setting mode 636 gives mode 666 +Setting mode 635 gives mode 666 +Setting mode 634 gives mode 666 +Setting mode 633 gives mode 666 +Setting mode 632 gives mode 666 +Setting mode 631 gives mode 666 +Setting mode 630 gives mode 666 +Setting mode 627 gives mode 666 +Setting mode 626 gives mode 666 +Setting mode 625 gives mode 666 +Setting mode 624 gives mode 666 +Setting mode 623 gives mode 666 +Setting mode 622 gives mode 666 +Setting mode 621 gives mode 666 +Setting mode 620 gives mode 666 +Setting mode 617 gives mode 666 +Setting mode 616 gives mode 666 +Setting mode 615 gives mode 666 +Setting mode 614 gives mode 666 +Setting mode 613 gives mode 666 +Setting mode 612 gives mode 666 +Setting mode 611 gives mode 666 +Setting mode 610 gives mode 666 +Setting mode 607 gives mode 666 +Setting mode 606 gives mode 666 +Setting mode 605 gives mode 666 +Setting mode 604 gives mode 666 +Setting mode 603 gives mode 666 +Setting mode 602 gives mode 666 +Setting mode 601 gives mode 666 +Setting mode 600 gives mode 666 +Setting mode 577 gives mode 444 +Setting mode 576 gives mode 444 +Setting mode 575 gives mode 444 +Setting mode 574 gives mode 444 +Setting mode 573 gives mode 444 +Setting mode 572 gives mode 444 +Setting mode 571 gives mode 444 +Setting mode 570 gives mode 444 +Setting mode 567 gives mode 444 +Setting mode 566 gives mode 444 +Setting mode 565 gives mode 444 +Setting mode 564 gives mode 444 +Setting mode 563 gives mode 444 +Setting mode 562 gives mode 444 +Setting mode 561 gives mode 444 +Setting mode 560 gives mode 444 +Setting mode 557 gives mode 444 +Setting mode 556 gives mode 444 +Setting mode 555 gives mode 444 +Setting mode 554 gives mode 444 +Setting mode 553 gives mode 444 +Setting mode 552 gives mode 444 +Setting mode 551 gives mode 444 +Setting mode 550 gives mode 444 +Setting mode 547 gives mode 444 +Setting mode 546 gives mode 444 +Setting mode 545 gives mode 444 +Setting mode 544 gives mode 444 +Setting mode 543 gives mode 444 +Setting mode 542 gives mode 444 +Setting mode 541 gives mode 444 +Setting mode 540 gives mode 444 +Setting mode 537 gives mode 444 +Setting mode 536 gives mode 444 +Setting mode 535 gives mode 444 +Setting mode 534 gives mode 444 +Setting mode 533 gives mode 444 +Setting mode 532 gives mode 444 +Setting mode 531 gives mode 444 +Setting mode 530 gives mode 444 +Setting mode 527 gives mode 444 +Setting mode 526 gives mode 444 +Setting mode 525 gives mode 444 +Setting mode 524 gives mode 444 +Setting mode 523 gives mode 444 +Setting mode 522 gives mode 444 +Setting mode 521 gives mode 444 +Setting mode 520 gives mode 444 +Setting mode 517 gives mode 444 +Setting mode 516 gives mode 444 +Setting mode 515 gives mode 444 +Setting mode 514 gives mode 444 +Setting mode 513 gives mode 444 +Setting mode 512 gives mode 444 +Setting mode 511 gives mode 444 +Setting mode 510 gives mode 444 +Setting mode 507 gives mode 444 +Setting mode 506 gives mode 444 +Setting mode 505 gives mode 444 +Setting mode 504 gives mode 444 +Setting mode 503 gives mode 444 +Setting mode 502 gives mode 444 +Setting mode 501 gives mode 444 +Setting mode 500 gives mode 444 +Setting mode 477 gives mode 444 +Setting mode 476 gives mode 444 +Setting mode 475 gives mode 444 +Setting mode 474 gives mode 444 +Setting mode 473 gives mode 444 +Setting mode 472 gives mode 444 +Setting mode 471 gives mode 444 +Setting mode 470 gives mode 444 +Setting mode 467 gives mode 444 +Setting mode 466 gives mode 444 +Setting mode 465 gives mode 444 +Setting mode 464 gives mode 444 +Setting mode 463 gives mode 444 +Setting mode 462 gives mode 444 +Setting mode 461 gives mode 444 +Setting mode 460 gives mode 444 +Setting mode 457 gives mode 444 +Setting mode 456 gives mode 444 +Setting mode 455 gives mode 444 +Setting mode 454 gives mode 444 +Setting mode 453 gives mode 444 +Setting mode 452 gives mode 444 +Setting mode 451 gives mode 444 +Setting mode 450 gives mode 444 +Setting mode 447 gives mode 444 +Setting mode 446 gives mode 444 +Setting mode 445 gives mode 444 +Setting mode 444 gives mode 444 +Setting mode 443 gives mode 444 +Setting mode 442 gives mode 444 +Setting mode 441 gives mode 444 +Setting mode 440 gives mode 444 +Setting mode 437 gives mode 444 +Setting mode 436 gives mode 444 +Setting mode 435 gives mode 444 +Setting mode 434 gives mode 444 +Setting mode 433 gives mode 444 +Setting mode 432 gives mode 444 +Setting mode 431 gives mode 444 +Setting mode 430 gives mode 444 +Setting mode 427 gives mode 444 +Setting mode 426 gives mode 444 +Setting mode 425 gives mode 444 +Setting mode 424 gives mode 444 +Setting mode 423 gives mode 444 +Setting mode 422 gives mode 444 +Setting mode 421 gives mode 444 +Setting mode 420 gives mode 444 +Setting mode 417 gives mode 444 +Setting mode 416 gives mode 444 +Setting mode 415 gives mode 444 +Setting mode 414 gives mode 444 +Setting mode 413 gives mode 444 +Setting mode 412 gives mode 444 +Setting mode 411 gives mode 444 +Setting mode 410 gives mode 444 +Setting mode 407 gives mode 444 +Setting mode 406 gives mode 444 +Setting mode 405 gives mode 444 +Setting mode 404 gives mode 444 +Setting mode 403 gives mode 444 +Setting mode 402 gives mode 444 +Setting mode 401 gives mode 444 +Setting mode 400 gives mode 444 +Setting mode 377 gives mode 666 +Setting mode 376 gives mode 666 +Setting mode 375 gives mode 666 +Setting mode 374 gives mode 666 +Setting mode 373 gives mode 666 +Setting mode 372 gives mode 666 +Setting mode 371 gives mode 666 +Setting mode 370 gives mode 666 +Setting mode 367 gives mode 666 +Setting mode 366 gives mode 666 +Setting mode 365 gives mode 666 +Setting mode 364 gives mode 666 +Setting mode 363 gives mode 666 +Setting mode 362 gives mode 666 +Setting mode 361 gives mode 666 +Setting mode 360 gives mode 666 +Setting mode 357 gives mode 666 +Setting mode 356 gives mode 666 +Setting mode 355 gives mode 666 +Setting mode 354 gives mode 666 +Setting mode 353 gives mode 666 +Setting mode 352 gives mode 666 +Setting mode 351 gives mode 666 +Setting mode 350 gives mode 666 +Setting mode 347 gives mode 666 +Setting mode 346 gives mode 666 +Setting mode 345 gives mode 666 +Setting mode 344 gives mode 666 +Setting mode 343 gives mode 666 +Setting mode 342 gives mode 666 +Setting mode 341 gives mode 666 +Setting mode 340 gives mode 666 +Setting mode 337 gives mode 666 +Setting mode 336 gives mode 666 +Setting mode 335 gives mode 666 +Setting mode 334 gives mode 666 +Setting mode 333 gives mode 666 +Setting mode 332 gives mode 666 +Setting mode 331 gives mode 666 +Setting mode 330 gives mode 666 +Setting mode 327 gives mode 666 +Setting mode 326 gives mode 666 +Setting mode 325 gives mode 666 +Setting mode 324 gives mode 666 +Setting mode 323 gives mode 666 +Setting mode 322 gives mode 666 +Setting mode 321 gives mode 666 +Setting mode 320 gives mode 666 +Setting mode 317 gives mode 666 +Setting mode 316 gives mode 666 +Setting mode 315 gives mode 666 +Setting mode 314 gives mode 666 +Setting mode 313 gives mode 666 +Setting mode 312 gives mode 666 +Setting mode 311 gives mode 666 +Setting mode 310 gives mode 666 +Setting mode 307 gives mode 666 +Setting mode 306 gives mode 666 +Setting mode 305 gives mode 666 +Setting mode 304 gives mode 666 +Setting mode 303 gives mode 666 +Setting mode 302 gives mode 666 +Setting mode 301 gives mode 666 +Setting mode 300 gives mode 666 +Setting mode 277 gives mode 666 +Setting mode 276 gives mode 666 +Setting mode 275 gives mode 666 +Setting mode 274 gives mode 666 +Setting mode 273 gives mode 666 +Setting mode 272 gives mode 666 +Setting mode 271 gives mode 666 +Setting mode 270 gives mode 666 +Setting mode 267 gives mode 666 +Setting mode 266 gives mode 666 +Setting mode 265 gives mode 666 +Setting mode 264 gives mode 666 +Setting mode 263 gives mode 666 +Setting mode 262 gives mode 666 +Setting mode 261 gives mode 666 +Setting mode 260 gives mode 666 +Setting mode 257 gives mode 666 +Setting mode 256 gives mode 666 +Setting mode 255 gives mode 666 +Setting mode 254 gives mode 666 +Setting mode 253 gives mode 666 +Setting mode 252 gives mode 666 +Setting mode 251 gives mode 666 +Setting mode 250 gives mode 666 +Setting mode 247 gives mode 666 +Setting mode 246 gives mode 666 +Setting mode 245 gives mode 666 +Setting mode 244 gives mode 666 +Setting mode 243 gives mode 666 +Setting mode 242 gives mode 666 +Setting mode 241 gives mode 666 +Setting mode 240 gives mode 666 +Setting mode 237 gives mode 666 +Setting mode 236 gives mode 666 +Setting mode 235 gives mode 666 +Setting mode 234 gives mode 666 +Setting mode 233 gives mode 666 +Setting mode 232 gives mode 666 +Setting mode 231 gives mode 666 +Setting mode 230 gives mode 666 +Setting mode 227 gives mode 666 +Setting mode 226 gives mode 666 +Setting mode 225 gives mode 666 +Setting mode 224 gives mode 666 +Setting mode 223 gives mode 666 +Setting mode 222 gives mode 666 +Setting mode 221 gives mode 666 +Setting mode 220 gives mode 666 +Setting mode 217 gives mode 666 +Setting mode 216 gives mode 666 +Setting mode 215 gives mode 666 +Setting mode 214 gives mode 666 +Setting mode 213 gives mode 666 +Setting mode 212 gives mode 666 +Setting mode 211 gives mode 666 +Setting mode 210 gives mode 666 +Setting mode 207 gives mode 666 +Setting mode 206 gives mode 666 +Setting mode 205 gives mode 666 +Setting mode 204 gives mode 666 +Setting mode 203 gives mode 666 +Setting mode 202 gives mode 666 +Setting mode 201 gives mode 666 +Setting mode 200 gives mode 666 +Setting mode 177 gives mode 444 +Setting mode 176 gives mode 444 +Setting mode 175 gives mode 444 +Setting mode 174 gives mode 444 +Setting mode 173 gives mode 444 +Setting mode 172 gives mode 444 +Setting mode 171 gives mode 444 +Setting mode 170 gives mode 444 +Setting mode 167 gives mode 444 +Setting mode 166 gives mode 444 +Setting mode 165 gives mode 444 +Setting mode 164 gives mode 444 +Setting mode 163 gives mode 444 +Setting mode 162 gives mode 444 +Setting mode 161 gives mode 444 +Setting mode 160 gives mode 444 +Setting mode 157 gives mode 444 +Setting mode 156 gives mode 444 +Setting mode 155 gives mode 444 +Setting mode 154 gives mode 444 +Setting mode 153 gives mode 444 +Setting mode 152 gives mode 444 +Setting mode 151 gives mode 444 +Setting mode 150 gives mode 444 +Setting mode 147 gives mode 444 +Setting mode 146 gives mode 444 +Setting mode 145 gives mode 444 +Setting mode 144 gives mode 444 +Setting mode 143 gives mode 444 +Setting mode 142 gives mode 444 +Setting mode 141 gives mode 444 +Setting mode 140 gives mode 444 +Setting mode 137 gives mode 444 +Setting mode 136 gives mode 444 +Setting mode 135 gives mode 444 +Setting mode 134 gives mode 444 +Setting mode 133 gives mode 444 +Setting mode 132 gives mode 444 +Setting mode 131 gives mode 444 +Setting mode 130 gives mode 444 +Setting mode 127 gives mode 444 +Setting mode 126 gives mode 444 +Setting mode 125 gives mode 444 +Setting mode 124 gives mode 444 +Setting mode 123 gives mode 444 +Setting mode 122 gives mode 444 +Setting mode 121 gives mode 444 +Setting mode 120 gives mode 444 +Setting mode 117 gives mode 444 +Setting mode 116 gives mode 444 +Setting mode 115 gives mode 444 +Setting mode 114 gives mode 444 +Setting mode 113 gives mode 444 +Setting mode 112 gives mode 444 +Setting mode 111 gives mode 444 +Setting mode 110 gives mode 444 +Setting mode 107 gives mode 444 +Setting mode 106 gives mode 444 +Setting mode 105 gives mode 444 +Setting mode 104 gives mode 444 +Setting mode 103 gives mode 444 +Setting mode 102 gives mode 444 +Setting mode 101 gives mode 444 +Setting mode 100 gives mode 444 +Setting mode 77 gives mode 444 +Setting mode 76 gives mode 444 +Setting mode 75 gives mode 444 +Setting mode 74 gives mode 444 +Setting mode 73 gives mode 444 +Setting mode 72 gives mode 444 +Setting mode 71 gives mode 444 +Setting mode 70 gives mode 444 +Setting mode 67 gives mode 444 +Setting mode 66 gives mode 444 +Setting mode 65 gives mode 444 +Setting mode 64 gives mode 444 +Setting mode 63 gives mode 444 +Setting mode 62 gives mode 444 +Setting mode 61 gives mode 444 +Setting mode 60 gives mode 444 +Setting mode 57 gives mode 444 +Setting mode 56 gives mode 444 +Setting mode 55 gives mode 444 +Setting mode 54 gives mode 444 +Setting mode 53 gives mode 444 +Setting mode 52 gives mode 444 +Setting mode 51 gives mode 444 +Setting mode 50 gives mode 444 +Setting mode 47 gives mode 444 +Setting mode 46 gives mode 444 +Setting mode 45 gives mode 444 +Setting mode 44 gives mode 444 +Setting mode 43 gives mode 444 +Setting mode 42 gives mode 444 +Setting mode 41 gives mode 444 +Setting mode 40 gives mode 444 +Setting mode 37 gives mode 444 +Setting mode 36 gives mode 444 +Setting mode 35 gives mode 444 +Setting mode 34 gives mode 444 +Setting mode 33 gives mode 444 +Setting mode 32 gives mode 444 +Setting mode 31 gives mode 444 +Setting mode 30 gives mode 444 +Setting mode 27 gives mode 444 +Setting mode 26 gives mode 444 +Setting mode 25 gives mode 444 +Setting mode 24 gives mode 444 +Setting mode 23 gives mode 444 +Setting mode 22 gives mode 444 +Setting mode 21 gives mode 444 +Setting mode 20 gives mode 444 +Setting mode 17 gives mode 444 +Setting mode 16 gives mode 444 +Setting mode 15 gives mode 444 +Setting mode 14 gives mode 444 +Setting mode 13 gives mode 444 +Setting mode 12 gives mode 444 +Setting mode 11 gives mode 444 +Setting mode 10 gives mode 444 +Setting mode 7 gives mode 444 +Setting mode 6 gives mode 444 +Setting mode 5 gives mode 444 +Setting mode 4 gives mode 444 +Setting mode 3 gives mode 444 +Setting mode 2 gives mode 444 +Setting mode 1 gives mode 444 +Setting mode 0 gives mode 444 +bool(true) +done diff --git a/ext/standard/tests/file/chmod_variation2-win32-mb.phpt b/ext/standard/tests/file/chmod_variation2-win32-mb.phpt new file mode 100644 index 0000000000..abfb3e6f4c --- /dev/null +++ b/ext/standard/tests/file/chmod_variation2-win32-mb.phpt @@ -0,0 +1,74 @@ +--TEST-- +chmod() with various paths +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip Windows only chmod test'); +} +?> +--FILE-- +<?php + +define("PERMISSIONS_MASK", 0777); + +$script_directory = dirname(__FILE__); +chdir($script_directory); +$test_dirname = basename(__FILE__, ".php") . "testdir私はガラスを食べられます"; +mkdir($test_dirname); + +$filepath = __FILE__ . ".tmp"; +$filename = basename($filepath); +$fd = fopen($filepath, "w+"); +fclose($fd); + +echo "chmod() on a path containing .. and .\n"; +var_dump(chmod("./$test_dirname/../$filename", 0777)); +var_dump(chmod("./$test_dirname/../$filename", 0755)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); + +echo "\nchmod() on a path containing .. with invalid directories\n"; +var_dump(chmod($filepath, 0777)); +var_dump(chmod("./$test_dirname/bad_dir/../../$filename", 0755)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); + +echo "\nchmod() on a relative path from a different working directory\n"; +chdir($test_dirname); +var_dump(chmod("../$filename", 0777)); +var_dump(chmod("../$filename", 0755)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); +chdir($script_directory); + +echo "\nchmod() on a directory with a trailing /\n"; +var_dump(chmod($test_dirname, 0777)); +var_dump(chmod("$test_dirname/", 0775)); +clearstatcache(); +printf("%o\n", fileperms($filepath) & PERMISSIONS_MASK); + +chdir($script_directory); +rmdir($test_dirname); +unlink($filepath); + +?> +--EXPECTF-- +chmod() on a path containing .. and . +bool(true) +bool(true) +666 + +chmod() on a path containing .. with invalid directories +bool(true) +bool(true) +666 + +chmod() on a relative path from a different working directory +bool(true) +bool(true) +666 + +chmod() on a directory with a trailing / +bool(true) +bool(true) +666 diff --git a/ext/standard/tests/file/copy_variation2-win32-mb.phpt b/ext/standard/tests/file/copy_variation2-win32-mb.phpt new file mode 100644 index 0000000000..e818e294d8 --- /dev/null +++ b/ext/standard/tests/file/copy_variation2-win32-mb.phpt @@ -0,0 +1,218 @@ +--TEST-- +Test copy() function: usage variations - destination file names(special chars) +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip only run on Windows"); +?> +--FILE-- +<?php +/* Prototype: bool copy ( string $source, string $dest ); + Description: Makes a copy of the file source to dest. + Returns TRUE on success or FALSE on failure. +*/ + +/* Test copy() function: In creation of destination file names containing special characters + and checking the existence and size of destination files +*/ + +echo "*** Test copy() function: destination file names containing special characters ***\n"; +$file_path = dirname(__FILE__); +$src_file_name = $file_path."/copy_variation2私はガラスを食べられます.tmp"; +$file_handle = fopen($src_file_name, "w"); +fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) ); +fclose($file_handle); + +/* array of destination file names */ +$dest_files = array( + + /* File names containing special(non-alpha numeric) characters */ + "_copy_variation2.tmp", + "@copy_variation2.tmp", + "#copy_variation2.tmp", + "+copy_variation2.tmp", + "?copy_variation2.tmp", + ">copy_variation2.tmp", + "!copy_variation2.tmp", + "©_variation2.tmp", + "(copy_variation2.tmp", + ":copy_variation2.tmp", + ";copy_variation2.tmp", + "=copy_variation2.tmp", + "[copy_variation2.tmp", + "^copy_variation2.tmp", + "{copy_variation2.tmp", + "|copy_variation2.tmp", + "~copy_variation2.tmp", + "\$copy_variation2.tmp" +); + +echo "Size of the source file before copy operation => "; +var_dump( filesize("$src_file_name") ); +clearstatcache(); + +echo "\n--- Now applying copy() on source file to create copies ---"; +$count = 1; +foreach($dest_files as $dest_file) { + echo "\n-- Iteration $count --\n"; + $dest_file_name = $file_path."/$dest_file"; + + echo "Copy operation => "; + var_dump( copy($src_file_name, $dest_file_name) ); + + echo "Existence of destination file => "; + var_dump( file_exists($dest_file_name) ); + + if( file_exists($dest_file_name) ) { + echo "Destination file name => "; + print($dest_file_name); + echo "\n"; + + echo "Size of source file => "; + var_dump( filesize($src_file_name) ); + clearstatcache(); + + echo "Size of destination file => "; + var_dump( filesize($dest_file_name) ); + clearstatcache(); + + unlink($dest_file_name); + } + $count++; +} + +echo "*** Done ***\n"; +?> + +--CLEAN-- +<?php +unlink(dirname(__FILE__)."/copy_variation2私はガラスを食べられます.tmp"); +?> + +--EXPECTF-- +*** Test copy() function: destination file names containing special characters *** +Size of the source file before copy operation => int(1500) + +--- Now applying copy() on source file to create copies --- +-- Iteration 1 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/_copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 2 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/@copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 3 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/#copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 4 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/+copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 5 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 6 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 7 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/!copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 8 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/©_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 9 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/(copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 10 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 11 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/;copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 12 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/=copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 13 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/[copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 14 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/^copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 15 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/{copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 16 -- +Copy operation => +Warning: copy(%s): %s +bool(false) +Existence of destination file => bool(false) + +-- Iteration 17 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/~copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) + +-- Iteration 18 -- +Copy operation => bool(true) +Existence of destination file => bool(true) +Destination file name => %s/$copy_variation2.tmp +Size of source file => int(1500) +Size of destination file => int(1500) +*** Done *** diff --git a/ext/standard/tests/file/fflush_variation1-win32-mb.phpt b/ext/standard/tests/file/fflush_variation1-win32-mb.phpt new file mode 100644 index 0000000000..80b8dedb65 --- /dev/null +++ b/ext/standard/tests/file/fflush_variation1-win32-mb.phpt @@ -0,0 +1,531 @@ +--TEST-- +Test fflush() function: usage variations - files in different modes +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != "WIN" ) + die("skip.. only for Windows"); +?> + +--FILE-- +<?php +/* Prototype: bool fflush ( resource $handle ); + Description: Flushes the output to a file +*/ + +/* test fflush() with handle to the files opened in different modes */ + +$file_path = dirname(__FILE__); +require $file_path.'/file.inc'; + +echo "*** Testing fflush(): with various types of files ***\n"; +$file_types = array("empty", "numeric", "text", "text_with_new_line", "alphanumeric"); +$file_modes = array("w", "wb", "wt", "w+", "w+b", "w+t", + "a", "ab", "at", "a+","a+b", "a+t", + "x", "xb", "xt", "x+", "x+b", "x+t"); + +$file_name = "$file_path/fflush_variation私はガラスを食べられます1.tmp"; + +$count = 1; + +foreach( $file_types as $type ) { + echo "-- Iteration $count with file containing $type Data--\n"; + foreach( $file_modes as $mode ) { + echo "-- File opened in $mode mode --\n"; + + // creating the file except for x mode + if( substr($mode, 0, 1) != "x" ) { + $file_handle = fopen($file_name, "w"); + if($file_handle == false) + exit("Error:failed to open file $file_name"); + + // filling the file some data if mode is append mode + if( substr($mode, 0, 1) == "a") + fill_file($file_handle, $type, 10); + fclose($file_handle); + } + + // opening the file in different modes + $file_handle = fopen($file_name, $mode); + if($file_handle == false) + exit("Error:failed to open file $file_name"); + + // writing data to the file + var_dump( fill_file($file_handle, $type, 50) ); + var_dump( fflush($file_handle) ); + fclose($file_handle); + + // reading the contents of the file after flushing + var_dump( readfile($file_name) ); + unlink($file_name); + } + $count++; +} + +echo "\n*** Done ***"; +?> +--EXPECTF-- +*** Testing fflush(): with various types of files *** +-- Iteration 1 with file containing empty Data-- +-- File opened in w mode -- +bool(true) +bool(true) +int(0) +-- File opened in wb mode -- +bool(true) +bool(true) +int(0) +-- File opened in wt mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in w+t mode -- +bool(true) +bool(true) +int(0) +-- File opened in a mode -- +bool(true) +bool(true) +int(0) +-- File opened in ab mode -- +bool(true) +bool(true) +int(0) +-- File opened in at mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in a+t mode -- +bool(true) +bool(true) +int(0) +-- File opened in x mode -- +bool(true) +bool(true) +int(0) +-- File opened in xb mode -- +bool(true) +bool(true) +int(0) +-- File opened in xt mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+ mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+b mode -- +bool(true) +bool(true) +int(0) +-- File opened in x+t mode -- +bool(true) +bool(true) +int(0) +-- Iteration 2 with file containing numeric Data-- +-- File opened in w mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in a mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in at mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +222222222222222222222222222222222222222222222222222222222222int(60) +-- File opened in x mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +22222222222222222222222222222222222222222222222222int(50) +-- Iteration 3 with file containing text Data-- +-- File opened in w mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in a mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in at mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +text text text text text text text text text text text text int(60) +-- File opened in x mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +text text text text text text text text text text int(50) +-- Iteration 4 with file containing text_with_new_line Data-- +-- File opened in w mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in wb mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in wt mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- File opened in w+ mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- File opened in a mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in ab mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in at mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(65) +-- File opened in a+ mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +line +line line +line of text +line +line of text +line +line of tint(65) +-- File opened in x mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in xb mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in xt mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- File opened in x+ mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +line +line of text +line +line of text +line +line of tint(55) +-- Iteration 5 with file containing alphanumeric Data-- +-- File opened in w mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in wb mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in wt mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in w+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in a mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in ab mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in at mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in a+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(60) +-- File opened in x mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in xb mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in xt mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+ mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+b mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) +-- File opened in x+t mode -- +bool(true) +bool(true) +ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 int(50) + +*** Done *** + diff --git a/ext/standard/tests/file/fgets_variation4-win32-mb.phpt b/ext/standard/tests/file/fgets_variation4-win32-mb.phpt new file mode 100644 index 0000000000..b5786df58c --- /dev/null +++ b/ext/standard/tests/file/fgets_variation4-win32-mb.phpt @@ -0,0 +1,574 @@ +--TEST-- +Test fgets() function : usage variations - seek n read +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only valid for Windows'); +} +?> +--FILE-- +<?php +/* + Prototype: string fgets ( resource $handle [, int $length] ); + Description: Gets a line from file pointer +*/ + +// include the file.inc for common test funcitons +include ("file.inc"); + +$file_modes = array("w+", "w+b", "w+t", + "a+", "a+b", "a+t", + "x+", "x+b", "x+t"); + +$file_content_types = array("numeric", "text", "text_with_new_line", "alphanumeric"); + +echo "*** Testing fgets() : usage variations ***\n"; + +$filename = dirname(__FILE__)."/fgets_variation4私はガラスを食べられます.tmp"; + +foreach($file_modes as $file_mode) { + echo "\n-- Testing fgets() with file opened using mode $file_mode --\n"; + + foreach($file_content_types as $file_content_type) { + echo "-- File content type : $file_content_type --\n"; + + /* create files with $file_content_type */ + $file_handle = fopen($filename, $file_mode); + $data = fill_file($file_handle, $file_content_type, 50); + + if ( !$file_handle ) { + echo "Error: failed to open file $filename!"; + exit(); + } + + echo "-- fgets() with location set by fseek() with default length --\n"; + var_dump( fseek($file_handle, 5, SEEK_SET) ); + var_dump( ftell($file_handle) ); + var_dump( fgets($file_handle ) ); + var_dump( ftell($file_handle) ); // ensure the file pointer position + var_dump( feof($file_handle) ); // enusre if eof set + + echo "-- fgets() with location set by fseek() with length = 20 --\n"; + var_dump( fseek($file_handle, 25, SEEK_SET) ); + var_dump( ftell($file_handle) ); + var_dump( fgets($file_handle, 20 ) ); // expected 19 chars + var_dump( ftell($file_handle) ); // ensure the file pointer position + var_dump( feof($file_handle) ); // enusre if eof set + + //close file + fclose($file_handle); + + // delete file + delete_file($filename); + } // file_content_type loop +} // file_mode loop + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fgets() : usage variations *** + +-- Testing fgets() with file opened using mode w+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode w+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode a+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+ -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+b -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(13) "line of text +" +int(18) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(11) "ne of text +" +int(36) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) + +-- Testing fgets() with file opened using mode x+t -- +-- File content type : numeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "222222222222222222222222222222222222222222222" +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "2222222222222222222" +int(44) +bool(false) +-- File content type : text -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "text text text text text text text text text " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "text text text text" +int(44) +bool(false) +-- File content type : text_with_new_line -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(1) " +" +int(6) +bool(false) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(12) "ine of text +" +int(37) +bool(false) +-- File content type : alphanumeric -- +-- fgets() with location set by fseek() with default length -- +int(0) +int(5) +string(45) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 " +int(50) +bool(true) +-- fgets() with location set by fseek() with length = 20 -- +int(0) +int(25) +string(19) "ab12 ab12 ab12 ab12" +int(44) +bool(false) +Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt new file mode 100644 index 0000000000..7edf7bcbd1 --- /dev/null +++ b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt @@ -0,0 +1,216 @@ +--TEST-- +Test fgetss() function : Basic functionality - read/write modes +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only on Windows'); +} +?> +--FILE-- +<?php +/* + Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); + Description: Gets line from file pointer and strip HTML tags +*/ + +/* try fgetss on files which are opened in read/write modes + w+, w+b, w+t, + a+, a+b, a+t, + x+, x+b, x+t +*/ + + +echo "*** Testing fgetss() : basic operations ***\n"; + +/* string with html and php tags */ +$string_with_tags = <<<EOT +<test>Testing fgetss() functions</test> +<?php echo "this string is within php tag"; ?> {;}<{> this +is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> +<html> html </html> <?php echo "php"; ?> +EOT; +if(substr(PHP_OS, 0, 3) == "WIN") { + $string_with_tags = str_replace("\r",'', $string_with_tags); +} +$filename = dirname(__FILE__)."/fgetss_basic2私はガラスを食べられます.tmp"; + +/* try reading the file opened in different modes of reading */ +$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); + +for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { + echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; + + /* create an empty file and write the strings with tags */ + $file_handle = fopen($filename, $file_modes[$mode_counter]); + fwrite($file_handle,$string_with_tags); //writing data to the file + if(!$file_handle) { + echo "Error: failed to open file $filename!\n"; + exit(); + } + + // rewind the file pointer to beginning of the file + var_dump( filesize($filename) ); + var_dump( rewind($file_handle) ); + var_dump( ftell($file_handle) ); + var_dump( feof($file_handle) ); + + /* read entire file and strip tags */ + echo "-- fgetss() with default length, file pointer at 0 --\n"; + var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file + var_dump( ftell($file_handle) ); + var_dump( feof($file_handle) ); + + rewind($file_handle); + /* read entire file and strip tags tags */ + echo "-- fgets() with length = 30, file pointer at 0 --\n"; + var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file + var_dump( ftell($file_handle) ); // checking file pointer position initially + var_dump( feof($file_handle) ); // confirm file pointer is not at eof + + // close the file + fclose($file_handle); + + // delete the file + unlink($filename); +} // end of for - mode_counter + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fgetss() : basic operations *** + +-- Testing fgetss() with file opened using w+ mode -- +int(192) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using w+b mode -- +int(192) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using w+t mode -- +int(195) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using a+ mode -- +int(192) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using a+b mode -- +int(192) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using a+t mode -- +int(195) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using x+ mode -- +int(192) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using x+b mode -- +int(192) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) + +-- Testing fgetss() with file opened using x+t mode -- +int(195) +bool(true) +int(0) +bool(false) +-- fgetss() with default length, file pointer at 0 -- +string(27) "Testing fgetss() functions +" +int(40) +bool(false) +-- fgets() with length = 30, file pointer at 0 -- +string(23) "Testing fgetss() functi" +int(29) +bool(false) +Done diff --git a/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt b/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt new file mode 100644 index 0000000000..cc8eb40f49 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test file_get_contents() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip Only run on Windows"); +?> +--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() : variation ***\n"; +$mainDir = "fileGetContentsVar7私はガラスを食べられます.dir"; +$subDir = "fileGetContentsVar7Sub私はガラスを食べられます"; +$absMainDir = dirname(__FILE__)."\\".$mainDir; +mkdir($absMainDir); +$absSubDir = $absMainDir."\\".$subDir; +mkdir($absSubDir); + +$old_dir_path = getcwd(); +chdir(dirname(__FILE__)); +$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3); + +$allDirs = array( + // absolute paths + "$absSubDir\\", + "$absSubDir\\..\\".$subDir, + "$absSubDir\\\\..\\.\\".$subDir, + "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir, + "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir, + "$absSubDir\\BADDIR", + + // relative paths + $mainDir."\\".$subDir, + $mainDir."\\\\".$subDir, + $mainDir."\\\\\\".$subDir, + ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir, + "BADDIR", + + // unixifed path + $unixifiedDir, +); + +$filename = 'FileGetContentsVar7.tmp'; +$absFile = $absSubDir.'/'.$filename; +$h = fopen($absFile,"w"); +fwrite($h, "contents read"); +fclose($h); + +for($i = 0; $i<count($allDirs); $i++) { + $j = $i+1; + $dir = $allDirs[$i]; + echo "\n-- Iteration $j --\n"; + var_dump(file_get_contents($dir."\\".$filename)); +} + +unlink($absFile); +chdir($old_dir_path); +rmdir($absSubDir); +rmdir($absMainDir); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Testing file_get_contents() : variation *** + +-- Iteration 1 -- +string(%d) "contents read" + +-- Iteration 2 -- +string(%d) "contents read" + +-- Iteration 3 -- +string(%d) "contents read" + +-- Iteration 4 -- +string(%d) "contents read" + +-- Iteration 5 -- + +Warning: file_get_contents(%sfileGetContentsVar7私はガラスを食べられます.dir\fileGetContentsVar7Sub私はガラスを食べられます\..\\\fileGetContentsVar7Sub私はガラスを食べられます\\..\\..\fileGetContentsVar7Sub私はガラスを食べられます\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: file_get_contents(%sfileGetContentsVar7私はガラスを食べられます.dir\fileGetContentsVar7Sub私はガラスを食べられます\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 7 -- +string(%d) "contents read" + +-- Iteration 8 -- +string(%d) "contents read" + +-- Iteration 9 -- +string(%d) "contents read" + +-- Iteration 10 -- +string(%d) "contents read" + +-- Iteration 11 -- + +Warning: file_get_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 12 -- +string(%d) "contents read" + +*** Done *** diff --git a/ext/standard/tests/file/file_variation5-win32-mb.phpt b/ext/standard/tests/file/file_variation5-win32-mb.phpt new file mode 100644 index 0000000000..783efd6624 --- /dev/null +++ b/ext/standard/tests/file/file_variation5-win32-mb.phpt @@ -0,0 +1,74 @@ +--TEST-- +file() with various paths +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip windows only test'); +} +?> +--FILE-- +<?php + +$script_directory = dirname(__FILE__); +chdir($script_directory); +$test_dirname = basename(__FILE__, ".php") . "私はガラスを食べられますtestdir"; +mkdir($test_dirname); + +$filepath = __FILE__ . ".tmp"; +$filename = basename($filepath); +$fd = fopen($filepath, "w+"); +fwrite($fd, "Line 1\nLine 2\nLine 3"); +fclose($fd); + +echo "file() on a path containing .. and .\n"; +var_dump(file("./$test_dirname/../$filename")); + +echo "\nfile() on a path containing .. with invalid directories\n"; +var_dump(file("./$test_dirname/bad_dir/../../$filename")); + +echo "\nfile() on a relative path from a different working directory\n"; +chdir($test_dirname); +var_dump(file("../$filename")); +chdir($script_directory); + +chdir($script_directory); +unlink($filepath); +rmdir($test_dirname); + +?> +--EXPECT-- +file() on a path containing .. and . +array(3) { + [0]=> + string(7) "Line 1 +" + [1]=> + string(7) "Line 2 +" + [2]=> + string(6) "Line 3" +} + +file() on a path containing .. with invalid directories +array(3) { + [0]=> + string(7) "Line 1 +" + [1]=> + string(7) "Line 2 +" + [2]=> + string(6) "Line 3" +} + +file() on a relative path from a different working directory +array(3) { + [0]=> + string(7) "Line 1 +" + [1]=> + string(7) "Line 2 +" + [2]=> + string(6) "Line 3" +} diff --git a/ext/standard/tests/file/filesize_variation1-win32-mb.phpt b/ext/standard/tests/file/filesize_variation1-win32-mb.phpt new file mode 100644 index 0000000000..14975feb49 --- /dev/null +++ b/ext/standard/tests/file/filesize_variation1-win32-mb.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test filesize() function: usage variations - size of files +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only valid for Windows'); +} +--FILE-- +<?php +/* + Prototype : int filesize ( string $filename ); + Description : Returns the size of the file in bytes, or FALSE + (and generates an error of level E_WARNING) in case of an error. +*/ + +$file_path = dirname(__FILE__); +require($file_path."/file.inc"); + +echo "*** Testing filesize(): usage variations ***\n"; + +echo "*** Checking filesize() with different size of files ***\n"; +for($size = 1; $size <10000; $size = $size+1000) +{ + create_files($file_path, 1, "numeric", 0755, $size, "w", "私はガラスを食べられますfilesize_variation"); + var_dump( filesize( $file_path."/私はガラスを食べられますfilesize_variation1.tmp") ); + clearstatcache(); + delete_files($file_path, 1, "私はガラスを食べられますfilesize_variation"); +} + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing filesize(): usage variations *** +*** Checking filesize() with different size of files *** +int(1024) +int(1025024) +int(2049024) +int(3073024) +int(4097024) +int(5121024) +int(6145024) +int(7169024) +int(8193024) +int(9217024) +*** Done *** diff --git a/ext/standard/tests/file/fread_variation3-win32-mb.phpt b/ext/standard/tests/file/fread_variation3-win32-mb.phpt new file mode 100644 index 0000000000..a39842ce5b --- /dev/null +++ b/ext/standard/tests/file/fread_variation3-win32-mb.phpt @@ -0,0 +1,498 @@ +--TEST-- +Test fread() function : usage variations - read beyond file size, read/write mode +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip...only valid for Windows'); +} +?> +--FILE-- +<?php +/* + Prototype: string fread ( resource $handle [, int $length] ); + Description: reads up to length bytes from the file pointer referenced by handle. + Reading stops when up to length bytes have been read, EOF (end of file) is + reached, (for network streams) when a packet becomes available, or (after + opening userspace stream) when 8192 bytes have been read whichever comes first. +*/ + +// include the file.inc for common functions for test +include ("file.inc"); + +/* Function : function check_read(resource $file_handle, int $read_size, int $expect_size) + Description : Read data from file of size $read_size and verifies that $expected_size no. of + bytes are read. + $file_handle : File Handle + $read_size : No. of bytes to be read. + $expect_size : Expected data length + Returns: returns the data read +*/ +function check_read($file_handle, $read_size, $expect_size) { + // print file pointer position before read + var_dump( ftell($file_handle) ); + var_dump( feof($file_handle) ); + + // read the data of size $read_size + echo "Reading $read_size bytes from file, expecting $expect_size bytes ... "; + $data_from_file = fread($file_handle, $read_size); + + // check if data read is of expected size + if ( strlen($data_from_file) == $expect_size) + echo "OK\n"; + else + echo "Error reading file, total number of bytes read = ".strlen($data_from_file)."\n"; + + // file pointer position after read + var_dump( ftell($file_handle) ); + // check if file pointer at eof() + var_dump( feof($file_handle) ); + + return $data_from_file; +} + +echo "*** Testing fread() : usage variations ***\n"; + +$file_modes = array("a+","a+b","a+t", + "w+","w+b","w+t", + "x+","x+b","x+t"); + +$file_content_types = array("numeric","text","text_with_new_line"); + +foreach($file_content_types as $file_content_type) { + echo "\n-- Testing fread() with file having content of type ". $file_content_type ." --\n"; + + /* open the file using $files_modes and perform fread() on it */ + foreach($file_modes as $file_mode) { + if(!strstr($file_mode,"x")){ + /* create files with $file_content_type */ + create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "私はガラスを食べられますfread_variation", 3); + } + + $filename = dirname(__FILE__)."/私はガラスを食べられますfread_variation3.tmp"; // this is name of the file created by create_files() + echo "-- File opened in mode ".$file_mode." --\n"; + $file_handle = fopen($filename, $file_mode); + if (!$file_handle) { + echo "Error: failed to fopen() file: $filename!"; + exit(); + } + + if(strstr($file_mode,"w") || strstr($file_mode,"x") ) { + $data_to_be_written=""; + fill_file($file_handle, $file_content_type, 1024); + } + + rewind($file_handle); + + // read file by giving size more than its size + echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n"; + rewind($file_handle); + $data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 1024) ); + if ( $data_from_file != false) + var_dump( md5($data_from_file) ); + + rewind($file_handle); + echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n"; + // try fread when file pointer at end + fseek($file_handle, 0, SEEK_END); + //reading file when file pointer at end + $data_from_file = check_read($file_handle, 10, 0); + if ( $data_from_file != false) + var_dump( md5($data_from_file) ); + + // now close the file + fclose($file_handle); + + // delete the file created + delete_file($filename); // delete file + } // end of inner foreach loop +}// end of outer foreach loop + +echo"Done\n"; +?> +--EXPECTF-- +*** Testing fread() : usage variations *** + +-- Testing fread() with file having content of type numeric -- +-- File opened in mode a+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) + +-- Testing fread() with file having content of type text -- +-- File opened in mode a+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) + +-- Testing fread() with file having content of type text_with_new_line -- +-- File opened in mode a+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1137) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1137) +bool(true) +-- File opened in mode x+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1137) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1137) +bool(true) +Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt new file mode 100644 index 0000000000..ab983a2680 --- /dev/null +++ b/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32-mb.phpt @@ -0,0 +1,464 @@ +--TEST-- +Test fseek(), ftell() & rewind() functions : basic functionality - all w and x modes +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != "WIN" ) + die("skip.. only valid for Windows"); +?> + +--FILE-- +<?php +/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] ); + Description: Seeks on a file pointer + + Prototype: bool rewind ( resource $handle ); + Description: Rewind the position of a file pointer + + Prototype: int ftell ( resource $handle ); + Description: Tells file pointer read/write position +*/ + +// include the file.inc for common functions for test +include ("file.inc"); + +/* Testing fseek(),ftell(),rewind() functions on all write and create with write modes */ + +echo "*** Testing fseek(), ftell(), rewind() : basic operations ***\n"; +$file_modes = array( "w","wb","wt","w+","w+b","w+t", + "x","xb","xt","x+","x+b","x+t"); + +$file_content_types = array("text_with_new_line","alphanumeric"); + +$whence_set = array(SEEK_SET,SEEK_CUR,SEEK_END); +$whence_string = array("SEEK_SET", "SEEK_CUR", "SEEK_END"); + +$filename = dirname(__FILE__)."/fseek_ftell_rewind_basic2私はガラスを食べられます.tmp"; // this is name of the file created by create_files() + +foreach($file_content_types as $file_content_type){ + echo "\n-- File having data of type ". $file_content_type ." --\n"; + + /* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */ + foreach($file_modes as $file_mode) { + echo "-- File opened in mode ".$file_mode." --\n"; + + $file_handle = fopen($filename, $file_mode); + if (!$file_handle) { + echo "Error: failed to fopen() file: $filename!"; + exit(); + } + $data_to_be_written=""; + fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512 + $data_to_be_written = $data_to_be_written; + fwrite($file_handle,(binary)$data_to_be_written); + + // set file pointer to 0 + var_dump( rewind($file_handle) ); // set to beginning of file + var_dump( ftell($file_handle) ); + + foreach($whence_set as $whence){ + echo "-- Testing fseek() with whence = $whence_string[$whence] --\n"; + var_dump( fseek($file_handle, 10, $whence) ); //expecting int(0) + var_dump( ftell($file_handle) ); // confirm the file pointer position + var_dump( feof($file_handle) ); //ensure that file pointer is not at end + } //end of whence loop + + //close the file and check the size + fclose($file_handle); + var_dump( filesize($filename) ); + + delete_file($filename); // delete file with name + } //end of file_mode loop +} //end of File content type loop +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fseek(), ftell(), rewind() : basic operations *** + +-- File having data of type text_with_new_line -- +-- File opened in mode w -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode wb -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode wt -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(579) +bool(false) +int(569) +-- File opened in mode w+ -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode w+b -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode w+t -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(579) +bool(false) +int(569) +-- File opened in mode x -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode xb -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode xt -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(579) +bool(false) +int(569) +-- File opened in mode x+ -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode x+b -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode x+t -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(579) +bool(false) +int(569) + +-- File having data of type alphanumeric -- +-- File opened in mode w -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode wb -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode wt -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode w+ -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode w+b -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode w+t -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode x -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode xb -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode xt -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode x+ -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode x+b -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +-- File opened in mode x+t -- +bool(true) +int(0) +-- Testing fseek() with whence = SEEK_SET -- +int(0) +int(10) +bool(false) +-- Testing fseek() with whence = SEEK_CUR -- +int(0) +int(20) +bool(false) +-- Testing fseek() with whence = SEEK_END -- +int(0) +int(522) +bool(false) +int(512) +Done diff --git a/ext/standard/tests/file/ftruncate_variation1-win32-mb.phpt b/ext/standard/tests/file/ftruncate_variation1-win32-mb.phpt new file mode 100644 index 0000000000..36994cb182 --- /dev/null +++ b/ext/standard/tests/file/ftruncate_variation1-win32-mb.phpt @@ -0,0 +1,461 @@ +--TEST-- +Test ftruncate() function : usage variations - truncate filesize to zero +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only valid for Windows'); +} +?> +--FILE-- +<?php +/* + Prototype: bool ftruncate ( resource $handle, int $size ); + Description: Truncates a file to a given length +*/ + +// include common file related test functions +include ("file.inc"); + +echo "*** Testing ftruncate() : usage variations ***\n"; + +/* test ftruncate with file opened in different modes */ +$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t", + "w", "wb", "wt", "w+", "w+b", "w+t", + "x", "xb", "xt", "x+", "x+b", "x+t", + "a", "ab", "at", "a+", "a+b", "a+t"); + +$file_content_types = array("numeric","text_with_new_line"); + +foreach($file_content_types as $file_content_type) { + echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n"; + + for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { + echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n"; + + // create 1 file with some contents + $filename = dirname(__FILE__)."/ftruncate_variation1私はガラスを食べられます1.tmp"; + if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) { + // fopen the file using the $file_modes + $file_handle = fopen($filename, $file_modes[$mode_counter]); + fill_file($file_handle, $file_content_type, 1024); + } else { + create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "ftruncate_variation1私はガラスを食べられます"); + // fopen the file using the $file_modes + $file_handle = fopen($filename, $file_modes[$mode_counter]); + } + if (!$file_handle) { + echo "Error: failed to open file $filename!\n"; + exit(); + } + + rewind($file_handle); // file pointer to 0 + + /* truncate it to size 0 */ + echo "-- Testing ftruncate(): truncate file to size = 0 --\n"; + $new_size = 0; + var_dump( filesize($filename) ); // check the current file size + var_dump( ftell($file_handle) ); + var_dump( ftruncate($file_handle, $new_size) ); // truncate it + var_dump( ftell($file_handle) ); + var_dump( feof($file_handle) ); + fclose($file_handle); + clearstatcache(); // clear previous size value in cache + var_dump( filesize($filename) ); // check the file size, should be 0 + + //delete all files created + delete_file($filename); + } //end of inner for loop +}//end of outer foreach loop +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ftruncate() : usage variations *** + +-- Testing ftruncate() with file having data of type numeric -- +-- Testing ftruncate() with file opening using r mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(false) +int(0) +bool(false) +int(1024) +-- Testing ftruncate() with file opening using rb mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(false) +int(0) +bool(false) +int(1024) +-- Testing ftruncate() with file opening using rt mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(false) +int(0) +bool(false) +int(1024) +-- Testing ftruncate() with file opening using r+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using r+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using r+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using wb mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using wt mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using xb mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using xt mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using ab mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using at mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) + +-- Testing ftruncate() with file having data of type text_with_new_line -- +-- Testing ftruncate() with file opening using r mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(false) +int(0) +bool(false) +int(1024) +-- Testing ftruncate() with file opening using rb mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(false) +int(0) +bool(false) +int(1024) +-- Testing ftruncate() with file opening using rt mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(false) +int(0) +bool(false) +int(1024) +-- Testing ftruncate() with file opening using r+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using r+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using r+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using wb mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using wt mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1137) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using w+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1137) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using xb mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using xt mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1137) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using x+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1137) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using ab mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using at mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a+ mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a+b mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +-- Testing ftruncate() with file opening using a+t mode -- +-- Testing ftruncate(): truncate file to size = 0 -- +int(1024) +int(0) +bool(true) +int(0) +bool(false) +int(0) +Done diff --git a/ext/standard/tests/file/fwrite_basic-win32-mb.phpt b/ext/standard/tests/file/fwrite_basic-win32-mb.phpt new file mode 100644 index 0000000000..a65d81efb8 --- /dev/null +++ b/ext/standard/tests/file/fwrite_basic-win32-mb.phpt @@ -0,0 +1,424 @@ +--TEST-- +Test fwrite() function : basic functionality +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip...Valid for Windows only'); +} +?> +--FILE-- +<?php +/* + Prototype: int fwrite ( resource $handle,string string, [, int $length] ); + Description: fwrite() writes the contents of string to the file stream pointed to by handle. + If the length arquement is given,writing will stop after length bytes have been + written or the end of string reached, whichever comes first. + fwrite() returns the number of bytes written or FALSE on error +*/ + +// include the file.inc for Function: function delete_file($filename) +include ("file.inc"); + +echo "*** Testing fwrite() basic operations ***\n"; +/* + test fwrite with file opened in mode : w,wb,wt,w+,w+b,w+t + File containing data of type, numeric, text, text_with_new_line, alphanumeric +*/ +$file_modes = array( "w", "wb", "wt", "w+", "w+b", "w+t"); +$file_content_types = array("numeric","text","text_with_new_line","alphanumeric"); + +foreach($file_content_types as $file_content_type) { + echo "\n-- Testing fwrite() with file having data of type ". $file_content_type ." --\n"; + $filename = dirname(__FILE__)."/fwrite_basic-win32私はガラスを食べられます.tmp"; // this is name of the file + + for($inner_loop_counter = 0; + $inner_loop_counter < count($file_modes); + $inner_loop_counter++) { + echo "-- File opened in mode : " . $file_modes[$inner_loop_counter]. " --\n"; + /* open the file using $files_modes and perform fwrite() on it */ + $file_handle = fopen($filename, $file_modes[$inner_loop_counter]); + if (!$file_handle) { + echo "Error: failed to fopen() file: $filename!"; + exit(); + } + $data_to_be_written=""; + fill_buffer($data_to_be_written, $file_content_type, 1024); //get the data of size 1024 + + /* Write the data in to the file, verify the write by checking file pointer position, + eof position, and data. */ + // writing 100 bytes + var_dump( ftell($file_handle) ); // Expecting 0 + var_dump( fwrite($file_handle, $data_to_be_written, 100)); //int(100) + var_dump( feof($file_handle) ); // expected : false + var_dump( ftell($file_handle) ); //expected: 100 + + // trying to write more than the available data, available 1024 bytes but trying 2048 + var_dump( fwrite($file_handle, $data_to_be_written, 2048)); //int(1024) + var_dump( feof($file_handle) ); // expected : false + var_dump( ftell($file_handle) ); // expected: 1124 + + // fwrite() without length parameter + var_dump( fwrite($file_handle, $data_to_be_written)); //int(1024) + var_dump( ftell($file_handle) ); // expected: 2148 + var_dump( feof($file_handle) ); // expected: false + + // close the file, get the size and content of the file. + var_dump( fclose($file_handle) ); //expected : true + clearstatcache();//clears file status cache + var_dump( filesize($filename) ); // expected: 2148 + var_dump(md5(file_get_contents($filename))); // hash the output + + } // end of inner for loop + + // delete the file created : fwrite_basic.tmp + delete_file($filename); +} // end of outer foreach loop +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fwrite() basic operations *** + +-- Testing fwrite() with file having data of type numeric -- +-- File opened in mode : w -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "04db34906fe2c56dcfbd649b7d916974" +-- File opened in mode : wb -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "04db34906fe2c56dcfbd649b7d916974" +-- File opened in mode : wt -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "04db34906fe2c56dcfbd649b7d916974" +-- File opened in mode : w+ -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "04db34906fe2c56dcfbd649b7d916974" +-- File opened in mode : w+b -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "04db34906fe2c56dcfbd649b7d916974" +-- File opened in mode : w+t -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "04db34906fe2c56dcfbd649b7d916974" + +-- Testing fwrite() with file having data of type text -- +-- File opened in mode : w -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "9c08ac77b7a93a84dd0b055900165e84" +-- File opened in mode : wb -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "9c08ac77b7a93a84dd0b055900165e84" +-- File opened in mode : wt -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "9c08ac77b7a93a84dd0b055900165e84" +-- File opened in mode : w+ -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "9c08ac77b7a93a84dd0b055900165e84" +-- File opened in mode : w+b -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "9c08ac77b7a93a84dd0b055900165e84" +-- File opened in mode : w+t -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "9c08ac77b7a93a84dd0b055900165e84" + +-- Testing fwrite() with file having data of type text_with_new_line -- +-- File opened in mode : w -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "56a1963cc292d7f8245219116d9eca40" +-- File opened in mode : wb -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "56a1963cc292d7f8245219116d9eca40" +-- File opened in mode : wt -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2385) +string(32) "62b09dac6d598bf54de7b02e0e68e5c7" +-- File opened in mode : w+ -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "56a1963cc292d7f8245219116d9eca40" +-- File opened in mode : w+b -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "56a1963cc292d7f8245219116d9eca40" +-- File opened in mode : w+t -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2385) +string(32) "62b09dac6d598bf54de7b02e0e68e5c7" + +-- Testing fwrite() with file having data of type alphanumeric -- +-- File opened in mode : w -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "719e3329c19218c12d232f2ee81e100f" +-- File opened in mode : wb -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "719e3329c19218c12d232f2ee81e100f" +-- File opened in mode : wt -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "719e3329c19218c12d232f2ee81e100f" +-- File opened in mode : w+ -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "719e3329c19218c12d232f2ee81e100f" +-- File opened in mode : w+b -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "719e3329c19218c12d232f2ee81e100f" +-- File opened in mode : w+t -- +int(0) +int(100) +bool(false) +int(100) +int(1024) +bool(false) +int(1124) +int(1024) +int(2148) +bool(false) +bool(true) +int(2148) +string(32) "719e3329c19218c12d232f2ee81e100f" +Done
\ No newline at end of file diff --git a/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt b/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt new file mode 100644 index 0000000000..e43a04dfd6 --- /dev/null +++ b/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test fwrite() function : usage variations - r, rb & rt modes +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip...Not valid for Linux'); +} +?> +--FILE-- +<?php +/* + Prototype: int fwrite ( resource $handle,string string, [, int $length] ); + Description: fwrite() writes the contents of string to the file stream pointed to by handle. + If the length arquement is given,writing will stop after length bytes have been + written or the end of string reached, whichever comes first. + fwrite() returns the number of bytes written or FALSE on error +*/ + + +echo "*** Testing fwrite() various operations ***\n"; + +// include the file.inc for Function: function delete_file($filename) +include ("file.inc"); + +/* + Test fwrite with file opened in mode : r,rb,rt + File having content of type numeric, text,text_with_new_line & alphanumeric +*/ + +$file_modes = array("r","rb","rt"); +$file_content_types = array("numeric","text","text_with_new_line","alphanumeric"); + + +foreach($file_content_types as $file_content_type) { + echo "\n-- Testing fwrite() with file having content of type ". $file_content_type ." --\n"; + + /* open the file using $files_modes and perform fwrite() on it */ + foreach($file_modes as $file_mode) { + echo "-- Opening file in $file_mode --\n"; + + // create the temp file with content of type $file_content_type + $filename = dirname(__FILE__)."/fwrite_variation1私はガラスを食べられます1.tmp"; // this is name of the file + create_files ( dirname(__FILE__), 1, $file_content_type, 0755, 1, "w", "fwrite_variation1私はガラスを食べられます"); + + $file_handle = fopen($filename, $file_mode); + if(!$file_handle) { + echo "Error: failed to fopen() file: $filename!"; + exit(); + } + + $data_to_be_written=""; + fill_buffer($data_to_be_written,$file_content_type,1024); //get the data of size 1024 + + /* Write the data into the file, verify it by checking the file pointer position, eof position, + filesize & by displaying the content */ + + var_dump( ftell($file_handle) ); // expected: 0 + var_dump( fwrite($file_handle, $data_to_be_written )); + var_dump( ftell($file_handle) ); // expected: 0 + var_dump( feof($file_handle) ); // expected: false + + // move the file pointer to end of the file and try fwrite() + fseek($file_handle, SEEK_END, 0); + var_dump( ftell($file_handle) ); // expecting 1024 + var_dump( fwrite($file_handle, $data_to_be_written) ); // fwrite to fail + var_dump( ftell($file_handle) ); //check that file pointer points at eof, expected: 1024 + var_dump( feof($file_handle) ); // ensure that feof() points to eof, expected: true + + // ensure that file content/size didn't change. + var_dump( fclose($file_handle) ); + clearstatcache();//clears file status cache + var_dump( filesize($filename) ); // expected: 1024 + var_dump(md5(file_get_contents($filename))); // hash the output + delete_file($filename); // delete file with name fwrite_variation1.tmp + + } // end of inner foreach loop +} // end of outer foreach loop + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing fwrite() various operations *** + +-- Testing fwrite() with file having content of type numeric -- +-- Opening file in r -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Opening file in rb -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Opening file in rt -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" + +-- Testing fwrite() with file having content of type text -- +-- Opening file in r -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Opening file in rb -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Opening file in rt -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "e486000c4c8452774f746a27658d87fa" + +-- Testing fwrite() with file having content of type text_with_new_line -- +-- Opening file in r -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Opening file in rb -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Opening file in rt -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "b09c8026a64a88d36d4c2f17983964bb" + +-- Testing fwrite() with file having content of type alphanumeric -- +-- Opening file in r -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Opening file in rb -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Opening file in rt -- +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(2) +bool(false) +bool(true) +int(1024) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +Done diff --git a/ext/standard/tests/file/glob_error_002-win32-mb.phpt b/ext/standard/tests/file/glob_error_002-win32-mb.phpt new file mode 100644 index 0000000000..a61efd108c --- /dev/null +++ b/ext/standard/tests/file/glob_error_002-win32-mb.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test glob() function: error condition - pattern too long. +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip Only valid for Windows"); +?> +--FILE-- +<?php +/* Prototype: array glob ( string $pattern [, int $flags] ); + Description: Find pathnames matching a pattern +*/ + +echo "*** Testing glob() : error condition - pattern too long. ***\n"; + +var_dump(glob(str_repeat('x', 3000))); + +echo "Done"; +?> +--EXPECTF-- +*** Testing glob() : error condition - pattern too long. *** + +Warning: glob(): Pattern exceeds the maximum allowed length of %d characters in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt new file mode 100644 index 0000000000..cba2e2b343 --- /dev/null +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -0,0 +1,466 @@ +--TEST-- +Test glob() function: usage variations +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array glob ( string $pattern [, int $flags] ); + Description: Find pathnames matching a pattern +*/ + +echo "*** Testing glob() : usage variations ***\n"; + +$file_path = dirname(__FILE__); + +// temp dir created +//mkdir("$file_path/glob_variation"); +mkdir("$file_path/glob_variation私はガラスを食べられます"); +mkdir("$file_path/glob_variation私はガラスを食べられます/wonder"); + +// temp files created +$fp = fopen("$file_path/glob_variation私はガラスを食べられます/wonder12345", "w"); +fclose($fp); +$fp = fopen("$file_path/glob_variation私はガラスを食べられます/wonder;123456", "w"); +fclose($fp); + +$patterns = array ( + "$file_path/glob_variation私はガラスを食べられます/*der*", + "$file_path/glob_variation私はガラスを食べられます/?onder*", + "$file_path/glob_variation私はガラスを食べられます/w*der?*", + "$file_path/glob_variation私はガラスを食べられます/*der5", + "$file_path/glob_variation私はガラスを食べられます/??onder*", + "$file_path/glob_variation私はガラスを食べられます/***der***", + "$file_path/glob_variation私はガラスを食べられます/++onder*", + "$file_path/glob_variation私はガラスを食べられます/WONDER5\0", + '$file_path/glob_variation私はガラスを食べられます/wonder5', + "$file_path/glob_variation私はガラスを食べられます/?wonder?", + "$file_path/glob_variation私はガラスを食べられます/wonder?", + TRUE // boolean true +); +$counter = 1; +/* loop through $patterns to match each $pattern with the files created + using glob() */ +foreach($patterns as $pattern) { + echo "\n-- Iteration $counter --\n"; + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + $counter++; +} + +echo "\n*** Testing glob() with pattern within braces ***\n"; +var_dump( glob("$file_path/glob_variation私はガラスを食べられます/*{5}", GLOB_BRACE) ); + +// delete temp files and dir +unlink("$file_path/glob_variation私はガラスを食べられます/wonder12345"); +unlink("$file_path/glob_variation私はガラスを食べられます/wonder;123456"); +rmdir("$file_path/glob_variation私はガラスを食べられます/wonder"); +rmdir("$file_path/glob_variation私はガラスを食べられます"); + +echo "\n*** Testing glob() on directories ***\n"; +// temp dir created to check for pattern matching the sub dir created in it +mkdir("$file_path/glob_variation私はガラスを食べられます/wonder1/wonder2", 0777, true); + +$counter = 1; +/* loop through $patterns to match each $pattern with the directories created + using glob() */ +foreach($patterns as $pattern) { + echo "-- Iteration $counter --\n"; + var_dump( glob($pattern, GLOB_ONLYDIR) ); + $counter++; +} + +echo "Done\n"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/glob_variation私はガラスを食べられます/wonder1/wonder2"); +rmdir("$file_path/glob_variation私はガラスを食べられます/wonder1/"); +rmdir("$file_path/glob_variation私はガラスを食べられます/"); +?> +--EXPECTF-- +*** Testing glob() : usage variations *** + +-- Iteration 1 -- +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder\" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} + +-- Iteration 2 -- +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder\" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} + +-- Iteration 3 -- +array(2) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(2) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(2) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(2) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(2) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(2) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} + +-- Iteration 4 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/*der5" +} +array(0) { +} +array(0) { +} + +-- Iteration 5 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/??onder*" +} +array(0) { +} +array(0) { +} + +-- Iteration 6 -- +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder\" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} +array(3) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder" + [1]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" + [2]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder;123456" +} + +-- Iteration 7 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/++onder*" +} +array(0) { +} +array(0) { +} + +-- Iteration 8 -- + +Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d +NULL + +Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d +NULL + +Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d +NULL + +Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d +NULL + +Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d +NULL + +Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d +NULL + +-- Iteration 9 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "$file_path/glob_variation私はガラスを食べられます/wonder5" +} +array(0) { +} +array(0) { +} + +-- Iteration 10 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/?wonder?" +} +array(0) { +} +array(0) { +} + +-- Iteration 11 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder?" +} +array(0) { +} +array(0) { +} + +-- Iteration 12 -- +array(0) { +} +array(0) { +} +array(0) { +} +array(1) { + [0]=> + string(%d) "1" +} +array(0) { +} +array(0) { +} + +*** Testing glob() with pattern within braces *** +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder12345" +} + +*** Testing glob() on directories *** +-- Iteration 1 -- +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder1" +} +-- Iteration 2 -- +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder1" +} +-- Iteration 3 -- +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder1" +} +-- Iteration 4 -- +array(0) { +} +-- Iteration 5 -- +array(0) { +} +-- Iteration 6 -- +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder1" +} +-- Iteration 7 -- +array(0) { +} +-- Iteration 8 -- + +Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d +NULL +-- Iteration 9 -- +array(0) { +} +-- Iteration 10 -- +array(0) { +} +-- Iteration 11 -- +array(1) { + [0]=> + string(%d) "%s/glob_variation私はガラスを食べられます/wonder1" +} +-- Iteration 12 -- +array(0) { +} +Done diff --git a/ext/standard/tests/file/is_executable_basic-win32-mb.phpt b/ext/standard/tests/file/is_executable_basic-win32-mb.phpt new file mode 100644 index 0000000000..eb71c63bd3 --- /dev/null +++ b/ext/standard/tests/file/is_executable_basic-win32-mb.phpt @@ -0,0 +1,1064 @@ +--TEST-- +Test is_executable() function: basic functionality +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: bool is_executable ( string $filename ); + Description: Tells whether the filename is executable +*/ +require dirname(__FILE__).'/file.inc'; + +echo "*** Testing is_executable(): basic functionality ***\n"; + +// create a file +$filename = dirname(__FILE__)."/私はガラスを食べられますis_executable.tmp"; +create_file($filename); + +$counter = 1; +/* loop to check if the file with new mode is executable + using is_executable() */ +for($mode = 0000; $mode <= 0777; $mode++) { + echo "-- Changing mode of file to $mode --\n"; + chmod($filename, $mode); // change mode of file + var_dump( is_executable($filename) ); + $counter++; + clearstatcache(); +} + +// delete the temp file +delete_file($filename); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing is_executable(): basic functionality *** +-- Changing mode of file to 0 -- +bool(false) +-- Changing mode of file to 1 -- +bool(false) +-- Changing mode of file to 2 -- +bool(false) +-- Changing mode of file to 3 -- +bool(false) +-- Changing mode of file to 4 -- +bool(false) +-- Changing mode of file to 5 -- +bool(false) +-- Changing mode of file to 6 -- +bool(false) +-- Changing mode of file to 7 -- +bool(false) +-- Changing mode of file to 8 -- +bool(false) +-- Changing mode of file to 9 -- +bool(false) +-- Changing mode of file to 10 -- +bool(false) +-- Changing mode of file to 11 -- +bool(false) +-- Changing mode of file to 12 -- +bool(false) +-- Changing mode of file to 13 -- +bool(false) +-- Changing mode of file to 14 -- +bool(false) +-- Changing mode of file to 15 -- +bool(false) +-- Changing mode of file to 16 -- +bool(false) +-- Changing mode of file to 17 -- +bool(false) +-- Changing mode of file to 18 -- +bool(false) +-- Changing mode of file to 19 -- +bool(false) +-- Changing mode of file to 20 -- +bool(false) +-- Changing mode of file to 21 -- +bool(false) +-- Changing mode of file to 22 -- +bool(false) +-- Changing mode of file to 23 -- +bool(false) +-- Changing mode of file to 24 -- +bool(false) +-- Changing mode of file to 25 -- +bool(false) +-- Changing mode of file to 26 -- +bool(false) +-- Changing mode of file to 27 -- +bool(false) +-- Changing mode of file to 28 -- +bool(false) +-- Changing mode of file to 29 -- +bool(false) +-- Changing mode of file to 30 -- +bool(false) +-- Changing mode of file to 31 -- +bool(false) +-- Changing mode of file to 32 -- +bool(false) +-- Changing mode of file to 33 -- +bool(false) +-- Changing mode of file to 34 -- +bool(false) +-- Changing mode of file to 35 -- +bool(false) +-- Changing mode of file to 36 -- +bool(false) +-- Changing mode of file to 37 -- +bool(false) +-- Changing mode of file to 38 -- +bool(false) +-- Changing mode of file to 39 -- +bool(false) +-- Changing mode of file to 40 -- +bool(false) +-- Changing mode of file to 41 -- +bool(false) +-- Changing mode of file to 42 -- +bool(false) +-- Changing mode of file to 43 -- +bool(false) +-- Changing mode of file to 44 -- +bool(false) +-- Changing mode of file to 45 -- +bool(false) +-- Changing mode of file to 46 -- +bool(false) +-- Changing mode of file to 47 -- +bool(false) +-- Changing mode of file to 48 -- +bool(false) +-- Changing mode of file to 49 -- +bool(false) +-- Changing mode of file to 50 -- +bool(false) +-- Changing mode of file to 51 -- +bool(false) +-- Changing mode of file to 52 -- +bool(false) +-- Changing mode of file to 53 -- +bool(false) +-- Changing mode of file to 54 -- +bool(false) +-- Changing mode of file to 55 -- +bool(false) +-- Changing mode of file to 56 -- +bool(false) +-- Changing mode of file to 57 -- +bool(false) +-- Changing mode of file to 58 -- +bool(false) +-- Changing mode of file to 59 -- +bool(false) +-- Changing mode of file to 60 -- +bool(false) +-- Changing mode of file to 61 -- +bool(false) +-- Changing mode of file to 62 -- +bool(false) +-- Changing mode of file to 63 -- +bool(false) +-- Changing mode of file to 64 -- +bool(false) +-- Changing mode of file to 65 -- +bool(false) +-- Changing mode of file to 66 -- +bool(false) +-- Changing mode of file to 67 -- +bool(false) +-- Changing mode of file to 68 -- +bool(false) +-- Changing mode of file to 69 -- +bool(false) +-- Changing mode of file to 70 -- +bool(false) +-- Changing mode of file to 71 -- +bool(false) +-- Changing mode of file to 72 -- +bool(false) +-- Changing mode of file to 73 -- +bool(false) +-- Changing mode of file to 74 -- +bool(false) +-- Changing mode of file to 75 -- +bool(false) +-- Changing mode of file to 76 -- +bool(false) +-- Changing mode of file to 77 -- +bool(false) +-- Changing mode of file to 78 -- +bool(false) +-- Changing mode of file to 79 -- +bool(false) +-- Changing mode of file to 80 -- +bool(false) +-- Changing mode of file to 81 -- +bool(false) +-- Changing mode of file to 82 -- +bool(false) +-- Changing mode of file to 83 -- +bool(false) +-- Changing mode of file to 84 -- +bool(false) +-- Changing mode of file to 85 -- +bool(false) +-- Changing mode of file to 86 -- +bool(false) +-- Changing mode of file to 87 -- +bool(false) +-- Changing mode of file to 88 -- +bool(false) +-- Changing mode of file to 89 -- +bool(false) +-- Changing mode of file to 90 -- +bool(false) +-- Changing mode of file to 91 -- +bool(false) +-- Changing mode of file to 92 -- +bool(false) +-- Changing mode of file to 93 -- +bool(false) +-- Changing mode of file to 94 -- +bool(false) +-- Changing mode of file to 95 -- +bool(false) +-- Changing mode of file to 96 -- +bool(false) +-- Changing mode of file to 97 -- +bool(false) +-- Changing mode of file to 98 -- +bool(false) +-- Changing mode of file to 99 -- +bool(false) +-- Changing mode of file to 100 -- +bool(false) +-- Changing mode of file to 101 -- +bool(false) +-- Changing mode of file to 102 -- +bool(false) +-- Changing mode of file to 103 -- +bool(false) +-- Changing mode of file to 104 -- +bool(false) +-- Changing mode of file to 105 -- +bool(false) +-- Changing mode of file to 106 -- +bool(false) +-- Changing mode of file to 107 -- +bool(false) +-- Changing mode of file to 108 -- +bool(false) +-- Changing mode of file to 109 -- +bool(false) +-- Changing mode of file to 110 -- +bool(false) +-- Changing mode of file to 111 -- +bool(false) +-- Changing mode of file to 112 -- +bool(false) +-- Changing mode of file to 113 -- +bool(false) +-- Changing mode of file to 114 -- +bool(false) +-- Changing mode of file to 115 -- +bool(false) +-- Changing mode of file to 116 -- +bool(false) +-- Changing mode of file to 117 -- +bool(false) +-- Changing mode of file to 118 -- +bool(false) +-- Changing mode of file to 119 -- +bool(false) +-- Changing mode of file to 120 -- +bool(false) +-- Changing mode of file to 121 -- +bool(false) +-- Changing mode of file to 122 -- +bool(false) +-- Changing mode of file to 123 -- +bool(false) +-- Changing mode of file to 124 -- +bool(false) +-- Changing mode of file to 125 -- +bool(false) +-- Changing mode of file to 126 -- +bool(false) +-- Changing mode of file to 127 -- +bool(false) +-- Changing mode of file to 128 -- +bool(false) +-- Changing mode of file to 129 -- +bool(false) +-- Changing mode of file to 130 -- +bool(false) +-- Changing mode of file to 131 -- +bool(false) +-- Changing mode of file to 132 -- +bool(false) +-- Changing mode of file to 133 -- +bool(false) +-- Changing mode of file to 134 -- +bool(false) +-- Changing mode of file to 135 -- +bool(false) +-- Changing mode of file to 136 -- +bool(false) +-- Changing mode of file to 137 -- +bool(false) +-- Changing mode of file to 138 -- +bool(false) +-- Changing mode of file to 139 -- +bool(false) +-- Changing mode of file to 140 -- +bool(false) +-- Changing mode of file to 141 -- +bool(false) +-- Changing mode of file to 142 -- +bool(false) +-- Changing mode of file to 143 -- +bool(false) +-- Changing mode of file to 144 -- +bool(false) +-- Changing mode of file to 145 -- +bool(false) +-- Changing mode of file to 146 -- +bool(false) +-- Changing mode of file to 147 -- +bool(false) +-- Changing mode of file to 148 -- +bool(false) +-- Changing mode of file to 149 -- +bool(false) +-- Changing mode of file to 150 -- +bool(false) +-- Changing mode of file to 151 -- +bool(false) +-- Changing mode of file to 152 -- +bool(false) +-- Changing mode of file to 153 -- +bool(false) +-- Changing mode of file to 154 -- +bool(false) +-- Changing mode of file to 155 -- +bool(false) +-- Changing mode of file to 156 -- +bool(false) +-- Changing mode of file to 157 -- +bool(false) +-- Changing mode of file to 158 -- +bool(false) +-- Changing mode of file to 159 -- +bool(false) +-- Changing mode of file to 160 -- +bool(false) +-- Changing mode of file to 161 -- +bool(false) +-- Changing mode of file to 162 -- +bool(false) +-- Changing mode of file to 163 -- +bool(false) +-- Changing mode of file to 164 -- +bool(false) +-- Changing mode of file to 165 -- +bool(false) +-- Changing mode of file to 166 -- +bool(false) +-- Changing mode of file to 167 -- +bool(false) +-- Changing mode of file to 168 -- +bool(false) +-- Changing mode of file to 169 -- +bool(false) +-- Changing mode of file to 170 -- +bool(false) +-- Changing mode of file to 171 -- +bool(false) +-- Changing mode of file to 172 -- +bool(false) +-- Changing mode of file to 173 -- +bool(false) +-- Changing mode of file to 174 -- +bool(false) +-- Changing mode of file to 175 -- +bool(false) +-- Changing mode of file to 176 -- +bool(false) +-- Changing mode of file to 177 -- +bool(false) +-- Changing mode of file to 178 -- +bool(false) +-- Changing mode of file to 179 -- +bool(false) +-- Changing mode of file to 180 -- +bool(false) +-- Changing mode of file to 181 -- +bool(false) +-- Changing mode of file to 182 -- +bool(false) +-- Changing mode of file to 183 -- +bool(false) +-- Changing mode of file to 184 -- +bool(false) +-- Changing mode of file to 185 -- +bool(false) +-- Changing mode of file to 186 -- +bool(false) +-- Changing mode of file to 187 -- +bool(false) +-- Changing mode of file to 188 -- +bool(false) +-- Changing mode of file to 189 -- +bool(false) +-- Changing mode of file to 190 -- +bool(false) +-- Changing mode of file to 191 -- +bool(false) +-- Changing mode of file to 192 -- +bool(false) +-- Changing mode of file to 193 -- +bool(false) +-- Changing mode of file to 194 -- +bool(false) +-- Changing mode of file to 195 -- +bool(false) +-- Changing mode of file to 196 -- +bool(false) +-- Changing mode of file to 197 -- +bool(false) +-- Changing mode of file to 198 -- +bool(false) +-- Changing mode of file to 199 -- +bool(false) +-- Changing mode of file to 200 -- +bool(false) +-- Changing mode of file to 201 -- +bool(false) +-- Changing mode of file to 202 -- +bool(false) +-- Changing mode of file to 203 -- +bool(false) +-- Changing mode of file to 204 -- +bool(false) +-- Changing mode of file to 205 -- +bool(false) +-- Changing mode of file to 206 -- +bool(false) +-- Changing mode of file to 207 -- +bool(false) +-- Changing mode of file to 208 -- +bool(false) +-- Changing mode of file to 209 -- +bool(false) +-- Changing mode of file to 210 -- +bool(false) +-- Changing mode of file to 211 -- +bool(false) +-- Changing mode of file to 212 -- +bool(false) +-- Changing mode of file to 213 -- +bool(false) +-- Changing mode of file to 214 -- +bool(false) +-- Changing mode of file to 215 -- +bool(false) +-- Changing mode of file to 216 -- +bool(false) +-- Changing mode of file to 217 -- +bool(false) +-- Changing mode of file to 218 -- +bool(false) +-- Changing mode of file to 219 -- +bool(false) +-- Changing mode of file to 220 -- +bool(false) +-- Changing mode of file to 221 -- +bool(false) +-- Changing mode of file to 222 -- +bool(false) +-- Changing mode of file to 223 -- +bool(false) +-- Changing mode of file to 224 -- +bool(false) +-- Changing mode of file to 225 -- +bool(false) +-- Changing mode of file to 226 -- +bool(false) +-- Changing mode of file to 227 -- +bool(false) +-- Changing mode of file to 228 -- +bool(false) +-- Changing mode of file to 229 -- +bool(false) +-- Changing mode of file to 230 -- +bool(false) +-- Changing mode of file to 231 -- +bool(false) +-- Changing mode of file to 232 -- +bool(false) +-- Changing mode of file to 233 -- +bool(false) +-- Changing mode of file to 234 -- +bool(false) +-- Changing mode of file to 235 -- +bool(false) +-- Changing mode of file to 236 -- +bool(false) +-- Changing mode of file to 237 -- +bool(false) +-- Changing mode of file to 238 -- +bool(false) +-- Changing mode of file to 239 -- +bool(false) +-- Changing mode of file to 240 -- +bool(false) +-- Changing mode of file to 241 -- +bool(false) +-- Changing mode of file to 242 -- +bool(false) +-- Changing mode of file to 243 -- +bool(false) +-- Changing mode of file to 244 -- +bool(false) +-- Changing mode of file to 245 -- +bool(false) +-- Changing mode of file to 246 -- +bool(false) +-- Changing mode of file to 247 -- +bool(false) +-- Changing mode of file to 248 -- +bool(false) +-- Changing mode of file to 249 -- +bool(false) +-- Changing mode of file to 250 -- +bool(false) +-- Changing mode of file to 251 -- +bool(false) +-- Changing mode of file to 252 -- +bool(false) +-- Changing mode of file to 253 -- +bool(false) +-- Changing mode of file to 254 -- +bool(false) +-- Changing mode of file to 255 -- +bool(false) +-- Changing mode of file to 256 -- +bool(false) +-- Changing mode of file to 257 -- +bool(false) +-- Changing mode of file to 258 -- +bool(false) +-- Changing mode of file to 259 -- +bool(false) +-- Changing mode of file to 260 -- +bool(false) +-- Changing mode of file to 261 -- +bool(false) +-- Changing mode of file to 262 -- +bool(false) +-- Changing mode of file to 263 -- +bool(false) +-- Changing mode of file to 264 -- +bool(false) +-- Changing mode of file to 265 -- +bool(false) +-- Changing mode of file to 266 -- +bool(false) +-- Changing mode of file to 267 -- +bool(false) +-- Changing mode of file to 268 -- +bool(false) +-- Changing mode of file to 269 -- +bool(false) +-- Changing mode of file to 270 -- +bool(false) +-- Changing mode of file to 271 -- +bool(false) +-- Changing mode of file to 272 -- +bool(false) +-- Changing mode of file to 273 -- +bool(false) +-- Changing mode of file to 274 -- +bool(false) +-- Changing mode of file to 275 -- +bool(false) +-- Changing mode of file to 276 -- +bool(false) +-- Changing mode of file to 277 -- +bool(false) +-- Changing mode of file to 278 -- +bool(false) +-- Changing mode of file to 279 -- +bool(false) +-- Changing mode of file to 280 -- +bool(false) +-- Changing mode of file to 281 -- +bool(false) +-- Changing mode of file to 282 -- +bool(false) +-- Changing mode of file to 283 -- +bool(false) +-- Changing mode of file to 284 -- +bool(false) +-- Changing mode of file to 285 -- +bool(false) +-- Changing mode of file to 286 -- +bool(false) +-- Changing mode of file to 287 -- +bool(false) +-- Changing mode of file to 288 -- +bool(false) +-- Changing mode of file to 289 -- +bool(false) +-- Changing mode of file to 290 -- +bool(false) +-- Changing mode of file to 291 -- +bool(false) +-- Changing mode of file to 292 -- +bool(false) +-- Changing mode of file to 293 -- +bool(false) +-- Changing mode of file to 294 -- +bool(false) +-- Changing mode of file to 295 -- +bool(false) +-- Changing mode of file to 296 -- +bool(false) +-- Changing mode of file to 297 -- +bool(false) +-- Changing mode of file to 298 -- +bool(false) +-- Changing mode of file to 299 -- +bool(false) +-- Changing mode of file to 300 -- +bool(false) +-- Changing mode of file to 301 -- +bool(false) +-- Changing mode of file to 302 -- +bool(false) +-- Changing mode of file to 303 -- +bool(false) +-- Changing mode of file to 304 -- +bool(false) +-- Changing mode of file to 305 -- +bool(false) +-- Changing mode of file to 306 -- +bool(false) +-- Changing mode of file to 307 -- +bool(false) +-- Changing mode of file to 308 -- +bool(false) +-- Changing mode of file to 309 -- +bool(false) +-- Changing mode of file to 310 -- +bool(false) +-- Changing mode of file to 311 -- +bool(false) +-- Changing mode of file to 312 -- +bool(false) +-- Changing mode of file to 313 -- +bool(false) +-- Changing mode of file to 314 -- +bool(false) +-- Changing mode of file to 315 -- +bool(false) +-- Changing mode of file to 316 -- +bool(false) +-- Changing mode of file to 317 -- +bool(false) +-- Changing mode of file to 318 -- +bool(false) +-- Changing mode of file to 319 -- +bool(false) +-- Changing mode of file to 320 -- +bool(false) +-- Changing mode of file to 321 -- +bool(false) +-- Changing mode of file to 322 -- +bool(false) +-- Changing mode of file to 323 -- +bool(false) +-- Changing mode of file to 324 -- +bool(false) +-- Changing mode of file to 325 -- +bool(false) +-- Changing mode of file to 326 -- +bool(false) +-- Changing mode of file to 327 -- +bool(false) +-- Changing mode of file to 328 -- +bool(false) +-- Changing mode of file to 329 -- +bool(false) +-- Changing mode of file to 330 -- +bool(false) +-- Changing mode of file to 331 -- +bool(false) +-- Changing mode of file to 332 -- +bool(false) +-- Changing mode of file to 333 -- +bool(false) +-- Changing mode of file to 334 -- +bool(false) +-- Changing mode of file to 335 -- +bool(false) +-- Changing mode of file to 336 -- +bool(false) +-- Changing mode of file to 337 -- +bool(false) +-- Changing mode of file to 338 -- +bool(false) +-- Changing mode of file to 339 -- +bool(false) +-- Changing mode of file to 340 -- +bool(false) +-- Changing mode of file to 341 -- +bool(false) +-- Changing mode of file to 342 -- +bool(false) +-- Changing mode of file to 343 -- +bool(false) +-- Changing mode of file to 344 -- +bool(false) +-- Changing mode of file to 345 -- +bool(false) +-- Changing mode of file to 346 -- +bool(false) +-- Changing mode of file to 347 -- +bool(false) +-- Changing mode of file to 348 -- +bool(false) +-- Changing mode of file to 349 -- +bool(false) +-- Changing mode of file to 350 -- +bool(false) +-- Changing mode of file to 351 -- +bool(false) +-- Changing mode of file to 352 -- +bool(false) +-- Changing mode of file to 353 -- +bool(false) +-- Changing mode of file to 354 -- +bool(false) +-- Changing mode of file to 355 -- +bool(false) +-- Changing mode of file to 356 -- +bool(false) +-- Changing mode of file to 357 -- +bool(false) +-- Changing mode of file to 358 -- +bool(false) +-- Changing mode of file to 359 -- +bool(false) +-- Changing mode of file to 360 -- +bool(false) +-- Changing mode of file to 361 -- +bool(false) +-- Changing mode of file to 362 -- +bool(false) +-- Changing mode of file to 363 -- +bool(false) +-- Changing mode of file to 364 -- +bool(false) +-- Changing mode of file to 365 -- +bool(false) +-- Changing mode of file to 366 -- +bool(false) +-- Changing mode of file to 367 -- +bool(false) +-- Changing mode of file to 368 -- +bool(false) +-- Changing mode of file to 369 -- +bool(false) +-- Changing mode of file to 370 -- +bool(false) +-- Changing mode of file to 371 -- +bool(false) +-- Changing mode of file to 372 -- +bool(false) +-- Changing mode of file to 373 -- +bool(false) +-- Changing mode of file to 374 -- +bool(false) +-- Changing mode of file to 375 -- +bool(false) +-- Changing mode of file to 376 -- +bool(false) +-- Changing mode of file to 377 -- +bool(false) +-- Changing mode of file to 378 -- +bool(false) +-- Changing mode of file to 379 -- +bool(false) +-- Changing mode of file to 380 -- +bool(false) +-- Changing mode of file to 381 -- +bool(false) +-- Changing mode of file to 382 -- +bool(false) +-- Changing mode of file to 383 -- +bool(false) +-- Changing mode of file to 384 -- +bool(false) +-- Changing mode of file to 385 -- +bool(false) +-- Changing mode of file to 386 -- +bool(false) +-- Changing mode of file to 387 -- +bool(false) +-- Changing mode of file to 388 -- +bool(false) +-- Changing mode of file to 389 -- +bool(false) +-- Changing mode of file to 390 -- +bool(false) +-- Changing mode of file to 391 -- +bool(false) +-- Changing mode of file to 392 -- +bool(false) +-- Changing mode of file to 393 -- +bool(false) +-- Changing mode of file to 394 -- +bool(false) +-- Changing mode of file to 395 -- +bool(false) +-- Changing mode of file to 396 -- +bool(false) +-- Changing mode of file to 397 -- +bool(false) +-- Changing mode of file to 398 -- +bool(false) +-- Changing mode of file to 399 -- +bool(false) +-- Changing mode of file to 400 -- +bool(false) +-- Changing mode of file to 401 -- +bool(false) +-- Changing mode of file to 402 -- +bool(false) +-- Changing mode of file to 403 -- +bool(false) +-- Changing mode of file to 404 -- +bool(false) +-- Changing mode of file to 405 -- +bool(false) +-- Changing mode of file to 406 -- +bool(false) +-- Changing mode of file to 407 -- +bool(false) +-- Changing mode of file to 408 -- +bool(false) +-- Changing mode of file to 409 -- +bool(false) +-- Changing mode of file to 410 -- +bool(false) +-- Changing mode of file to 411 -- +bool(false) +-- Changing mode of file to 412 -- +bool(false) +-- Changing mode of file to 413 -- +bool(false) +-- Changing mode of file to 414 -- +bool(false) +-- Changing mode of file to 415 -- +bool(false) +-- Changing mode of file to 416 -- +bool(false) +-- Changing mode of file to 417 -- +bool(false) +-- Changing mode of file to 418 -- +bool(false) +-- Changing mode of file to 419 -- +bool(false) +-- Changing mode of file to 420 -- +bool(false) +-- Changing mode of file to 421 -- +bool(false) +-- Changing mode of file to 422 -- +bool(false) +-- Changing mode of file to 423 -- +bool(false) +-- Changing mode of file to 424 -- +bool(false) +-- Changing mode of file to 425 -- +bool(false) +-- Changing mode of file to 426 -- +bool(false) +-- Changing mode of file to 427 -- +bool(false) +-- Changing mode of file to 428 -- +bool(false) +-- Changing mode of file to 429 -- +bool(false) +-- Changing mode of file to 430 -- +bool(false) +-- Changing mode of file to 431 -- +bool(false) +-- Changing mode of file to 432 -- +bool(false) +-- Changing mode of file to 433 -- +bool(false) +-- Changing mode of file to 434 -- +bool(false) +-- Changing mode of file to 435 -- +bool(false) +-- Changing mode of file to 436 -- +bool(false) +-- Changing mode of file to 437 -- +bool(false) +-- Changing mode of file to 438 -- +bool(false) +-- Changing mode of file to 439 -- +bool(false) +-- Changing mode of file to 440 -- +bool(false) +-- Changing mode of file to 441 -- +bool(false) +-- Changing mode of file to 442 -- +bool(false) +-- Changing mode of file to 443 -- +bool(false) +-- Changing mode of file to 444 -- +bool(false) +-- Changing mode of file to 445 -- +bool(false) +-- Changing mode of file to 446 -- +bool(false) +-- Changing mode of file to 447 -- +bool(false) +-- Changing mode of file to 448 -- +bool(false) +-- Changing mode of file to 449 -- +bool(false) +-- Changing mode of file to 450 -- +bool(false) +-- Changing mode of file to 451 -- +bool(false) +-- Changing mode of file to 452 -- +bool(false) +-- Changing mode of file to 453 -- +bool(false) +-- Changing mode of file to 454 -- +bool(false) +-- Changing mode of file to 455 -- +bool(false) +-- Changing mode of file to 456 -- +bool(false) +-- Changing mode of file to 457 -- +bool(false) +-- Changing mode of file to 458 -- +bool(false) +-- Changing mode of file to 459 -- +bool(false) +-- Changing mode of file to 460 -- +bool(false) +-- Changing mode of file to 461 -- +bool(false) +-- Changing mode of file to 462 -- +bool(false) +-- Changing mode of file to 463 -- +bool(false) +-- Changing mode of file to 464 -- +bool(false) +-- Changing mode of file to 465 -- +bool(false) +-- Changing mode of file to 466 -- +bool(false) +-- Changing mode of file to 467 -- +bool(false) +-- Changing mode of file to 468 -- +bool(false) +-- Changing mode of file to 469 -- +bool(false) +-- Changing mode of file to 470 -- +bool(false) +-- Changing mode of file to 471 -- +bool(false) +-- Changing mode of file to 472 -- +bool(false) +-- Changing mode of file to 473 -- +bool(false) +-- Changing mode of file to 474 -- +bool(false) +-- Changing mode of file to 475 -- +bool(false) +-- Changing mode of file to 476 -- +bool(false) +-- Changing mode of file to 477 -- +bool(false) +-- Changing mode of file to 478 -- +bool(false) +-- Changing mode of file to 479 -- +bool(false) +-- Changing mode of file to 480 -- +bool(false) +-- Changing mode of file to 481 -- +bool(false) +-- Changing mode of file to 482 -- +bool(false) +-- Changing mode of file to 483 -- +bool(false) +-- Changing mode of file to 484 -- +bool(false) +-- Changing mode of file to 485 -- +bool(false) +-- Changing mode of file to 486 -- +bool(false) +-- Changing mode of file to 487 -- +bool(false) +-- Changing mode of file to 488 -- +bool(false) +-- Changing mode of file to 489 -- +bool(false) +-- Changing mode of file to 490 -- +bool(false) +-- Changing mode of file to 491 -- +bool(false) +-- Changing mode of file to 492 -- +bool(false) +-- Changing mode of file to 493 -- +bool(false) +-- Changing mode of file to 494 -- +bool(false) +-- Changing mode of file to 495 -- +bool(false) +-- Changing mode of file to 496 -- +bool(false) +-- Changing mode of file to 497 -- +bool(false) +-- Changing mode of file to 498 -- +bool(false) +-- Changing mode of file to 499 -- +bool(false) +-- Changing mode of file to 500 -- +bool(false) +-- Changing mode of file to 501 -- +bool(false) +-- Changing mode of file to 502 -- +bool(false) +-- Changing mode of file to 503 -- +bool(false) +-- Changing mode of file to 504 -- +bool(false) +-- Changing mode of file to 505 -- +bool(false) +-- Changing mode of file to 506 -- +bool(false) +-- Changing mode of file to 507 -- +bool(false) +-- Changing mode of file to 508 -- +bool(false) +-- Changing mode of file to 509 -- +bool(false) +-- Changing mode of file to 510 -- +bool(false) +-- Changing mode of file to 511 -- +bool(false) +Done diff --git a/ext/standard/tests/file/is_readable_basic-win32-mb.phpt b/ext/standard/tests/file/is_readable_basic-win32-mb.phpt new file mode 100644 index 0000000000..2950dfa590 --- /dev/null +++ b/ext/standard/tests/file/is_readable_basic-win32-mb.phpt @@ -0,0 +1,1066 @@ +--TEST-- +Test is_readable() function: basic functionality +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: bool is_readable ( string $filename ); + Description: Tells whether the filename is readable +*/ + +// include common file test functions +require dirname(__FILE__).'/file.inc'; + +echo "*** Testing is_readable(): basic functionality ***\n"; + +// create a file +$filename = dirname(__FILE__)."/私はガラスを食べられますis_readable.tmp"; +create_file($filename); + +$counter = 1; +/* loop to check if the file with new mode is readable + using is_readable() */ +for($mode = 0000; $mode <= 0777; $mode++) { + echo "-- Changing mode of file to $mode --\n"; + chmod($filename, $mode); // change mode of file + var_dump( is_readable($filename) ); + $counter++; + clearstatcache(); +} + +// delete the temp file +delete_file($filename); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing is_readable(): basic functionality *** +-- Changing mode of file to 0 -- +bool(true) +-- Changing mode of file to 1 -- +bool(true) +-- Changing mode of file to 2 -- +bool(true) +-- Changing mode of file to 3 -- +bool(true) +-- Changing mode of file to 4 -- +bool(true) +-- Changing mode of file to 5 -- +bool(true) +-- Changing mode of file to 6 -- +bool(true) +-- Changing mode of file to 7 -- +bool(true) +-- Changing mode of file to 8 -- +bool(true) +-- Changing mode of file to 9 -- +bool(true) +-- Changing mode of file to 10 -- +bool(true) +-- Changing mode of file to 11 -- +bool(true) +-- Changing mode of file to 12 -- +bool(true) +-- Changing mode of file to 13 -- +bool(true) +-- Changing mode of file to 14 -- +bool(true) +-- Changing mode of file to 15 -- +bool(true) +-- Changing mode of file to 16 -- +bool(true) +-- Changing mode of file to 17 -- +bool(true) +-- Changing mode of file to 18 -- +bool(true) +-- Changing mode of file to 19 -- +bool(true) +-- Changing mode of file to 20 -- +bool(true) +-- Changing mode of file to 21 -- +bool(true) +-- Changing mode of file to 22 -- +bool(true) +-- Changing mode of file to 23 -- +bool(true) +-- Changing mode of file to 24 -- +bool(true) +-- Changing mode of file to 25 -- +bool(true) +-- Changing mode of file to 26 -- +bool(true) +-- Changing mode of file to 27 -- +bool(true) +-- Changing mode of file to 28 -- +bool(true) +-- Changing mode of file to 29 -- +bool(true) +-- Changing mode of file to 30 -- +bool(true) +-- Changing mode of file to 31 -- +bool(true) +-- Changing mode of file to 32 -- +bool(true) +-- Changing mode of file to 33 -- +bool(true) +-- Changing mode of file to 34 -- +bool(true) +-- Changing mode of file to 35 -- +bool(true) +-- Changing mode of file to 36 -- +bool(true) +-- Changing mode of file to 37 -- +bool(true) +-- Changing mode of file to 38 -- +bool(true) +-- Changing mode of file to 39 -- +bool(true) +-- Changing mode of file to 40 -- +bool(true) +-- Changing mode of file to 41 -- +bool(true) +-- Changing mode of file to 42 -- +bool(true) +-- Changing mode of file to 43 -- +bool(true) +-- Changing mode of file to 44 -- +bool(true) +-- Changing mode of file to 45 -- +bool(true) +-- Changing mode of file to 46 -- +bool(true) +-- Changing mode of file to 47 -- +bool(true) +-- Changing mode of file to 48 -- +bool(true) +-- Changing mode of file to 49 -- +bool(true) +-- Changing mode of file to 50 -- +bool(true) +-- Changing mode of file to 51 -- +bool(true) +-- Changing mode of file to 52 -- +bool(true) +-- Changing mode of file to 53 -- +bool(true) +-- Changing mode of file to 54 -- +bool(true) +-- Changing mode of file to 55 -- +bool(true) +-- Changing mode of file to 56 -- +bool(true) +-- Changing mode of file to 57 -- +bool(true) +-- Changing mode of file to 58 -- +bool(true) +-- Changing mode of file to 59 -- +bool(true) +-- Changing mode of file to 60 -- +bool(true) +-- Changing mode of file to 61 -- +bool(true) +-- Changing mode of file to 62 -- +bool(true) +-- Changing mode of file to 63 -- +bool(true) +-- Changing mode of file to 64 -- +bool(true) +-- Changing mode of file to 65 -- +bool(true) +-- Changing mode of file to 66 -- +bool(true) +-- Changing mode of file to 67 -- +bool(true) +-- Changing mode of file to 68 -- +bool(true) +-- Changing mode of file to 69 -- +bool(true) +-- Changing mode of file to 70 -- +bool(true) +-- Changing mode of file to 71 -- +bool(true) +-- Changing mode of file to 72 -- +bool(true) +-- Changing mode of file to 73 -- +bool(true) +-- Changing mode of file to 74 -- +bool(true) +-- Changing mode of file to 75 -- +bool(true) +-- Changing mode of file to 76 -- +bool(true) +-- Changing mode of file to 77 -- +bool(true) +-- Changing mode of file to 78 -- +bool(true) +-- Changing mode of file to 79 -- +bool(true) +-- Changing mode of file to 80 -- +bool(true) +-- Changing mode of file to 81 -- +bool(true) +-- Changing mode of file to 82 -- +bool(true) +-- Changing mode of file to 83 -- +bool(true) +-- Changing mode of file to 84 -- +bool(true) +-- Changing mode of file to 85 -- +bool(true) +-- Changing mode of file to 86 -- +bool(true) +-- Changing mode of file to 87 -- +bool(true) +-- Changing mode of file to 88 -- +bool(true) +-- Changing mode of file to 89 -- +bool(true) +-- Changing mode of file to 90 -- +bool(true) +-- Changing mode of file to 91 -- +bool(true) +-- Changing mode of file to 92 -- +bool(true) +-- Changing mode of file to 93 -- +bool(true) +-- Changing mode of file to 94 -- +bool(true) +-- Changing mode of file to 95 -- +bool(true) +-- Changing mode of file to 96 -- +bool(true) +-- Changing mode of file to 97 -- +bool(true) +-- Changing mode of file to 98 -- +bool(true) +-- Changing mode of file to 99 -- +bool(true) +-- Changing mode of file to 100 -- +bool(true) +-- Changing mode of file to 101 -- +bool(true) +-- Changing mode of file to 102 -- +bool(true) +-- Changing mode of file to 103 -- +bool(true) +-- Changing mode of file to 104 -- +bool(true) +-- Changing mode of file to 105 -- +bool(true) +-- Changing mode of file to 106 -- +bool(true) +-- Changing mode of file to 107 -- +bool(true) +-- Changing mode of file to 108 -- +bool(true) +-- Changing mode of file to 109 -- +bool(true) +-- Changing mode of file to 110 -- +bool(true) +-- Changing mode of file to 111 -- +bool(true) +-- Changing mode of file to 112 -- +bool(true) +-- Changing mode of file to 113 -- +bool(true) +-- Changing mode of file to 114 -- +bool(true) +-- Changing mode of file to 115 -- +bool(true) +-- Changing mode of file to 116 -- +bool(true) +-- Changing mode of file to 117 -- +bool(true) +-- Changing mode of file to 118 -- +bool(true) +-- Changing mode of file to 119 -- +bool(true) +-- Changing mode of file to 120 -- +bool(true) +-- Changing mode of file to 121 -- +bool(true) +-- Changing mode of file to 122 -- +bool(true) +-- Changing mode of file to 123 -- +bool(true) +-- Changing mode of file to 124 -- +bool(true) +-- Changing mode of file to 125 -- +bool(true) +-- Changing mode of file to 126 -- +bool(true) +-- Changing mode of file to 127 -- +bool(true) +-- Changing mode of file to 128 -- +bool(true) +-- Changing mode of file to 129 -- +bool(true) +-- Changing mode of file to 130 -- +bool(true) +-- Changing mode of file to 131 -- +bool(true) +-- Changing mode of file to 132 -- +bool(true) +-- Changing mode of file to 133 -- +bool(true) +-- Changing mode of file to 134 -- +bool(true) +-- Changing mode of file to 135 -- +bool(true) +-- Changing mode of file to 136 -- +bool(true) +-- Changing mode of file to 137 -- +bool(true) +-- Changing mode of file to 138 -- +bool(true) +-- Changing mode of file to 139 -- +bool(true) +-- Changing mode of file to 140 -- +bool(true) +-- Changing mode of file to 141 -- +bool(true) +-- Changing mode of file to 142 -- +bool(true) +-- Changing mode of file to 143 -- +bool(true) +-- Changing mode of file to 144 -- +bool(true) +-- Changing mode of file to 145 -- +bool(true) +-- Changing mode of file to 146 -- +bool(true) +-- Changing mode of file to 147 -- +bool(true) +-- Changing mode of file to 148 -- +bool(true) +-- Changing mode of file to 149 -- +bool(true) +-- Changing mode of file to 150 -- +bool(true) +-- Changing mode of file to 151 -- +bool(true) +-- Changing mode of file to 152 -- +bool(true) +-- Changing mode of file to 153 -- +bool(true) +-- Changing mode of file to 154 -- +bool(true) +-- Changing mode of file to 155 -- +bool(true) +-- Changing mode of file to 156 -- +bool(true) +-- Changing mode of file to 157 -- +bool(true) +-- Changing mode of file to 158 -- +bool(true) +-- Changing mode of file to 159 -- +bool(true) +-- Changing mode of file to 160 -- +bool(true) +-- Changing mode of file to 161 -- +bool(true) +-- Changing mode of file to 162 -- +bool(true) +-- Changing mode of file to 163 -- +bool(true) +-- Changing mode of file to 164 -- +bool(true) +-- Changing mode of file to 165 -- +bool(true) +-- Changing mode of file to 166 -- +bool(true) +-- Changing mode of file to 167 -- +bool(true) +-- Changing mode of file to 168 -- +bool(true) +-- Changing mode of file to 169 -- +bool(true) +-- Changing mode of file to 170 -- +bool(true) +-- Changing mode of file to 171 -- +bool(true) +-- Changing mode of file to 172 -- +bool(true) +-- Changing mode of file to 173 -- +bool(true) +-- Changing mode of file to 174 -- +bool(true) +-- Changing mode of file to 175 -- +bool(true) +-- Changing mode of file to 176 -- +bool(true) +-- Changing mode of file to 177 -- +bool(true) +-- Changing mode of file to 178 -- +bool(true) +-- Changing mode of file to 179 -- +bool(true) +-- Changing mode of file to 180 -- +bool(true) +-- Changing mode of file to 181 -- +bool(true) +-- Changing mode of file to 182 -- +bool(true) +-- Changing mode of file to 183 -- +bool(true) +-- Changing mode of file to 184 -- +bool(true) +-- Changing mode of file to 185 -- +bool(true) +-- Changing mode of file to 186 -- +bool(true) +-- Changing mode of file to 187 -- +bool(true) +-- Changing mode of file to 188 -- +bool(true) +-- Changing mode of file to 189 -- +bool(true) +-- Changing mode of file to 190 -- +bool(true) +-- Changing mode of file to 191 -- +bool(true) +-- Changing mode of file to 192 -- +bool(true) +-- Changing mode of file to 193 -- +bool(true) +-- Changing mode of file to 194 -- +bool(true) +-- Changing mode of file to 195 -- +bool(true) +-- Changing mode of file to 196 -- +bool(true) +-- Changing mode of file to 197 -- +bool(true) +-- Changing mode of file to 198 -- +bool(true) +-- Changing mode of file to 199 -- +bool(true) +-- Changing mode of file to 200 -- +bool(true) +-- Changing mode of file to 201 -- +bool(true) +-- Changing mode of file to 202 -- +bool(true) +-- Changing mode of file to 203 -- +bool(true) +-- Changing mode of file to 204 -- +bool(true) +-- Changing mode of file to 205 -- +bool(true) +-- Changing mode of file to 206 -- +bool(true) +-- Changing mode of file to 207 -- +bool(true) +-- Changing mode of file to 208 -- +bool(true) +-- Changing mode of file to 209 -- +bool(true) +-- Changing mode of file to 210 -- +bool(true) +-- Changing mode of file to 211 -- +bool(true) +-- Changing mode of file to 212 -- +bool(true) +-- Changing mode of file to 213 -- +bool(true) +-- Changing mode of file to 214 -- +bool(true) +-- Changing mode of file to 215 -- +bool(true) +-- Changing mode of file to 216 -- +bool(true) +-- Changing mode of file to 217 -- +bool(true) +-- Changing mode of file to 218 -- +bool(true) +-- Changing mode of file to 219 -- +bool(true) +-- Changing mode of file to 220 -- +bool(true) +-- Changing mode of file to 221 -- +bool(true) +-- Changing mode of file to 222 -- +bool(true) +-- Changing mode of file to 223 -- +bool(true) +-- Changing mode of file to 224 -- +bool(true) +-- Changing mode of file to 225 -- +bool(true) +-- Changing mode of file to 226 -- +bool(true) +-- Changing mode of file to 227 -- +bool(true) +-- Changing mode of file to 228 -- +bool(true) +-- Changing mode of file to 229 -- +bool(true) +-- Changing mode of file to 230 -- +bool(true) +-- Changing mode of file to 231 -- +bool(true) +-- Changing mode of file to 232 -- +bool(true) +-- Changing mode of file to 233 -- +bool(true) +-- Changing mode of file to 234 -- +bool(true) +-- Changing mode of file to 235 -- +bool(true) +-- Changing mode of file to 236 -- +bool(true) +-- Changing mode of file to 237 -- +bool(true) +-- Changing mode of file to 238 -- +bool(true) +-- Changing mode of file to 239 -- +bool(true) +-- Changing mode of file to 240 -- +bool(true) +-- Changing mode of file to 241 -- +bool(true) +-- Changing mode of file to 242 -- +bool(true) +-- Changing mode of file to 243 -- +bool(true) +-- Changing mode of file to 244 -- +bool(true) +-- Changing mode of file to 245 -- +bool(true) +-- Changing mode of file to 246 -- +bool(true) +-- Changing mode of file to 247 -- +bool(true) +-- Changing mode of file to 248 -- +bool(true) +-- Changing mode of file to 249 -- +bool(true) +-- Changing mode of file to 250 -- +bool(true) +-- Changing mode of file to 251 -- +bool(true) +-- Changing mode of file to 252 -- +bool(true) +-- Changing mode of file to 253 -- +bool(true) +-- Changing mode of file to 254 -- +bool(true) +-- Changing mode of file to 255 -- +bool(true) +-- Changing mode of file to 256 -- +bool(true) +-- Changing mode of file to 257 -- +bool(true) +-- Changing mode of file to 258 -- +bool(true) +-- Changing mode of file to 259 -- +bool(true) +-- Changing mode of file to 260 -- +bool(true) +-- Changing mode of file to 261 -- +bool(true) +-- Changing mode of file to 262 -- +bool(true) +-- Changing mode of file to 263 -- +bool(true) +-- Changing mode of file to 264 -- +bool(true) +-- Changing mode of file to 265 -- +bool(true) +-- Changing mode of file to 266 -- +bool(true) +-- Changing mode of file to 267 -- +bool(true) +-- Changing mode of file to 268 -- +bool(true) +-- Changing mode of file to 269 -- +bool(true) +-- Changing mode of file to 270 -- +bool(true) +-- Changing mode of file to 271 -- +bool(true) +-- Changing mode of file to 272 -- +bool(true) +-- Changing mode of file to 273 -- +bool(true) +-- Changing mode of file to 274 -- +bool(true) +-- Changing mode of file to 275 -- +bool(true) +-- Changing mode of file to 276 -- +bool(true) +-- Changing mode of file to 277 -- +bool(true) +-- Changing mode of file to 278 -- +bool(true) +-- Changing mode of file to 279 -- +bool(true) +-- Changing mode of file to 280 -- +bool(true) +-- Changing mode of file to 281 -- +bool(true) +-- Changing mode of file to 282 -- +bool(true) +-- Changing mode of file to 283 -- +bool(true) +-- Changing mode of file to 284 -- +bool(true) +-- Changing mode of file to 285 -- +bool(true) +-- Changing mode of file to 286 -- +bool(true) +-- Changing mode of file to 287 -- +bool(true) +-- Changing mode of file to 288 -- +bool(true) +-- Changing mode of file to 289 -- +bool(true) +-- Changing mode of file to 290 -- +bool(true) +-- Changing mode of file to 291 -- +bool(true) +-- Changing mode of file to 292 -- +bool(true) +-- Changing mode of file to 293 -- +bool(true) +-- Changing mode of file to 294 -- +bool(true) +-- Changing mode of file to 295 -- +bool(true) +-- Changing mode of file to 296 -- +bool(true) +-- Changing mode of file to 297 -- +bool(true) +-- Changing mode of file to 298 -- +bool(true) +-- Changing mode of file to 299 -- +bool(true) +-- Changing mode of file to 300 -- +bool(true) +-- Changing mode of file to 301 -- +bool(true) +-- Changing mode of file to 302 -- +bool(true) +-- Changing mode of file to 303 -- +bool(true) +-- Changing mode of file to 304 -- +bool(true) +-- Changing mode of file to 305 -- +bool(true) +-- Changing mode of file to 306 -- +bool(true) +-- Changing mode of file to 307 -- +bool(true) +-- Changing mode of file to 308 -- +bool(true) +-- Changing mode of file to 309 -- +bool(true) +-- Changing mode of file to 310 -- +bool(true) +-- Changing mode of file to 311 -- +bool(true) +-- Changing mode of file to 312 -- +bool(true) +-- Changing mode of file to 313 -- +bool(true) +-- Changing mode of file to 314 -- +bool(true) +-- Changing mode of file to 315 -- +bool(true) +-- Changing mode of file to 316 -- +bool(true) +-- Changing mode of file to 317 -- +bool(true) +-- Changing mode of file to 318 -- +bool(true) +-- Changing mode of file to 319 -- +bool(true) +-- Changing mode of file to 320 -- +bool(true) +-- Changing mode of file to 321 -- +bool(true) +-- Changing mode of file to 322 -- +bool(true) +-- Changing mode of file to 323 -- +bool(true) +-- Changing mode of file to 324 -- +bool(true) +-- Changing mode of file to 325 -- +bool(true) +-- Changing mode of file to 326 -- +bool(true) +-- Changing mode of file to 327 -- +bool(true) +-- Changing mode of file to 328 -- +bool(true) +-- Changing mode of file to 329 -- +bool(true) +-- Changing mode of file to 330 -- +bool(true) +-- Changing mode of file to 331 -- +bool(true) +-- Changing mode of file to 332 -- +bool(true) +-- Changing mode of file to 333 -- +bool(true) +-- Changing mode of file to 334 -- +bool(true) +-- Changing mode of file to 335 -- +bool(true) +-- Changing mode of file to 336 -- +bool(true) +-- Changing mode of file to 337 -- +bool(true) +-- Changing mode of file to 338 -- +bool(true) +-- Changing mode of file to 339 -- +bool(true) +-- Changing mode of file to 340 -- +bool(true) +-- Changing mode of file to 341 -- +bool(true) +-- Changing mode of file to 342 -- +bool(true) +-- Changing mode of file to 343 -- +bool(true) +-- Changing mode of file to 344 -- +bool(true) +-- Changing mode of file to 345 -- +bool(true) +-- Changing mode of file to 346 -- +bool(true) +-- Changing mode of file to 347 -- +bool(true) +-- Changing mode of file to 348 -- +bool(true) +-- Changing mode of file to 349 -- +bool(true) +-- Changing mode of file to 350 -- +bool(true) +-- Changing mode of file to 351 -- +bool(true) +-- Changing mode of file to 352 -- +bool(true) +-- Changing mode of file to 353 -- +bool(true) +-- Changing mode of file to 354 -- +bool(true) +-- Changing mode of file to 355 -- +bool(true) +-- Changing mode of file to 356 -- +bool(true) +-- Changing mode of file to 357 -- +bool(true) +-- Changing mode of file to 358 -- +bool(true) +-- Changing mode of file to 359 -- +bool(true) +-- Changing mode of file to 360 -- +bool(true) +-- Changing mode of file to 361 -- +bool(true) +-- Changing mode of file to 362 -- +bool(true) +-- Changing mode of file to 363 -- +bool(true) +-- Changing mode of file to 364 -- +bool(true) +-- Changing mode of file to 365 -- +bool(true) +-- Changing mode of file to 366 -- +bool(true) +-- Changing mode of file to 367 -- +bool(true) +-- Changing mode of file to 368 -- +bool(true) +-- Changing mode of file to 369 -- +bool(true) +-- Changing mode of file to 370 -- +bool(true) +-- Changing mode of file to 371 -- +bool(true) +-- Changing mode of file to 372 -- +bool(true) +-- Changing mode of file to 373 -- +bool(true) +-- Changing mode of file to 374 -- +bool(true) +-- Changing mode of file to 375 -- +bool(true) +-- Changing mode of file to 376 -- +bool(true) +-- Changing mode of file to 377 -- +bool(true) +-- Changing mode of file to 378 -- +bool(true) +-- Changing mode of file to 379 -- +bool(true) +-- Changing mode of file to 380 -- +bool(true) +-- Changing mode of file to 381 -- +bool(true) +-- Changing mode of file to 382 -- +bool(true) +-- Changing mode of file to 383 -- +bool(true) +-- Changing mode of file to 384 -- +bool(true) +-- Changing mode of file to 385 -- +bool(true) +-- Changing mode of file to 386 -- +bool(true) +-- Changing mode of file to 387 -- +bool(true) +-- Changing mode of file to 388 -- +bool(true) +-- Changing mode of file to 389 -- +bool(true) +-- Changing mode of file to 390 -- +bool(true) +-- Changing mode of file to 391 -- +bool(true) +-- Changing mode of file to 392 -- +bool(true) +-- Changing mode of file to 393 -- +bool(true) +-- Changing mode of file to 394 -- +bool(true) +-- Changing mode of file to 395 -- +bool(true) +-- Changing mode of file to 396 -- +bool(true) +-- Changing mode of file to 397 -- +bool(true) +-- Changing mode of file to 398 -- +bool(true) +-- Changing mode of file to 399 -- +bool(true) +-- Changing mode of file to 400 -- +bool(true) +-- Changing mode of file to 401 -- +bool(true) +-- Changing mode of file to 402 -- +bool(true) +-- Changing mode of file to 403 -- +bool(true) +-- Changing mode of file to 404 -- +bool(true) +-- Changing mode of file to 405 -- +bool(true) +-- Changing mode of file to 406 -- +bool(true) +-- Changing mode of file to 407 -- +bool(true) +-- Changing mode of file to 408 -- +bool(true) +-- Changing mode of file to 409 -- +bool(true) +-- Changing mode of file to 410 -- +bool(true) +-- Changing mode of file to 411 -- +bool(true) +-- Changing mode of file to 412 -- +bool(true) +-- Changing mode of file to 413 -- +bool(true) +-- Changing mode of file to 414 -- +bool(true) +-- Changing mode of file to 415 -- +bool(true) +-- Changing mode of file to 416 -- +bool(true) +-- Changing mode of file to 417 -- +bool(true) +-- Changing mode of file to 418 -- +bool(true) +-- Changing mode of file to 419 -- +bool(true) +-- Changing mode of file to 420 -- +bool(true) +-- Changing mode of file to 421 -- +bool(true) +-- Changing mode of file to 422 -- +bool(true) +-- Changing mode of file to 423 -- +bool(true) +-- Changing mode of file to 424 -- +bool(true) +-- Changing mode of file to 425 -- +bool(true) +-- Changing mode of file to 426 -- +bool(true) +-- Changing mode of file to 427 -- +bool(true) +-- Changing mode of file to 428 -- +bool(true) +-- Changing mode of file to 429 -- +bool(true) +-- Changing mode of file to 430 -- +bool(true) +-- Changing mode of file to 431 -- +bool(true) +-- Changing mode of file to 432 -- +bool(true) +-- Changing mode of file to 433 -- +bool(true) +-- Changing mode of file to 434 -- +bool(true) +-- Changing mode of file to 435 -- +bool(true) +-- Changing mode of file to 436 -- +bool(true) +-- Changing mode of file to 437 -- +bool(true) +-- Changing mode of file to 438 -- +bool(true) +-- Changing mode of file to 439 -- +bool(true) +-- Changing mode of file to 440 -- +bool(true) +-- Changing mode of file to 441 -- +bool(true) +-- Changing mode of file to 442 -- +bool(true) +-- Changing mode of file to 443 -- +bool(true) +-- Changing mode of file to 444 -- +bool(true) +-- Changing mode of file to 445 -- +bool(true) +-- Changing mode of file to 446 -- +bool(true) +-- Changing mode of file to 447 -- +bool(true) +-- Changing mode of file to 448 -- +bool(true) +-- Changing mode of file to 449 -- +bool(true) +-- Changing mode of file to 450 -- +bool(true) +-- Changing mode of file to 451 -- +bool(true) +-- Changing mode of file to 452 -- +bool(true) +-- Changing mode of file to 453 -- +bool(true) +-- Changing mode of file to 454 -- +bool(true) +-- Changing mode of file to 455 -- +bool(true) +-- Changing mode of file to 456 -- +bool(true) +-- Changing mode of file to 457 -- +bool(true) +-- Changing mode of file to 458 -- +bool(true) +-- Changing mode of file to 459 -- +bool(true) +-- Changing mode of file to 460 -- +bool(true) +-- Changing mode of file to 461 -- +bool(true) +-- Changing mode of file to 462 -- +bool(true) +-- Changing mode of file to 463 -- +bool(true) +-- Changing mode of file to 464 -- +bool(true) +-- Changing mode of file to 465 -- +bool(true) +-- Changing mode of file to 466 -- +bool(true) +-- Changing mode of file to 467 -- +bool(true) +-- Changing mode of file to 468 -- +bool(true) +-- Changing mode of file to 469 -- +bool(true) +-- Changing mode of file to 470 -- +bool(true) +-- Changing mode of file to 471 -- +bool(true) +-- Changing mode of file to 472 -- +bool(true) +-- Changing mode of file to 473 -- +bool(true) +-- Changing mode of file to 474 -- +bool(true) +-- Changing mode of file to 475 -- +bool(true) +-- Changing mode of file to 476 -- +bool(true) +-- Changing mode of file to 477 -- +bool(true) +-- Changing mode of file to 478 -- +bool(true) +-- Changing mode of file to 479 -- +bool(true) +-- Changing mode of file to 480 -- +bool(true) +-- Changing mode of file to 481 -- +bool(true) +-- Changing mode of file to 482 -- +bool(true) +-- Changing mode of file to 483 -- +bool(true) +-- Changing mode of file to 484 -- +bool(true) +-- Changing mode of file to 485 -- +bool(true) +-- Changing mode of file to 486 -- +bool(true) +-- Changing mode of file to 487 -- +bool(true) +-- Changing mode of file to 488 -- +bool(true) +-- Changing mode of file to 489 -- +bool(true) +-- Changing mode of file to 490 -- +bool(true) +-- Changing mode of file to 491 -- +bool(true) +-- Changing mode of file to 492 -- +bool(true) +-- Changing mode of file to 493 -- +bool(true) +-- Changing mode of file to 494 -- +bool(true) +-- Changing mode of file to 495 -- +bool(true) +-- Changing mode of file to 496 -- +bool(true) +-- Changing mode of file to 497 -- +bool(true) +-- Changing mode of file to 498 -- +bool(true) +-- Changing mode of file to 499 -- +bool(true) +-- Changing mode of file to 500 -- +bool(true) +-- Changing mode of file to 501 -- +bool(true) +-- Changing mode of file to 502 -- +bool(true) +-- Changing mode of file to 503 -- +bool(true) +-- Changing mode of file to 504 -- +bool(true) +-- Changing mode of file to 505 -- +bool(true) +-- Changing mode of file to 506 -- +bool(true) +-- Changing mode of file to 507 -- +bool(true) +-- Changing mode of file to 508 -- +bool(true) +-- Changing mode of file to 509 -- +bool(true) +-- Changing mode of file to 510 -- +bool(true) +-- Changing mode of file to 511 -- +bool(true) +Done diff --git a/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt b/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt new file mode 100644 index 0000000000..785644d8b0 --- /dev/null +++ b/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt @@ -0,0 +1,1613 @@ +--TEST-- +Test mkdir() and rmdir() functions: usage variations +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: bool mkdir ( string $pathname [, int $mode [, bool $recursive [, resource $context]]] ); + Description: Makes directory +*/ + +echo "*** Testing mkdir() and rmdir() for different permissions ***\n"; + +$context = stream_context_create(); + +$file_path = dirname(__FILE__); +$counter = 1; + +for($mode = 0000; $mode <= 0777; $mode++) { + echo "-- Changing mode of directory to $mode --\n"; + var_dump( mkdir("$file_path/mkdir私はガラスを食べられます/", $mode, true) ); + var_dump( rmdir("$file_path/mkdir私はガラスを食べられます/") ); + $counter++; +} + +echo "\n*** Testing mkdir() and rmdir() by giving stream context as fourth argument ***\n"; +var_dump( mkdir("$file_path/mkdir私はガラスを食べられます/test/", 0777, true, $context) ); +var_dump( rmdir("$file_path/mkdir私はガラスを食べられます/test/", $context) ); + +echo "\n*** Testing rmdir() on a non-empty directory ***\n"; +var_dump( mkdir("$file_path/mkdir私はガラスを食べられます/test/", 0777, true) ); +var_dump( rmdir("$file_path/mkdir私はガラスを食べられます/") ); + +echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; +var_dump( mkdir("$file_path/tempx000/") ); +var_dump( rmdir("$file_path/tempx000/") ); + +echo "\n*** Testing mkdir() with miscelleneous input ***\n"; +/* changing mode of mkdir to prevent creating sub-directory under it */ +var_dump( chmod("$file_path/mkdir私はガラスを食べられます/", 0000) ); +/* creating sub-directory test1 under mkdir, expected: false */ +var_dump( mkdir("$file_path/mkdir私はガラスを食べられます/test1", 0777, true) ); +var_dump( chmod("$file_path/mkdir私はガラスを食べられます/", 0777) ); // chmod to enable removing test1 directory + +echo "Done\n"; +?> +--CLEAN-- +<?php +rmdir(dirname(__FILE__)."/mkdir私はガラスを食べられます/test/"); +rmdir(dirname(__FILE__)."/mkdir私はガラスを食べられます/test1/"); +rmdir(dirname(__FILE__)."/mkdir私はガラスを食べられます/"); +?> +--EXPECTF-- +*** Testing mkdir() and rmdir() for different permissions *** +-- Changing mode of directory to 0 -- +bool(true) +bool(true) +-- Changing mode of directory to 1 -- +bool(true) +bool(true) +-- Changing mode of directory to 2 -- +bool(true) +bool(true) +-- Changing mode of directory to 3 -- +bool(true) +bool(true) +-- Changing mode of directory to 4 -- +bool(true) +bool(true) +-- Changing mode of directory to 5 -- +bool(true) +bool(true) +-- Changing mode of directory to 6 -- +bool(true) +bool(true) +-- Changing mode of directory to 7 -- +bool(true) +bool(true) +-- Changing mode of directory to 8 -- +bool(true) +bool(true) +-- Changing mode of directory to 9 -- +bool(true) +bool(true) +-- Changing mode of directory to 10 -- +bool(true) +bool(true) +-- Changing mode of directory to 11 -- +bool(true) +bool(true) +-- Changing mode of directory to 12 -- +bool(true) +bool(true) +-- Changing mode of directory to 13 -- +bool(true) +bool(true) +-- Changing mode of directory to 14 -- +bool(true) +bool(true) +-- Changing mode of directory to 15 -- +bool(true) +bool(true) +-- Changing mode of directory to 16 -- +bool(true) +bool(true) +-- Changing mode of directory to 17 -- +bool(true) +bool(true) +-- Changing mode of directory to 18 -- +bool(true) +bool(true) +-- Changing mode of directory to 19 -- +bool(true) +bool(true) +-- Changing mode of directory to 20 -- +bool(true) +bool(true) +-- Changing mode of directory to 21 -- +bool(true) +bool(true) +-- Changing mode of directory to 22 -- +bool(true) +bool(true) +-- Changing mode of directory to 23 -- +bool(true) +bool(true) +-- Changing mode of directory to 24 -- +bool(true) +bool(true) +-- Changing mode of directory to 25 -- +bool(true) +bool(true) +-- Changing mode of directory to 26 -- +bool(true) +bool(true) +-- Changing mode of directory to 27 -- +bool(true) +bool(true) +-- Changing mode of directory to 28 -- +bool(true) +bool(true) +-- Changing mode of directory to 29 -- +bool(true) +bool(true) +-- Changing mode of directory to 30 -- +bool(true) +bool(true) +-- Changing mode of directory to 31 -- +bool(true) +bool(true) +-- Changing mode of directory to 32 -- +bool(true) +bool(true) +-- Changing mode of directory to 33 -- +bool(true) +bool(true) +-- Changing mode of directory to 34 -- +bool(true) +bool(true) +-- Changing mode of directory to 35 -- +bool(true) +bool(true) +-- Changing mode of directory to 36 -- +bool(true) +bool(true) +-- Changing mode of directory to 37 -- +bool(true) +bool(true) +-- Changing mode of directory to 38 -- +bool(true) +bool(true) +-- Changing mode of directory to 39 -- +bool(true) +bool(true) +-- Changing mode of directory to 40 -- +bool(true) +bool(true) +-- Changing mode of directory to 41 -- +bool(true) +bool(true) +-- Changing mode of directory to 42 -- +bool(true) +bool(true) +-- Changing mode of directory to 43 -- +bool(true) +bool(true) +-- Changing mode of directory to 44 -- +bool(true) +bool(true) +-- Changing mode of directory to 45 -- +bool(true) +bool(true) +-- Changing mode of directory to 46 -- +bool(true) +bool(true) +-- Changing mode of directory to 47 -- +bool(true) +bool(true) +-- Changing mode of directory to 48 -- +bool(true) +bool(true) +-- Changing mode of directory to 49 -- +bool(true) +bool(true) +-- Changing mode of directory to 50 -- +bool(true) +bool(true) +-- Changing mode of directory to 51 -- +bool(true) +bool(true) +-- Changing mode of directory to 52 -- +bool(true) +bool(true) +-- Changing mode of directory to 53 -- +bool(true) +bool(true) +-- Changing mode of directory to 54 -- +bool(true) +bool(true) +-- Changing mode of directory to 55 -- +bool(true) +bool(true) +-- Changing mode of directory to 56 -- +bool(true) +bool(true) +-- Changing mode of directory to 57 -- +bool(true) +bool(true) +-- Changing mode of directory to 58 -- +bool(true) +bool(true) +-- Changing mode of directory to 59 -- +bool(true) +bool(true) +-- Changing mode of directory to 60 -- +bool(true) +bool(true) +-- Changing mode of directory to 61 -- +bool(true) +bool(true) +-- Changing mode of directory to 62 -- +bool(true) +bool(true) +-- Changing mode of directory to 63 -- +bool(true) +bool(true) +-- Changing mode of directory to 64 -- +bool(true) +bool(true) +-- Changing mode of directory to 65 -- +bool(true) +bool(true) +-- Changing mode of directory to 66 -- +bool(true) +bool(true) +-- Changing mode of directory to 67 -- +bool(true) +bool(true) +-- Changing mode of directory to 68 -- +bool(true) +bool(true) +-- Changing mode of directory to 69 -- +bool(true) +bool(true) +-- Changing mode of directory to 70 -- +bool(true) +bool(true) +-- Changing mode of directory to 71 -- +bool(true) +bool(true) +-- Changing mode of directory to 72 -- +bool(true) +bool(true) +-- Changing mode of directory to 73 -- +bool(true) +bool(true) +-- Changing mode of directory to 74 -- +bool(true) +bool(true) +-- Changing mode of directory to 75 -- +bool(true) +bool(true) +-- Changing mode of directory to 76 -- +bool(true) +bool(true) +-- Changing mode of directory to 77 -- +bool(true) +bool(true) +-- Changing mode of directory to 78 -- +bool(true) +bool(true) +-- Changing mode of directory to 79 -- +bool(true) +bool(true) +-- Changing mode of directory to 80 -- +bool(true) +bool(true) +-- Changing mode of directory to 81 -- +bool(true) +bool(true) +-- Changing mode of directory to 82 -- +bool(true) +bool(true) +-- Changing mode of directory to 83 -- +bool(true) +bool(true) +-- Changing mode of directory to 84 -- +bool(true) +bool(true) +-- Changing mode of directory to 85 -- +bool(true) +bool(true) +-- Changing mode of directory to 86 -- +bool(true) +bool(true) +-- Changing mode of directory to 87 -- +bool(true) +bool(true) +-- Changing mode of directory to 88 -- +bool(true) +bool(true) +-- Changing mode of directory to 89 -- +bool(true) +bool(true) +-- Changing mode of directory to 90 -- +bool(true) +bool(true) +-- Changing mode of directory to 91 -- +bool(true) +bool(true) +-- Changing mode of directory to 92 -- +bool(true) +bool(true) +-- Changing mode of directory to 93 -- +bool(true) +bool(true) +-- Changing mode of directory to 94 -- +bool(true) +bool(true) +-- Changing mode of directory to 95 -- +bool(true) +bool(true) +-- Changing mode of directory to 96 -- +bool(true) +bool(true) +-- Changing mode of directory to 97 -- +bool(true) +bool(true) +-- Changing mode of directory to 98 -- +bool(true) +bool(true) +-- Changing mode of directory to 99 -- +bool(true) +bool(true) +-- Changing mode of directory to 100 -- +bool(true) +bool(true) +-- Changing mode of directory to 101 -- +bool(true) +bool(true) +-- Changing mode of directory to 102 -- +bool(true) +bool(true) +-- Changing mode of directory to 103 -- +bool(true) +bool(true) +-- Changing mode of directory to 104 -- +bool(true) +bool(true) +-- Changing mode of directory to 105 -- +bool(true) +bool(true) +-- Changing mode of directory to 106 -- +bool(true) +bool(true) +-- Changing mode of directory to 107 -- +bool(true) +bool(true) +-- Changing mode of directory to 108 -- +bool(true) +bool(true) +-- Changing mode of directory to 109 -- +bool(true) +bool(true) +-- Changing mode of directory to 110 -- +bool(true) +bool(true) +-- Changing mode of directory to 111 -- +bool(true) +bool(true) +-- Changing mode of directory to 112 -- +bool(true) +bool(true) +-- Changing mode of directory to 113 -- +bool(true) +bool(true) +-- Changing mode of directory to 114 -- +bool(true) +bool(true) +-- Changing mode of directory to 115 -- +bool(true) +bool(true) +-- Changing mode of directory to 116 -- +bool(true) +bool(true) +-- Changing mode of directory to 117 -- +bool(true) +bool(true) +-- Changing mode of directory to 118 -- +bool(true) +bool(true) +-- Changing mode of directory to 119 -- +bool(true) +bool(true) +-- Changing mode of directory to 120 -- +bool(true) +bool(true) +-- Changing mode of directory to 121 -- +bool(true) +bool(true) +-- Changing mode of directory to 122 -- +bool(true) +bool(true) +-- Changing mode of directory to 123 -- +bool(true) +bool(true) +-- Changing mode of directory to 124 -- +bool(true) +bool(true) +-- Changing mode of directory to 125 -- +bool(true) +bool(true) +-- Changing mode of directory to 126 -- +bool(true) +bool(true) +-- Changing mode of directory to 127 -- +bool(true) +bool(true) +-- Changing mode of directory to 128 -- +bool(true) +bool(true) +-- Changing mode of directory to 129 -- +bool(true) +bool(true) +-- Changing mode of directory to 130 -- +bool(true) +bool(true) +-- Changing mode of directory to 131 -- +bool(true) +bool(true) +-- Changing mode of directory to 132 -- +bool(true) +bool(true) +-- Changing mode of directory to 133 -- +bool(true) +bool(true) +-- Changing mode of directory to 134 -- +bool(true) +bool(true) +-- Changing mode of directory to 135 -- +bool(true) +bool(true) +-- Changing mode of directory to 136 -- +bool(true) +bool(true) +-- Changing mode of directory to 137 -- +bool(true) +bool(true) +-- Changing mode of directory to 138 -- +bool(true) +bool(true) +-- Changing mode of directory to 139 -- +bool(true) +bool(true) +-- Changing mode of directory to 140 -- +bool(true) +bool(true) +-- Changing mode of directory to 141 -- +bool(true) +bool(true) +-- Changing mode of directory to 142 -- +bool(true) +bool(true) +-- Changing mode of directory to 143 -- +bool(true) +bool(true) +-- Changing mode of directory to 144 -- +bool(true) +bool(true) +-- Changing mode of directory to 145 -- +bool(true) +bool(true) +-- Changing mode of directory to 146 -- +bool(true) +bool(true) +-- Changing mode of directory to 147 -- +bool(true) +bool(true) +-- Changing mode of directory to 148 -- +bool(true) +bool(true) +-- Changing mode of directory to 149 -- +bool(true) +bool(true) +-- Changing mode of directory to 150 -- +bool(true) +bool(true) +-- Changing mode of directory to 151 -- +bool(true) +bool(true) +-- Changing mode of directory to 152 -- +bool(true) +bool(true) +-- Changing mode of directory to 153 -- +bool(true) +bool(true) +-- Changing mode of directory to 154 -- +bool(true) +bool(true) +-- Changing mode of directory to 155 -- +bool(true) +bool(true) +-- Changing mode of directory to 156 -- +bool(true) +bool(true) +-- Changing mode of directory to 157 -- +bool(true) +bool(true) +-- Changing mode of directory to 158 -- +bool(true) +bool(true) +-- Changing mode of directory to 159 -- +bool(true) +bool(true) +-- Changing mode of directory to 160 -- +bool(true) +bool(true) +-- Changing mode of directory to 161 -- +bool(true) +bool(true) +-- Changing mode of directory to 162 -- +bool(true) +bool(true) +-- Changing mode of directory to 163 -- +bool(true) +bool(true) +-- Changing mode of directory to 164 -- +bool(true) +bool(true) +-- Changing mode of directory to 165 -- +bool(true) +bool(true) +-- Changing mode of directory to 166 -- +bool(true) +bool(true) +-- Changing mode of directory to 167 -- +bool(true) +bool(true) +-- Changing mode of directory to 168 -- +bool(true) +bool(true) +-- Changing mode of directory to 169 -- +bool(true) +bool(true) +-- Changing mode of directory to 170 -- +bool(true) +bool(true) +-- Changing mode of directory to 171 -- +bool(true) +bool(true) +-- Changing mode of directory to 172 -- +bool(true) +bool(true) +-- Changing mode of directory to 173 -- +bool(true) +bool(true) +-- Changing mode of directory to 174 -- +bool(true) +bool(true) +-- Changing mode of directory to 175 -- +bool(true) +bool(true) +-- Changing mode of directory to 176 -- +bool(true) +bool(true) +-- Changing mode of directory to 177 -- +bool(true) +bool(true) +-- Changing mode of directory to 178 -- +bool(true) +bool(true) +-- Changing mode of directory to 179 -- +bool(true) +bool(true) +-- Changing mode of directory to 180 -- +bool(true) +bool(true) +-- Changing mode of directory to 181 -- +bool(true) +bool(true) +-- Changing mode of directory to 182 -- +bool(true) +bool(true) +-- Changing mode of directory to 183 -- +bool(true) +bool(true) +-- Changing mode of directory to 184 -- +bool(true) +bool(true) +-- Changing mode of directory to 185 -- +bool(true) +bool(true) +-- Changing mode of directory to 186 -- +bool(true) +bool(true) +-- Changing mode of directory to 187 -- +bool(true) +bool(true) +-- Changing mode of directory to 188 -- +bool(true) +bool(true) +-- Changing mode of directory to 189 -- +bool(true) +bool(true) +-- Changing mode of directory to 190 -- +bool(true) +bool(true) +-- Changing mode of directory to 191 -- +bool(true) +bool(true) +-- Changing mode of directory to 192 -- +bool(true) +bool(true) +-- Changing mode of directory to 193 -- +bool(true) +bool(true) +-- Changing mode of directory to 194 -- +bool(true) +bool(true) +-- Changing mode of directory to 195 -- +bool(true) +bool(true) +-- Changing mode of directory to 196 -- +bool(true) +bool(true) +-- Changing mode of directory to 197 -- +bool(true) +bool(true) +-- Changing mode of directory to 198 -- +bool(true) +bool(true) +-- Changing mode of directory to 199 -- +bool(true) +bool(true) +-- Changing mode of directory to 200 -- +bool(true) +bool(true) +-- Changing mode of directory to 201 -- +bool(true) +bool(true) +-- Changing mode of directory to 202 -- +bool(true) +bool(true) +-- Changing mode of directory to 203 -- +bool(true) +bool(true) +-- Changing mode of directory to 204 -- +bool(true) +bool(true) +-- Changing mode of directory to 205 -- +bool(true) +bool(true) +-- Changing mode of directory to 206 -- +bool(true) +bool(true) +-- Changing mode of directory to 207 -- +bool(true) +bool(true) +-- Changing mode of directory to 208 -- +bool(true) +bool(true) +-- Changing mode of directory to 209 -- +bool(true) +bool(true) +-- Changing mode of directory to 210 -- +bool(true) +bool(true) +-- Changing mode of directory to 211 -- +bool(true) +bool(true) +-- Changing mode of directory to 212 -- +bool(true) +bool(true) +-- Changing mode of directory to 213 -- +bool(true) +bool(true) +-- Changing mode of directory to 214 -- +bool(true) +bool(true) +-- Changing mode of directory to 215 -- +bool(true) +bool(true) +-- Changing mode of directory to 216 -- +bool(true) +bool(true) +-- Changing mode of directory to 217 -- +bool(true) +bool(true) +-- Changing mode of directory to 218 -- +bool(true) +bool(true) +-- Changing mode of directory to 219 -- +bool(true) +bool(true) +-- Changing mode of directory to 220 -- +bool(true) +bool(true) +-- Changing mode of directory to 221 -- +bool(true) +bool(true) +-- Changing mode of directory to 222 -- +bool(true) +bool(true) +-- Changing mode of directory to 223 -- +bool(true) +bool(true) +-- Changing mode of directory to 224 -- +bool(true) +bool(true) +-- Changing mode of directory to 225 -- +bool(true) +bool(true) +-- Changing mode of directory to 226 -- +bool(true) +bool(true) +-- Changing mode of directory to 227 -- +bool(true) +bool(true) +-- Changing mode of directory to 228 -- +bool(true) +bool(true) +-- Changing mode of directory to 229 -- +bool(true) +bool(true) +-- Changing mode of directory to 230 -- +bool(true) +bool(true) +-- Changing mode of directory to 231 -- +bool(true) +bool(true) +-- Changing mode of directory to 232 -- +bool(true) +bool(true) +-- Changing mode of directory to 233 -- +bool(true) +bool(true) +-- Changing mode of directory to 234 -- +bool(true) +bool(true) +-- Changing mode of directory to 235 -- +bool(true) +bool(true) +-- Changing mode of directory to 236 -- +bool(true) +bool(true) +-- Changing mode of directory to 237 -- +bool(true) +bool(true) +-- Changing mode of directory to 238 -- +bool(true) +bool(true) +-- Changing mode of directory to 239 -- +bool(true) +bool(true) +-- Changing mode of directory to 240 -- +bool(true) +bool(true) +-- Changing mode of directory to 241 -- +bool(true) +bool(true) +-- Changing mode of directory to 242 -- +bool(true) +bool(true) +-- Changing mode of directory to 243 -- +bool(true) +bool(true) +-- Changing mode of directory to 244 -- +bool(true) +bool(true) +-- Changing mode of directory to 245 -- +bool(true) +bool(true) +-- Changing mode of directory to 246 -- +bool(true) +bool(true) +-- Changing mode of directory to 247 -- +bool(true) +bool(true) +-- Changing mode of directory to 248 -- +bool(true) +bool(true) +-- Changing mode of directory to 249 -- +bool(true) +bool(true) +-- Changing mode of directory to 250 -- +bool(true) +bool(true) +-- Changing mode of directory to 251 -- +bool(true) +bool(true) +-- Changing mode of directory to 252 -- +bool(true) +bool(true) +-- Changing mode of directory to 253 -- +bool(true) +bool(true) +-- Changing mode of directory to 254 -- +bool(true) +bool(true) +-- Changing mode of directory to 255 -- +bool(true) +bool(true) +-- Changing mode of directory to 256 -- +bool(true) +bool(true) +-- Changing mode of directory to 257 -- +bool(true) +bool(true) +-- Changing mode of directory to 258 -- +bool(true) +bool(true) +-- Changing mode of directory to 259 -- +bool(true) +bool(true) +-- Changing mode of directory to 260 -- +bool(true) +bool(true) +-- Changing mode of directory to 261 -- +bool(true) +bool(true) +-- Changing mode of directory to 262 -- +bool(true) +bool(true) +-- Changing mode of directory to 263 -- +bool(true) +bool(true) +-- Changing mode of directory to 264 -- +bool(true) +bool(true) +-- Changing mode of directory to 265 -- +bool(true) +bool(true) +-- Changing mode of directory to 266 -- +bool(true) +bool(true) +-- Changing mode of directory to 267 -- +bool(true) +bool(true) +-- Changing mode of directory to 268 -- +bool(true) +bool(true) +-- Changing mode of directory to 269 -- +bool(true) +bool(true) +-- Changing mode of directory to 270 -- +bool(true) +bool(true) +-- Changing mode of directory to 271 -- +bool(true) +bool(true) +-- Changing mode of directory to 272 -- +bool(true) +bool(true) +-- Changing mode of directory to 273 -- +bool(true) +bool(true) +-- Changing mode of directory to 274 -- +bool(true) +bool(true) +-- Changing mode of directory to 275 -- +bool(true) +bool(true) +-- Changing mode of directory to 276 -- +bool(true) +bool(true) +-- Changing mode of directory to 277 -- +bool(true) +bool(true) +-- Changing mode of directory to 278 -- +bool(true) +bool(true) +-- Changing mode of directory to 279 -- +bool(true) +bool(true) +-- Changing mode of directory to 280 -- +bool(true) +bool(true) +-- Changing mode of directory to 281 -- +bool(true) +bool(true) +-- Changing mode of directory to 282 -- +bool(true) +bool(true) +-- Changing mode of directory to 283 -- +bool(true) +bool(true) +-- Changing mode of directory to 284 -- +bool(true) +bool(true) +-- Changing mode of directory to 285 -- +bool(true) +bool(true) +-- Changing mode of directory to 286 -- +bool(true) +bool(true) +-- Changing mode of directory to 287 -- +bool(true) +bool(true) +-- Changing mode of directory to 288 -- +bool(true) +bool(true) +-- Changing mode of directory to 289 -- +bool(true) +bool(true) +-- Changing mode of directory to 290 -- +bool(true) +bool(true) +-- Changing mode of directory to 291 -- +bool(true) +bool(true) +-- Changing mode of directory to 292 -- +bool(true) +bool(true) +-- Changing mode of directory to 293 -- +bool(true) +bool(true) +-- Changing mode of directory to 294 -- +bool(true) +bool(true) +-- Changing mode of directory to 295 -- +bool(true) +bool(true) +-- Changing mode of directory to 296 -- +bool(true) +bool(true) +-- Changing mode of directory to 297 -- +bool(true) +bool(true) +-- Changing mode of directory to 298 -- +bool(true) +bool(true) +-- Changing mode of directory to 299 -- +bool(true) +bool(true) +-- Changing mode of directory to 300 -- +bool(true) +bool(true) +-- Changing mode of directory to 301 -- +bool(true) +bool(true) +-- Changing mode of directory to 302 -- +bool(true) +bool(true) +-- Changing mode of directory to 303 -- +bool(true) +bool(true) +-- Changing mode of directory to 304 -- +bool(true) +bool(true) +-- Changing mode of directory to 305 -- +bool(true) +bool(true) +-- Changing mode of directory to 306 -- +bool(true) +bool(true) +-- Changing mode of directory to 307 -- +bool(true) +bool(true) +-- Changing mode of directory to 308 -- +bool(true) +bool(true) +-- Changing mode of directory to 309 -- +bool(true) +bool(true) +-- Changing mode of directory to 310 -- +bool(true) +bool(true) +-- Changing mode of directory to 311 -- +bool(true) +bool(true) +-- Changing mode of directory to 312 -- +bool(true) +bool(true) +-- Changing mode of directory to 313 -- +bool(true) +bool(true) +-- Changing mode of directory to 314 -- +bool(true) +bool(true) +-- Changing mode of directory to 315 -- +bool(true) +bool(true) +-- Changing mode of directory to 316 -- +bool(true) +bool(true) +-- Changing mode of directory to 317 -- +bool(true) +bool(true) +-- Changing mode of directory to 318 -- +bool(true) +bool(true) +-- Changing mode of directory to 319 -- +bool(true) +bool(true) +-- Changing mode of directory to 320 -- +bool(true) +bool(true) +-- Changing mode of directory to 321 -- +bool(true) +bool(true) +-- Changing mode of directory to 322 -- +bool(true) +bool(true) +-- Changing mode of directory to 323 -- +bool(true) +bool(true) +-- Changing mode of directory to 324 -- +bool(true) +bool(true) +-- Changing mode of directory to 325 -- +bool(true) +bool(true) +-- Changing mode of directory to 326 -- +bool(true) +bool(true) +-- Changing mode of directory to 327 -- +bool(true) +bool(true) +-- Changing mode of directory to 328 -- +bool(true) +bool(true) +-- Changing mode of directory to 329 -- +bool(true) +bool(true) +-- Changing mode of directory to 330 -- +bool(true) +bool(true) +-- Changing mode of directory to 331 -- +bool(true) +bool(true) +-- Changing mode of directory to 332 -- +bool(true) +bool(true) +-- Changing mode of directory to 333 -- +bool(true) +bool(true) +-- Changing mode of directory to 334 -- +bool(true) +bool(true) +-- Changing mode of directory to 335 -- +bool(true) +bool(true) +-- Changing mode of directory to 336 -- +bool(true) +bool(true) +-- Changing mode of directory to 337 -- +bool(true) +bool(true) +-- Changing mode of directory to 338 -- +bool(true) +bool(true) +-- Changing mode of directory to 339 -- +bool(true) +bool(true) +-- Changing mode of directory to 340 -- +bool(true) +bool(true) +-- Changing mode of directory to 341 -- +bool(true) +bool(true) +-- Changing mode of directory to 342 -- +bool(true) +bool(true) +-- Changing mode of directory to 343 -- +bool(true) +bool(true) +-- Changing mode of directory to 344 -- +bool(true) +bool(true) +-- Changing mode of directory to 345 -- +bool(true) +bool(true) +-- Changing mode of directory to 346 -- +bool(true) +bool(true) +-- Changing mode of directory to 347 -- +bool(true) +bool(true) +-- Changing mode of directory to 348 -- +bool(true) +bool(true) +-- Changing mode of directory to 349 -- +bool(true) +bool(true) +-- Changing mode of directory to 350 -- +bool(true) +bool(true) +-- Changing mode of directory to 351 -- +bool(true) +bool(true) +-- Changing mode of directory to 352 -- +bool(true) +bool(true) +-- Changing mode of directory to 353 -- +bool(true) +bool(true) +-- Changing mode of directory to 354 -- +bool(true) +bool(true) +-- Changing mode of directory to 355 -- +bool(true) +bool(true) +-- Changing mode of directory to 356 -- +bool(true) +bool(true) +-- Changing mode of directory to 357 -- +bool(true) +bool(true) +-- Changing mode of directory to 358 -- +bool(true) +bool(true) +-- Changing mode of directory to 359 -- +bool(true) +bool(true) +-- Changing mode of directory to 360 -- +bool(true) +bool(true) +-- Changing mode of directory to 361 -- +bool(true) +bool(true) +-- Changing mode of directory to 362 -- +bool(true) +bool(true) +-- Changing mode of directory to 363 -- +bool(true) +bool(true) +-- Changing mode of directory to 364 -- +bool(true) +bool(true) +-- Changing mode of directory to 365 -- +bool(true) +bool(true) +-- Changing mode of directory to 366 -- +bool(true) +bool(true) +-- Changing mode of directory to 367 -- +bool(true) +bool(true) +-- Changing mode of directory to 368 -- +bool(true) +bool(true) +-- Changing mode of directory to 369 -- +bool(true) +bool(true) +-- Changing mode of directory to 370 -- +bool(true) +bool(true) +-- Changing mode of directory to 371 -- +bool(true) +bool(true) +-- Changing mode of directory to 372 -- +bool(true) +bool(true) +-- Changing mode of directory to 373 -- +bool(true) +bool(true) +-- Changing mode of directory to 374 -- +bool(true) +bool(true) +-- Changing mode of directory to 375 -- +bool(true) +bool(true) +-- Changing mode of directory to 376 -- +bool(true) +bool(true) +-- Changing mode of directory to 377 -- +bool(true) +bool(true) +-- Changing mode of directory to 378 -- +bool(true) +bool(true) +-- Changing mode of directory to 379 -- +bool(true) +bool(true) +-- Changing mode of directory to 380 -- +bool(true) +bool(true) +-- Changing mode of directory to 381 -- +bool(true) +bool(true) +-- Changing mode of directory to 382 -- +bool(true) +bool(true) +-- Changing mode of directory to 383 -- +bool(true) +bool(true) +-- Changing mode of directory to 384 -- +bool(true) +bool(true) +-- Changing mode of directory to 385 -- +bool(true) +bool(true) +-- Changing mode of directory to 386 -- +bool(true) +bool(true) +-- Changing mode of directory to 387 -- +bool(true) +bool(true) +-- Changing mode of directory to 388 -- +bool(true) +bool(true) +-- Changing mode of directory to 389 -- +bool(true) +bool(true) +-- Changing mode of directory to 390 -- +bool(true) +bool(true) +-- Changing mode of directory to 391 -- +bool(true) +bool(true) +-- Changing mode of directory to 392 -- +bool(true) +bool(true) +-- Changing mode of directory to 393 -- +bool(true) +bool(true) +-- Changing mode of directory to 394 -- +bool(true) +bool(true) +-- Changing mode of directory to 395 -- +bool(true) +bool(true) +-- Changing mode of directory to 396 -- +bool(true) +bool(true) +-- Changing mode of directory to 397 -- +bool(true) +bool(true) +-- Changing mode of directory to 398 -- +bool(true) +bool(true) +-- Changing mode of directory to 399 -- +bool(true) +bool(true) +-- Changing mode of directory to 400 -- +bool(true) +bool(true) +-- Changing mode of directory to 401 -- +bool(true) +bool(true) +-- Changing mode of directory to 402 -- +bool(true) +bool(true) +-- Changing mode of directory to 403 -- +bool(true) +bool(true) +-- Changing mode of directory to 404 -- +bool(true) +bool(true) +-- Changing mode of directory to 405 -- +bool(true) +bool(true) +-- Changing mode of directory to 406 -- +bool(true) +bool(true) +-- Changing mode of directory to 407 -- +bool(true) +bool(true) +-- Changing mode of directory to 408 -- +bool(true) +bool(true) +-- Changing mode of directory to 409 -- +bool(true) +bool(true) +-- Changing mode of directory to 410 -- +bool(true) +bool(true) +-- Changing mode of directory to 411 -- +bool(true) +bool(true) +-- Changing mode of directory to 412 -- +bool(true) +bool(true) +-- Changing mode of directory to 413 -- +bool(true) +bool(true) +-- Changing mode of directory to 414 -- +bool(true) +bool(true) +-- Changing mode of directory to 415 -- +bool(true) +bool(true) +-- Changing mode of directory to 416 -- +bool(true) +bool(true) +-- Changing mode of directory to 417 -- +bool(true) +bool(true) +-- Changing mode of directory to 418 -- +bool(true) +bool(true) +-- Changing mode of directory to 419 -- +bool(true) +bool(true) +-- Changing mode of directory to 420 -- +bool(true) +bool(true) +-- Changing mode of directory to 421 -- +bool(true) +bool(true) +-- Changing mode of directory to 422 -- +bool(true) +bool(true) +-- Changing mode of directory to 423 -- +bool(true) +bool(true) +-- Changing mode of directory to 424 -- +bool(true) +bool(true) +-- Changing mode of directory to 425 -- +bool(true) +bool(true) +-- Changing mode of directory to 426 -- +bool(true) +bool(true) +-- Changing mode of directory to 427 -- +bool(true) +bool(true) +-- Changing mode of directory to 428 -- +bool(true) +bool(true) +-- Changing mode of directory to 429 -- +bool(true) +bool(true) +-- Changing mode of directory to 430 -- +bool(true) +bool(true) +-- Changing mode of directory to 431 -- +bool(true) +bool(true) +-- Changing mode of directory to 432 -- +bool(true) +bool(true) +-- Changing mode of directory to 433 -- +bool(true) +bool(true) +-- Changing mode of directory to 434 -- +bool(true) +bool(true) +-- Changing mode of directory to 435 -- +bool(true) +bool(true) +-- Changing mode of directory to 436 -- +bool(true) +bool(true) +-- Changing mode of directory to 437 -- +bool(true) +bool(true) +-- Changing mode of directory to 438 -- +bool(true) +bool(true) +-- Changing mode of directory to 439 -- +bool(true) +bool(true) +-- Changing mode of directory to 440 -- +bool(true) +bool(true) +-- Changing mode of directory to 441 -- +bool(true) +bool(true) +-- Changing mode of directory to 442 -- +bool(true) +bool(true) +-- Changing mode of directory to 443 -- +bool(true) +bool(true) +-- Changing mode of directory to 444 -- +bool(true) +bool(true) +-- Changing mode of directory to 445 -- +bool(true) +bool(true) +-- Changing mode of directory to 446 -- +bool(true) +bool(true) +-- Changing mode of directory to 447 -- +bool(true) +bool(true) +-- Changing mode of directory to 448 -- +bool(true) +bool(true) +-- Changing mode of directory to 449 -- +bool(true) +bool(true) +-- Changing mode of directory to 450 -- +bool(true) +bool(true) +-- Changing mode of directory to 451 -- +bool(true) +bool(true) +-- Changing mode of directory to 452 -- +bool(true) +bool(true) +-- Changing mode of directory to 453 -- +bool(true) +bool(true) +-- Changing mode of directory to 454 -- +bool(true) +bool(true) +-- Changing mode of directory to 455 -- +bool(true) +bool(true) +-- Changing mode of directory to 456 -- +bool(true) +bool(true) +-- Changing mode of directory to 457 -- +bool(true) +bool(true) +-- Changing mode of directory to 458 -- +bool(true) +bool(true) +-- Changing mode of directory to 459 -- +bool(true) +bool(true) +-- Changing mode of directory to 460 -- +bool(true) +bool(true) +-- Changing mode of directory to 461 -- +bool(true) +bool(true) +-- Changing mode of directory to 462 -- +bool(true) +bool(true) +-- Changing mode of directory to 463 -- +bool(true) +bool(true) +-- Changing mode of directory to 464 -- +bool(true) +bool(true) +-- Changing mode of directory to 465 -- +bool(true) +bool(true) +-- Changing mode of directory to 466 -- +bool(true) +bool(true) +-- Changing mode of directory to 467 -- +bool(true) +bool(true) +-- Changing mode of directory to 468 -- +bool(true) +bool(true) +-- Changing mode of directory to 469 -- +bool(true) +bool(true) +-- Changing mode of directory to 470 -- +bool(true) +bool(true) +-- Changing mode of directory to 471 -- +bool(true) +bool(true) +-- Changing mode of directory to 472 -- +bool(true) +bool(true) +-- Changing mode of directory to 473 -- +bool(true) +bool(true) +-- Changing mode of directory to 474 -- +bool(true) +bool(true) +-- Changing mode of directory to 475 -- +bool(true) +bool(true) +-- Changing mode of directory to 476 -- +bool(true) +bool(true) +-- Changing mode of directory to 477 -- +bool(true) +bool(true) +-- Changing mode of directory to 478 -- +bool(true) +bool(true) +-- Changing mode of directory to 479 -- +bool(true) +bool(true) +-- Changing mode of directory to 480 -- +bool(true) +bool(true) +-- Changing mode of directory to 481 -- +bool(true) +bool(true) +-- Changing mode of directory to 482 -- +bool(true) +bool(true) +-- Changing mode of directory to 483 -- +bool(true) +bool(true) +-- Changing mode of directory to 484 -- +bool(true) +bool(true) +-- Changing mode of directory to 485 -- +bool(true) +bool(true) +-- Changing mode of directory to 486 -- +bool(true) +bool(true) +-- Changing mode of directory to 487 -- +bool(true) +bool(true) +-- Changing mode of directory to 488 -- +bool(true) +bool(true) +-- Changing mode of directory to 489 -- +bool(true) +bool(true) +-- Changing mode of directory to 490 -- +bool(true) +bool(true) +-- Changing mode of directory to 491 -- +bool(true) +bool(true) +-- Changing mode of directory to 492 -- +bool(true) +bool(true) +-- Changing mode of directory to 493 -- +bool(true) +bool(true) +-- Changing mode of directory to 494 -- +bool(true) +bool(true) +-- Changing mode of directory to 495 -- +bool(true) +bool(true) +-- Changing mode of directory to 496 -- +bool(true) +bool(true) +-- Changing mode of directory to 497 -- +bool(true) +bool(true) +-- Changing mode of directory to 498 -- +bool(true) +bool(true) +-- Changing mode of directory to 499 -- +bool(true) +bool(true) +-- Changing mode of directory to 500 -- +bool(true) +bool(true) +-- Changing mode of directory to 501 -- +bool(true) +bool(true) +-- Changing mode of directory to 502 -- +bool(true) +bool(true) +-- Changing mode of directory to 503 -- +bool(true) +bool(true) +-- Changing mode of directory to 504 -- +bool(true) +bool(true) +-- Changing mode of directory to 505 -- +bool(true) +bool(true) +-- Changing mode of directory to 506 -- +bool(true) +bool(true) +-- Changing mode of directory to 507 -- +bool(true) +bool(true) +-- Changing mode of directory to 508 -- +bool(true) +bool(true) +-- Changing mode of directory to 509 -- +bool(true) +bool(true) +-- Changing mode of directory to 510 -- +bool(true) +bool(true) +-- Changing mode of directory to 511 -- +bool(true) +bool(true) + +*** Testing mkdir() and rmdir() by giving stream context as fourth argument *** +bool(true) +bool(true) + +*** Testing rmdir() on a non-empty directory *** +bool(true) + +Warning: rmdir(%s/mkdir私はガラスを食べられます/): Directory not empty in %s on line %d +bool(false) + +*** Testing mkdir() and rmdir() for binary safe functionality *** +bool(true) +bool(true) + +*** Testing mkdir() with miscelleneous input *** +bool(true) +bool(true) +bool(true) +Done diff --git a/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt b/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt new file mode 100644 index 0000000000..4e5d4347e4 --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test parse_ini_file() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip Only run on Windows"); +?> +--FILE-- +<?php +/* Prototype : array parse_ini_file(string filename [, bool process_sections]) + * Description: Parse configuration file + * Source code: ext/standard/basic_functions.c + * Alias to functions: + */ + +echo "*** Testing parse_ini_file() : variation ***\n"; +$mainDir = "parseIniFileVar私はガラスを食べられます.dir"; +$subDir = "parseIniFileVar私はガラスを食べられますSub"; +$absMainDir = dirname(__FILE__)."\\".$mainDir; +mkdir($absMainDir); +$absSubDir = $absMainDir."\\".$subDir; +mkdir($absSubDir); + +$old_dir_path = getcwd(); +chdir(dirname(__FILE__)); +$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3); + +$allDirs = array( + // absolute paths + "$absSubDir\\", + "$absSubDir\\..\\".$subDir, + "$absSubDir\\\\..\\.\\".$subDir, + "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir, + "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir, + "$absSubDir\\BADDIR", + + // relative paths + $mainDir."\\".$subDir, + $mainDir."\\\\".$subDir, + $mainDir."\\\\\\".$subDir, + ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir, + "BADDIR", + + // unixifed path + $unixifiedDir, +); + +$filename = 'parseIniFileVar私はガラスを食べられます.ini'; +$content="a=test"; +$absFile = $absSubDir.'/'.$filename; +$h = fopen($absFile,"w"); +fwrite($h, $content); +fclose($h); + +for($i = 0; $i<count($allDirs); $i++) { + $j = $i+1; + $dir = $allDirs[$i]; + echo "\n-- Iteration $j --\n"; + var_dump(parse_ini_file($dir."\\".$filename)); +} + +unlink($absFile); +chdir($old_dir_path); +rmdir($absSubDir); +rmdir($absMainDir); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Testing parse_ini_file() : variation *** + +-- Iteration 1 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 2 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 3 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 4 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 5 -- + +Warning: parse_ini_file(%sparseIniFileVar私はガラスを食べられます.dir\parseIniFileVar私はガラスを食べられますSub\..\\\parseIniFileVar私はガラスを食べられますSub\\..\\..\parseIniFileVar私はガラスを食べられますSub\parseIniFileVar私はガラスを食べられます.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: parse_ini_file(%sparseIniFileVar私はガラスを食べられます.dir\parseIniFileVar私はガラスを食べられますSub\BADDIR\parseIniFileVar私はガラスを食べられます.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 7 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 8 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 9 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 10 -- +array(1) { + ["a"]=> + string(4) "test" +} + +-- Iteration 11 -- + +Warning: parse_ini_file(BADDIR\parseIniFileVar私はガラスを食べられます.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 12 -- +array(1) { + ["a"]=> + string(4) "test" +} + +*** Done ***
\ No newline at end of file diff --git a/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt b/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt new file mode 100644 index 0000000000..7e0a0e0c54 --- /dev/null +++ b/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test popen() and pclose function: basic functionality + +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) + die("skip Not Valid for Linux"); +?> + +--FILE-- +<?php +/* + * Prototype: resource popen ( string command, string mode ) + * Description: Opens process file pointer. + + * Prototype: int pclose ( resource handle ); + * Description: Closes process file pointer. + */ + +echo "*** Testing popen(): reading from the pipe ***\n"; + +$file_path = dirname(__FILE__); + +$string = "Sample String 私はガラスを食べられます"; +$file_handle = popen(" echo $string", "r"); +fpassthru($file_handle); +pclose($file_handle); + +echo "*** Testing popen(): writing to the pipe ***\n"; +$arr = array("ggg", "ddd", "aaa", "sss"); +// popen("sort", "w") fails if variables_order="GPCS" +// this is set in the default INI file +// it doesn't seem to be changeable in the --INI-- section +// also, doing: ini_set('variables_order', ''); doesn't work! +// +// the only solution is to either put the absolute path here, or +// remove variables_order= from PHP.ini (setting it in run-test's +// default INI will fail too) +// +// since we can't depend on PHP.ini being set a certain way, +// have to put the absolute path here. + +$sysroot = exec('echo %SYSTEMROOT%'); + +$file_handle = popen("$sysroot/system32/sort", "w"); +$newline = "\n"; +foreach($arr as $str) { + fwrite($file_handle, (binary)$str); + fwrite($file_handle, (binary)(binary)(binary)(binary)(binary)(binary)(binary)(binary)(binary)$newline); +} +pclose($file_handle); + +echo "*** Testing popen() and pclose(): return type ***\n"; +$return_value_popen = popen("echo $string", "r"); +fpassthru($return_value_popen); +var_dump( is_resource($return_value_popen) ); +$return_value_pclose = pclose($return_value_popen); +var_dump( is_int($return_value_pclose) ); + +echo "\n--- Done ---"; +?> +--EXPECTF-- +*** Testing popen(): reading from the pipe *** +Sample String 私はガラスを食べられます +*** Testing popen(): writing to the pipe *** +aaa +ddd +ggg +sss +*** Testing popen() and pclose(): return type *** +Sample String 私はガラスを食べられます +bool(true) +bool(true) + +--- Done --- diff --git a/ext/standard/tests/file/readfile_variation8-win32-mb.phpt b/ext/standard/tests/file/readfile_variation8-win32-mb.phpt new file mode 100644 index 0000000000..e53f362367 --- /dev/null +++ b/ext/standard/tests/file/readfile_variation8-win32-mb.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test readfile() function : variation +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip Only valid for Windows"); +?> +--FILE-- +<?php +/* Prototype : int readfile(string filename [, bool use_include_path[, resource context]]) + * Description: Output a file or a URL + * Source code: ext/standard/file.c + * Alias to functions: + */ + +echo "*** Testing readfile() : variation ***\n"; +$mainDir = "readfileVar私はガラスを食べられます8"; +$subDir = "readfileVar私はガラスを食べられます8Sub"; +$absMainDir = dirname(__FILE__)."\\".$mainDir; +mkdir($absMainDir); +$absSubDir = $absMainDir."\\".$subDir; +mkdir($absSubDir); + +$theFile = "fileToRead.tmp"; +$absFile = $absSubDir.'/'.$theFile; + +// create the file +$h = fopen($absFile,"w"); +fwrite($h, "The File Contents"); +fclose($h); + + +$old_dir_path = getcwd(); +chdir(dirname(__FILE__)); +$unixifiedDir = '/'.substr(str_replace('\\','/',$absSubDir),3); + +$allDirs = array( + // absolute paths + "$absSubDir\\", + "$absSubDir\\..\\".$subDir, + "$absSubDir\\\\..\\.\\".$subDir, + "$absSubDir\\..\\..\\".$mainDir."\\.\\".$subDir, + "$absSubDir\\..\\\\\\".$subDir."\\\\..\\\\..\\".$subDir, + "$absSubDir\\BADDIR", + + // relative paths + $mainDir."\\".$subDir, + $mainDir."\\\\".$subDir, + $mainDir."\\\\\\".$subDir, + ".\\".$mainDir."\\..\\".$mainDir."\\".$subDir, + "BADDIR", + + // unixifed path + $unixifiedDir, +); + +for($i = 0; $i<count($allDirs); $i++) { + $j = $i+1; + $dir = $allDirs[$i]; + echo "\n-- $dir --\n"; + $ok = readfile($dir.'\\'.$theFile); + if ($ok === 1) { + echo "\n"; + } +} + +unlink($absFile); +chdir($old_dir_path); +rmdir($absSubDir); +rmdir($absMainDir); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Testing readfile() : variation *** + +-- %s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\ -- +The File Contents +-- %s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\..\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- %s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\\..\.\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- %s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\..\..\readfileVar私はガラスを食べられます8\.\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- %s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\..\\\readfileVar私はガラスを食べられます8Sub\\..\\..\readfileVar私はガラスを食べられます8Sub -- + +Warning: readfile(%s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\..\\\readfileVar私はガラスを食べられます8Sub\\..\\..\readfileVar私はガラスを食べられます8Sub\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- %s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\BADDIR -- + +Warning: readfile(%s\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub\BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- readfileVar私はガラスを食べられます8\\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- readfileVar私はガラスを食べられます8\\\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- .\readfileVar私はガラスを食べられます8\..\readfileVar私はガラスを食べられます8\readfileVar私はガラスを食べられます8Sub -- +The File Contents +-- BADDIR -- + +Warning: readfile(BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- /%s/readfileVar私はガラスを食べられます8/readfileVar私はガラスを食べられます8Sub -- +The File Contents +*** Done ***
\ No newline at end of file diff --git a/ext/standard/tests/file/realpath_basic-win32-mb.phpt b/ext/standard/tests/file/realpath_basic-win32-mb.phpt new file mode 100644 index 0000000000..c0f39b6054 --- /dev/null +++ b/ext/standard/tests/file/realpath_basic-win32-mb.phpt @@ -0,0 +1,89 @@ +--TEST-- +Test realpath() function: basic functionality +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: string realpath ( string $path ); + Description: Returns canonicalized absolute pathname +*/ + +echo "\n*** Testing basic functions of realpath() with files ***\n"; + +/* creating directories and files */ +$file_path = dirname(__FILE__); +mkdir("$file_path/realpath_私はガラスを食べられますbasic/home/test/", 0777, true); + +$file_handle1 = fopen("$file_path/realpath_私はガラスを食べられますbasic/home/test/realpath_私はガラスを食べられますbasic.tmp", "w"); +$file_handle2 = fopen("$file_path/realpath_私はガラスを食べられますbasic/home/realpath_私はガラスを食べられますbasic.tmp", "w"); +$file_handle3 = fopen("$file_path/realpath_私はガラスを食べられますbasic/realpath_私はガラスを食べられますbasic.tmp", "w"); +fclose($file_handle1); +fclose($file_handle2); +fclose($file_handle3); + +echo "\n*** Testing realpath() on filenames ***\n"; +$filenames = array ( + /* filenames resulting in valid paths */ + "$file_path/realpath_私はガラスを食べられますbasic/home/realpath_私はガラスを食べられますbasic.tmp", + "$file_path/realpath_私はガラスを食べられますbasic/realpath_私はガラスを食べられますbasic.tmp/", + "$file_path/realpath_私はガラスを食べられますbasic//home/test//../test/./realpath_私はガラスを食べられますbasic.tmp", + "$file_path/realpath_私はガラスを食べられますbasic/home//../././realpath_私はガラスを食べられますbasic.tmp//", + + // checking for binary safe + b"$file_path/realpath_私はガラスを食べられますbasic/home/realpath_私はガラスを食べられますbasic.tmp", + + /* filenames with invalid path */ + "$file_path///realpath_私はガラスを食べられますbasic/home//..//././test//realpath_私はガラスを食べられますbasic.tmp", + "$file_path/realpath_私はガラスを食べられますbasic/home/../home/../test/../..realpath_私はガラスを食べられますbasic.tmp" +); + +$counter = 1; +/* loop through $files to read the filepath of $file in the above array */ +foreach($filenames as $file) { + echo "\n-- Iteration $counter --\n"; + var_dump( realpath($file) ); + $counter++; +} + +echo "Done\n"; +?> +--CLEAN-- +<?php +$name_prefix = dirname(__FILE__)."/realpath_私はガラスを食べられますbasic"; +unlink("$name_prefix/home/test/realpath_私はガラスを食べられますbasic.tmp"); +unlink("$name_prefix/home/realpath_私はガラスを食べられますbasic.tmp"); +unlink("$name_prefix/realpath_私はガラスを食べられますbasic.tmp"); +rmdir("$name_prefix/home/test/"); +rmdir("$name_prefix/home/"); +rmdir("$name_prefix/"); +?> +--EXPECTF-- +*** Testing basic functions of realpath() with files *** + +*** Testing realpath() on filenames *** + +-- Iteration 1 -- +string(%d) "%s\realpath_私はガラスを食べられますbasic\home\realpath_私はガラスを食べられますbasic.tmp" + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +string(%d) "%s\realpath_私はガラスを食べられますbasic\home\test\realpath_私はガラスを食べられますbasic.tmp" + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +string(%d) "%s\realpath_私はガラスを食べられますbasic\home\realpath_私はガラスを食べられますbasic.tmp" + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) +Done diff --git a/ext/standard/tests/file/realpath_variation-win32-mb.phpt b/ext/standard/tests/file/realpath_variation-win32-mb.phpt new file mode 100644 index 0000000000..66d7c8b0c7 --- /dev/null +++ b/ext/standard/tests/file/realpath_variation-win32-mb.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test realpath() function: usage variation +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: string realpath ( string $path ); + Description: Returns canonicalized absolute pathname +*/ + +require dirname(__FILE__).'/file.inc'; + +echo "*** Testing realpath(): usage variations ***\n"; +$name_prefix = dirname(__FILE__); +$filename = "$name_prefix/realpath_variation_私はガラスを食べられます/home/tests/realpath_variation_私はガラスを食べられます.tmp"; +mkdir("$name_prefix/realpath_variation_私はガラスを食べられます/home/tests/", 0777, true); + +echo "\n*** Testing realpath() with filename stored inside a object ***\n"; +// create a temp file +$file_handle = fopen($filename, "w"); +fclose($file_handle); + +// creating object with members as filename +class object_temp { + public $filename; + function __construct($file) { + $this->filename = $file; + } +} +$obj1 = new object_temp("$name_prefix/realpath_variation_私はガラスを食べられます/../././realpath_variation_私はガラスを食べられます/home/tests/realpath_variation_私はガラスを食べられます.tmp"); +$obj2 = new object_temp("$name_prefix/realpath_variation_私はガラスを食べられます/home/..///realpath_variation_私はガラスを食べられます.tmp"); + +var_dump( realpath($obj1->filename) ); +var_dump( realpath($obj2->filename) ); + +echo "\n*** Testing realpath() with filename stored in an array ***\n"; +$file_arr = array ( + "$name_prefix////realpath_variation_私はガラスを食べられます/home/tests/realpath_variation_私はガラスを食べられます.tmp", + "$name_prefix/./realpath_variation_私はガラスを食べられます/home/../home//tests//..//..//..//home//realpath_variation_私はガラスを食べられます.tmp/" +); + +var_dump( realpath($file_arr[0]) ); +var_dump( realpath($file_arr[1]) ); + +echo "\n*** Testing realpath() with filename as empty string, NULL and single space ***\n"; +$file_string = array ( + /* filename as spaces */ + " ", + ' ', + + /* empty filename */ + "", + '', + NULL, + null + ); +for($loop_counter = 0; $loop_counter < count($file_string); $loop_counter++) { + echo "-- Iteration"; + echo $loop_counter + 1; + echo " --\n"; + var_dump( realpath($file_string[$loop_counter]) ); +} + +echo "Done\n"; +?> +--CLEAN-- +<?php +$name_prefix = dirname(__FILE__)."/realpath_variation_私はガラスを食べられます"; +unlink("$name_prefix/home/tests/realpath_variation_私はガラスを食べられます.tmp"); +rmdir("$name_prefix/home/tests/"); +rmdir("$name_prefix/home/"); +rmdir("$name_prefix/"); +?> +--EXPECTF-- +*** Testing realpath(): usage variations *** + +*** Testing realpath() with filename stored inside a object *** +string(%d) "%s\realpath_variation_私はガラスを食べられます\home\tests\realpath_variation_私はガラスを食べられます.tmp" +bool(false) + +*** Testing realpath() with filename stored in an array *** +string(%d) "%s\realpath_variation_私はガラスを食べられます\home\tests\realpath_variation_私はガラスを食べられます.tmp" +bool(false) + +*** Testing realpath() with filename as empty string, NULL and single space *** +-- Iteration1 -- +bool(false) +-- Iteration2 -- +bool(false) +-- Iteration3 -- +string(%d) "%s" +-- Iteration4 -- +string(%d) "%s" +-- Iteration5 -- +string(%d) "%s" +-- Iteration6 -- +string(%d) "%s" +Done diff --git a/ext/standard/tests/file/stat_basic-win32-mb.phpt b/ext/standard/tests/file/stat_basic-win32-mb.phpt new file mode 100644 index 0000000000..334eb9ea65 --- /dev/null +++ b/ext/standard/tests/file/stat_basic-win32-mb.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test stat() function: basic functionality +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. valid only for Windows'); +} +?> +--FILE-- +<?php +/* + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require("$file_path/file.inc"); + +echo "*** Testing stat() : basic functionality ***\n"; + +/* creating temp directory and file */ + +// creating dir +$dirname = "$file_path/stat_basic_私はガラスを食べられます"; +mkdir($dirname); +// stat of the dir created +$dir_stat = stat($dirname); +clearstatcache(); +sleep(2); + +// creating file +$filename = "$dirname/stat_basic_私はガラスを食べられます.tmp"; +$file_handle = fopen($filename, "w"); +fclose($file_handle); +// stat of the file created +$file_stat = stat($filename); +sleep(2); + +// now new stat of the dir after file is created +$new_dir_stat = stat($dirname); +clearstatcache(); + +// stat contains 13 different values stored twice, can be accessed using +// numeric and named keys, compare them to see they are same +echo "*** Testing stat(): validating the values stored in stat ***\n"; +// Initial stat values +var_dump( compare_self_stat($file_stat) ); //expect true +var_dump( compare_self_stat($dir_stat) ); //expect true + +// New stat values taken after creation of file +var_dump( compare_self_stat($new_dir_stat) ); // expect true + +// compare the two stat values, initial stat and stat recorded after +// creating file, also dump the value of stats +echo "*** Testing stat(): comparing stats (recorded before and after file creation) ***\n"; +echo "-- comparing difference in dir stats before and after creating file in it --\n"; +$affected_elements = array( 9, 'mtime' ); +var_dump( compare_stats($dir_stat, $new_dir_stat, $affected_elements, '!=', true) ); // expect true + +echo "*** Testing stat(): for the return value ***\n"; +var_dump( is_array( stat($filename) ) ); + +echo "\n---Done---"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/stat_basic_私はガラスを食べられます/stat_basic_私はガラスを食べられます.tmp"); +rmdir("$file_path/stat_basic_私はガラスを食べられます"); +?> +--EXPECTF-- +*** Testing stat() : basic functionality *** +*** Testing stat(): validating the values stored in stat *** +bool(true) +bool(true) +bool(true) +*** Testing stat(): comparing stats (recorded before and after file creation) *** +-- comparing difference in dir stats before and after creating file in it -- +array(26) { + [0]=> + int(%d) + [1]=> + int(0) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(-1) + [12]=> + int(-1) + ["dev"]=> + int(%d) + ["ino"]=> + int(0) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(0) + ["gid"]=> + int(0) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(-1) + ["blocks"]=> + int(-1) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(-1) + [12]=> + int(-1) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(-1) + ["blocks"]=> + int(-1) +} +bool(true) +*** Testing stat(): for the return value *** +bool(true) + +---Done--- + diff --git a/ext/standard/tests/file/stat_variation1-win32-mb.phpt b/ext/standard/tests/file/stat_variation1-win32-mb.phpt new file mode 100644 index 0000000000..dcba28698f --- /dev/null +++ b/ext/standard/tests/file/stat_variation1-win32-mb.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test stat() functions: usage variations - effects of rename() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only for Windows'); +} +?> +--FILE-- +<?php + +/* + * Prototype: array stat ( string $filename ); + * Description: Gives information about a file + */ + +/* test the effects of rename() on stats of dir/file */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file and directory */ +mkdir("$file_path/stat_variation1_私はガラスを食べられます/"); // temp dir + +$file_handle = fopen("$file_path/stat_variation1_私はガラスを食べられます.tmp", "w"); // temp file +fclose($file_handle); + + +echo "*** Testing stat(): on file and directory ater renaming them ***\n"; + +// renaming a file +echo "-- Testing stat() for files after being renamed --\n"; +$old_filename = "$file_path/stat_variation1_私はガラスを食べられます.tmp"; +$new_filename = "$file_path/stat_variation1a_私はガラスを食べられます.tmp"; +$old_stat = stat($old_filename); +clearstatcache(); +sleep(2); +var_dump( rename($old_filename, $new_filename) ); +$new_stat = stat($new_filename); + +// compare the self stat +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); + +// compare the two stats +var_dump( compare_stats($old_stat, $old_stat, $all_stat_keys) ); +// clear the cache +clearstatcache(); + +// renaming a directory +echo "-- Testing stat() for directory after being renamed --\n"; +$old_dirname = "$file_path/stat_variation1_私はガラスを食べられます"; +$new_dirname = "$file_path/stat_variation1a_私はガラスを食べられます"; +$old_stat = stat($old_dirname); +clearstatcache(); +sleep(2); +var_dump( rename($old_dirname, $new_dirname) ); +$new_stat = stat($new_dirname); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); + +// compare the two stats +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); +// clear the cache +clearstatcache(); + + +echo "\n*** Done ***"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/stat_variation1a_私はガラスを食べられます.tmp"); +rmdir("$file_path/stat_variation1a_私はガラスを食べられます"); +?> +--EXPECTF-- +*** Testing stat(): on file and directory ater renaming them *** +-- Testing stat() for files after being renamed -- +bool(true) +bool(true) +bool(true) +bool(true) +-- Testing stat() for directory after being renamed -- +bool(true) +bool(true) +bool(true) +bool(true) + +*** Done *** + diff --git a/ext/standard/tests/file/tempnam_variation1-win32-mb.phpt b/ext/standard/tests/file/tempnam_variation1-win32-mb.phpt new file mode 100644 index 0000000000..4d985410da --- /dev/null +++ b/ext/standard/tests/file/tempnam_variation1-win32-mb.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test tempnam() function: usage variations - creating files +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != "WIN") + die("skip Only valid for Windows"); +?> +--FILE-- +<?php +/* Prototype: string tempnam ( string $dir, string $prefix ); + Description: Create file with unique file name. +*/ + +/* Creating number of unique files by passing a file name as prefix */ + +$file_path = dirname(__FILE__)."/tempnamVar1_私はガラスを食べられます"; +mkdir($file_path); + +echo "*** Testing tempnam() in creation of unique files ***\n"; +for($i=1; $i<=10; $i++) { + echo "-- Iteration $i --\n"; + $files[$i] = tempnam("$file_path", "tempnam_variation1.tmp"); + + if( file_exists($files[$i]) ) { + + echo "File name is => "; + print($files[$i]); + echo "\n"; + + echo "File permissions are => "; + printf("%o", fileperms($files[$i]) ); + echo "\n"; + clearstatcache(); + + echo "File created in => "; + $file_dir = dirname($files[$i]); + + if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { + echo "temp dir\n"; + } + else if (realpath($file_dir) == realpath($file_path) || realpath($file_dir."\\") == realpath($file_path)) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + clearstatcache(); + } + else { + print("- File is not created -"); + } +} +for($i=1; $i<=10; $i++) { + unlink($files[$i]); +} +rmdir($file_path); + + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing tempnam() in creation of unique files *** +-- Iteration 1 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 2 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 3 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 4 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 5 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 6 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 7 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 8 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 9 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +-- Iteration 10 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => directory specified +*** Done *** diff --git a/ext/standard/tests/file/touch_basic-win32-mb.phpt b/ext/standard/tests/file/touch_basic-win32-mb.phpt new file mode 100644 index 0000000000..d721edc84c --- /dev/null +++ b/ext/standard/tests/file/touch_basic-win32-mb.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test touch() function : basic functionality +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only for Windows'); +} +?> +--FILE-- +<?php +/* Prototype : proto bool touch(string filename [, int time [, int atime]]) + * Description: Set modification time of file + * Source code: ext/standard/filestat.c + * Alias to functions: + */ + +echo "*** Testing touch() : basic functionality ***\n"; + +$filename = dirname(__FILE__)."/touch_私はガラスを食べられます.dat"; + +echo "\n--- testing touch creates a file ---\n"; +@unlink($filename); +if (file_exists($filename)) { + die("touch_basic failed"); +} +var_dump( touch($filename) ); +if (file_exists($filename) == false) { + die("touch_basic failed"); +} + +echo "\n --- testing touch doesn't alter file contents ---\n"; +$testln = "Here is a test line"; +$h = fopen($filename, "wb"); +fwrite($h, $testln); +fclose($h); +touch($filename); +$h = fopen($filename, "rb"); +echo fgets($h); +fclose($h); + +echo "\n\n --- testing touch alters the correct file metadata ---\n"; +$init_meta = stat($filename); +clearstatcache(); +sleep(1); +touch($filename); +$next_meta = stat($filename); +$type = array("dev", "ino", "mode", "nlink", "uid", "gid", + "rdev", "size", "atime", "mtime", "ctime", + "blksize", "blocks"); + +for ($i = 0; $i < count($type); $i++) { + if ($init_meta[$i] != $next_meta[$i]) { + echo "stat data differs at $type[$i]\n"; + } +} + + +// Initialise all required variables +$time = 10000; +$atime = 20470; + +// Calling touch() with all possible arguments +echo "\n --- testing touch using all parameters ---\n"; +var_dump( touch($filename, $time, $atime) ); +clearstatcache(); +$init_meta = stat($filename); +echo "ctime=".$init_meta['ctime']."\n"; +echo "mtime=".$init_meta['mtime']."\n"; +echo "atime=".$init_meta['atime']."\n"; + +unlink($filename); + +echo "Done"; +?> +--EXPECTF-- +*** Testing touch() : basic functionality *** + +--- testing touch creates a file --- +bool(true) + + --- testing touch doesn't alter file contents --- +Here is a test line + + --- testing touch alters the correct file metadata --- +stat data differs at atime +stat data differs at mtime + + --- testing touch using all parameters --- +bool(true) +ctime=%d +mtime=10000 +atime=20470 +Done + diff --git a/ext/standard/tests/file/touch_variation3-win32-mb.phpt b/ext/standard/tests/file/touch_variation3-win32-mb.phpt new file mode 100644 index 0000000000..445ef3fb1c --- /dev/null +++ b/ext/standard/tests/file/touch_variation3-win32-mb.phpt @@ -0,0 +1,200 @@ +--TEST-- +Test touch() function : usage variation - different types for time +--CREDITS-- +Dave Kelsey <d_kelsey@uk.ibm.com> +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only for Windows'); +} +?> +--FILE-- +<?php +/* Prototype : bool touch(string filename [, int time [, int atime]]) + * Description: Set modification time of file + * Source code: ext/standard/filestat.c + * Alias to functions: + */ + +echo "*** Testing touch() : usage variation ***\n"; + +// Define error handler +function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { + if (error_reporting() != 0) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } +} +set_error_handler('test_error_handler'); + +// Initialise function arguments not being substituted (if any) +$filename = 'touchVar2_私はガラスを食べられます.tmp'; +$atime = 10; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +// define some classes +class classWithToString +{ + public function __toString() { + return "Class A object"; + } +} + +class classWithoutToString +{ +} + +// heredoc string +$heredoc = <<<EOT +hello world +EOT; + +// add arrays +$index_array = array (1, 2, 3); +$assoc_array = array ('one' => 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // float data + 'float 10.5' => 10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for time + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( touch($filename, $value, $atime) ); +}; + +unlink($filename); + +?> +===DONE=== +--EXPECTF-- +*** Testing touch() : usage variation *** + +--float 10.5-- +bool(true) + +--float 12.3456789000e10-- +bool(true) + +--float .5-- +bool(true) + +--empty array-- +Error: 2 - touch() expects parameter 2 to be integer, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - touch() expects parameter 2 to be integer, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - touch() expects parameter 2 to be integer, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - touch() expects parameter 2 to be integer, array given, %s(%d) +NULL + +--uppercase NULL-- +bool(true) + +--lowercase null-- +bool(true) + +--lowercase true-- +bool(true) + +--lowercase false-- +bool(true) + +--uppercase TRUE-- +bool(true) + +--uppercase FALSE-- +bool(true) + +--empty string DQ-- +Error: 2 - touch() expects parameter 2 to be integer, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - touch() expects parameter 2 to be integer, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - touch() expects parameter 2 to be integer, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - touch() expects parameter 2 to be integer, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - touch() expects parameter 2 to be integer, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - touch() expects parameter 2 to be integer, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - touch() expects parameter 2 to be integer, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - touch() expects parameter 2 to be integer, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt new file mode 100644 index 0000000000..5111f34b76 --- /dev/null +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -0,0 +1,113 @@ +--TEST-- +Testing unlink() function : error conditions +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip.. only on Windows'); +} +?> +--FILE-- +<?php +/* Prototype : bool unlink ( string $filename [, resource $context] ); + Description : Deletes filename +*/ + +$file_path = dirname(__FILE__).DIRECTORY_SEPARATOR."私はガラスを食べられます"; + +@mkdir($file_path); + +$filename = "$file_path/unlink_error.tmp"; // temp file name used here +$fp = fopen($filename, "w"); // create file +fclose($fp); + +// creating a context +$context = stream_context_create(); + +echo "*** Testing unlink() : error conditions ***\n"; + +echo "-- Testing unlink() on unexpected no. of arguments --\n"; +// arg < expected +var_dump( unlink() ); +// args > expected +var_dump( unlink($filename, $context, true) ); +var_dump( file_exists($filename) ); // expected: true + +echo "\n-- Testing unlink() on invalid arguments --\n"; +// invalid arguments +var_dump( unlink('') ); // $filename as empty string +var_dump( file_exists('') ); // confirm file doesnt exist + +var_dump( unlink(NULL) ); // $filename as NULL +var_dump( file_exists(NULL) ); // confirm file doesnt exist + +var_dump( unlink(false) ); // $filename as boolean false +var_dump( file_exists(false) ); // confirm file doesnt exist + +var_dump( unlink($filename, '') ); // $context as empty string +var_dump( unlink($filename, false) ); // $context as boolean false +var_dump( unlink($filename, NULL) ); // $context as NULL + + +echo "\n-- Testing unlink() on non-existent file --\n"; +var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); + +echo "\n-- Testing unlink() on directory --\n"; +// temp directory used here +$dirname = "$file_path/unlink_error"; +// create temp dir +mkdir($dirname); +// unlinking directory +var_dump( unlink($dirname) ); // expected: false as unlink() does not work on dir + +echo "Done\n"; +?> +--CLEAN-- +<?php +unlink(dirname(__FILE__)."/私はガラスを食べられます/unlink_error.tmp"); +rmdir(dirname(__FILE__)."/私はガラスを食べられます/unlink_error"); +rmdir(dirname(__FILE__)."/私はガラスを食べられます"); +?> +--EXPECTF-- +*** Testing unlink() : error conditions *** +-- Testing unlink() on unexpected no. of arguments -- + +Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +bool(true) + +-- Testing unlink() on invalid arguments -- + +Warning: unlink(): %s in %s on line %d +bool(false) +bool(false) + +Warning: unlink(): %s in %s on line %d +bool(false) +bool(false) + +Warning: unlink(): %s in %s on line %d +bool(false) +bool(false) + +Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d +bool(false) + +Warning: unlink() expects parameter 2 to be resource, boolean given in %s on line %d +bool(false) + +Warning: unlink() expects parameter 2 to be resource, null given in %s on line %d +bool(false) + +-- Testing unlink() on non-existent file -- + +Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d +bool(false) + +-- Testing unlink() on directory -- + +Warning: unlink(%s/unlink_error): Permission denied in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/unlink_variation1-win32-mb.phpt b/ext/standard/tests/file/unlink_variation1-win32-mb.phpt new file mode 100644 index 0000000000..adfb10edfe --- /dev/null +++ b/ext/standard/tests/file/unlink_variation1-win32-mb.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test unlink() function : usage variations - unlinking file in a directory +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only on Windows'); +} +?> +--FILE-- +<?php +/* Prototype : bool unlink ( string $filename [, resource $context] ); + Description : Deletes filename +*/ + +/* Delete file having default permission but its dir having readonly permission + Delete file having readonly permission but dir having default permission +*/ + + +$file_path = dirname(__FILE__).DIRECTORY_SEPARATOR."私はガラスを食べられます"; +@mkdir($file_path); + +// temp dir name used here +$dirname = "$file_path/unlink_variation1"; +// temp filename used here +$filename = "$dirname/unlink_variation1-win32.tmp"; + +echo "\n*** Testing unlink() on file inside a directory ***\n"; +// create temp dir +mkdir($dirname); +// create temp file inside $dirname +$fp = fopen($filename, "w"); +fclose($fp); + +echo "-- Unlink file having default permission and its dir having read only permission --\n"; +// remove write permission of $dirname +// on windows dir permission is not respected +var_dump( chmod($dirname, 0444) ); +// now try deleting $filename +var_dump( unlink($filename) ); // expected: true +var_dump( file_exists($filename) ); // confirm file is deleted + +// remove the dir +var_dump( chmod($dirname, 0777) ); +rmdir($dirname); + +echo "\n-- Unlinking file without write permission, its dir having default permission --\n"; +// create the temp dir +mkdir($dirname); + +// create the temp file +$fp = fopen($filename, "w"); +fclose($fp); + +// remove write permission from file +var_dump( chmod($filename, 0444) ); + +// now try deleting temp file inside $dirname +var_dump( unlink($filename) ); // expected: false + +// reassign write permission to temp file +chmod($filename, 0777); +// delete temp file +var_dump( unlink($filename) ); +var_dump( file_exists($filename) ); // confirm file is deleted +// remove temp dir +rmdir($dirname); +rmdir($file_path); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing unlink() on file inside a directory *** +-- Unlink file having default permission and its dir having read only permission -- +bool(true) +bool(true) +bool(false) +bool(true) + +-- Unlinking file without write permission, its dir having default permission -- +bool(true) + +Warning: unlink(%s/unlink_variation1/unlink_variation1-win32.tmp): Permission denied in %s on line %d +bool(false) +bool(true) +bool(false) +Done diff --git a/ext/standard/tests/file/unlink_variation8-win32.phpt b/ext/standard/tests/file/unlink_variation8-win32.phpt index 3ad7ff2c64..8c9fbd895c 100644 --- a/ext/standard/tests/file/unlink_variation8-win32.phpt +++ b/ext/standard/tests/file/unlink_variation8-win32.phpt @@ -102,10 +102,10 @@ file removed Warning: unlink(%s/BADDIR/file.tmp): No such file or directory in %s on line %d -- removing unlinkVar8.tmp/file.tmp/ -- -Warning: unlink(unlinkVar8.tmp/file.tmp/): Invalid argument in %s on line %d +Warning: unlink(unlinkVar8.tmp/file.tmp/): No such file or directory in %s on line %d -- removing %s/unlinkVar8.tmp/file.tmp/ -- -Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): Invalid argument in %s on line %d +Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): No such file or directory in %s on line %d -- removing unlinkVar8.tmp//file.tmp -- file removed -- removing %s//unlinkVar8.tmp//file.tmp -- diff --git a/ext/standard/tests/file/unlink_variation9-win32.phpt b/ext/standard/tests/file/unlink_variation9-win32.phpt index acc2ce6a83..0eaed2e4ca 100644 --- a/ext/standard/tests/file/unlink_variation9-win32.phpt +++ b/ext/standard/tests/file/unlink_variation9-win32.phpt @@ -104,10 +104,10 @@ file removed Warning: unlink(%s\BADDIR\file.tmp): No such file or directory in %s on line %d -- removing unlinkVar9.tmp\file.tmp\ -- -Warning: unlink(unlinkVar9.tmp\file.tmp\): Invalid argument in %s on line %d +Warning: unlink(unlinkVar9.tmp\file.tmp\): No such file or directory in %s on line %d -- removing %s\unlinkVar9.tmp\file.tmp\ -- -Warning: unlink(%s\unlinkVar9.tmp\file.tmp\): Invalid argument in %s on line %d +Warning: unlink(%s\unlinkVar9.tmp\file.tmp\): No such file or directory in %s on line %d -- removing unlinkVar9.tmp\\file.tmp -- file removed -- removing %s\\unlinkVar9.tmp\\file.tmp -- diff --git a/ext/standard/tests/file/windows_mb_path/bug54028.phpt b/ext/standard/tests/file/windows_mb_path/bug54028.phpt new file mode 100644 index 0000000000..7dc6d0e8b8 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug54028.phpt @@ -0,0 +1,69 @@ +--TEST-- +Bug #54028 Directory::read() cannot handle non-unicode chars properly +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("mbstring"); + +?> +--FILE-- +<?php + +/* This file is in UTF-8. */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug54028" . DIRECTORY_SEPARATOR; + +$dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "汚れて掘る"); + +mkdir($prefix); +foreach ($dirs as $d) { + mkdir($prefix . $d); +} + +$directory = dir($prefix); +while (false !== ($content = $directory->read())) { + if ("." == $content || ".." == $content) continue; + + printf("Returned (%s)\n", $content); + printf("Encoding: %s\n", mb_detect_encoding($content)); + if ($content != get_basename_with_cp($prefix . $content, 65001, false)) { + echo "Verification failed!\n"; + } + echo "\n"; +} + +foreach ($dirs as $d) { + rmdir($prefix . $d); +} +rmdir($prefix); + +?> +===DONE=== +--EXPECT-- +Returned (a) +Encoding: ASCII + +Returned (şŞıİğĞ) +Encoding: UTF-8 + +Returned (ソ) +Encoding: UTF-8 + +Returned (ゾ) +Encoding: UTF-8 + +Returned (多国語) +Encoding: UTF-8 + +Returned (汚れて掘る) +Encoding: UTF-8 + +Returned (王) +Encoding: UTF-8 + +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt b/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt new file mode 100644 index 0000000000..fef7394c24 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt @@ -0,0 +1,66 @@ +--TEST-- +Bug #54028 realpath(".") return false +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php + +/* This file is in UTF-8. */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug54028" . DIRECTORY_SEPARATOR; + +$dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "汚れて掘る"); + +mkdir($prefix); +foreach ($dirs as $d) { + mkdir($prefix . $d); +} + +$old_cwd = getcwd(); +foreach ($dirs as $d) { + $now = $prefix . $d; + var_dump(chdir($now)); + var_dump($dn = realpath(".")); + var_dump($d == get_basename_with_cp($dn, 65001, false)); +} +chdir($old_cwd); + +foreach ($dirs as $d) { + rmdir($prefix . $d); +} +rmdir($prefix); + +?> +===DONE=== +--EXPECTF-- +bool(true) +string(%d) "%sa" +bool(true) +bool(true) +string(%d) "%sソ" +bool(true) +bool(true) +string(%d) "%sゾ" +bool(true) +bool(true) +string(%d) "%sşŞıİğĞ" +bool(true) +bool(true) +string(%d) "%s多国語" +bool(true) +bool(true) +string(%d) "%s王" +bool(true) +bool(true) +string(%d) "%s汚れて掘る" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug54977.phpt b/ext/standard/tests/file/windows_mb_path/bug54977.phpt new file mode 100644 index 0000000000..d5b184158e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug54977.phpt @@ -0,0 +1,52 @@ +--TEST-- +Bug #54977 UTF-8 files and folder are not shown +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php + +/* This file is in UTF-8. */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug54977" . DIRECTORY_SEPARATOR; + +$paths = array("多国語", "王", "汚れて掘る"); + +mkdir($prefix); +foreach ($paths as $d) { + mkdir($prefix . $d); + file_put_contents($prefix . $d . ".test", $d); +} + +$myDirectory = opendir($prefix); +while($entryName = readdir($myDirectory)) { + echo get_basename_with_cp($prefix . $entryName, 65001, false) . "\n"; +} +closedir($myDirectory); + +foreach ($paths as $d) { + rmdir($prefix . $d); + unlink($prefix . $d . ".test"); +} +rmdir($prefix); + +?> +===DONE=== +--EXPECT-- +testBug54977 +windows_mb_path +多国語 +多国語.test +汚れて掘る +汚れて掘る.test +王 +王.test +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug61315.phpt b/ext/standard/tests/file/windows_mb_path/bug61315.phpt new file mode 100644 index 0000000000..6ce056a250 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug61315.phpt @@ -0,0 +1,63 @@ +--TEST-- +Bug #61315 stat() fails with specific DBCS characters +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php + +/* This file is in UTF-8. */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug61315" . DIRECTORY_SEPARATOR; + +$d0 = $prefix . "ソフト"; +$d1 = $prefix . "フォルダ"; + +mkdir($prefix); + +mkdir($d0); +mkdir($d1); + +get_basename_with_cp($d0, 65001); +get_basename_with_cp($d1, 65001); + +touch("$d0\\test0.txt"); +touch("$d1\\test1.txt"); + +var_dump(count(stat("$d0\\test0.txt")) > 0); +var_dump(count(stat("$d0\\test0.txt")) > 0); + +unlink("$d0\\test0.txt"); +unlink("$d1\\test1.txt"); + +rmdir($d0); +rmdir($d1); + +rmdir($prefix); + +?> +===DONE=== +--EXPECTF-- +Active code page: 65001 +getting basename of %s\ソフト +string(9) "ソフト" +bool(true) +string(%d) "%s\ソフト" +Active code page: %d +Active code page: 65001 +getting basename of %s\フォルダ +string(12) "フォルダ" +bool(true) +string(%d) "%s\フォルダ" +Active code page: %d +bool(true) +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug64506.phpt b/ext/standard/tests/file/windows_mb_path/bug64506.phpt new file mode 100644 index 0000000000..784cffadb7 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug64506.phpt @@ -0,0 +1,51 @@ +--TEST--Bug #64506 +PHP can not read or write file correctly if file name have special char like š +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=UTF-8 +#vim: set encoding=UTF-8 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$fnw = dirname(__FILE__) . DIRECTORY_SEPARATOR . "š.txt"; // UTF-8 + +$f = fopen($fnw, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); +} else { + echo "open utf8 failed\n"; +} +var_dump(fclose($f)); + +var_dump(file_get_contents($fnw)); + +get_basename_with_cp($fnw, 65001); + +var_dump(unlink($fnw)); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\š.txt +string(6) "š.txt" +bool(true) +string(%d) "%s\š.txt" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug64699.phpt b/ext/standard/tests/file/windows_mb_path/bug64699.phpt new file mode 100644 index 0000000000..3ad000a3b4 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug64699.phpt @@ -0,0 +1,63 @@ +--TEST-- +Bug #64699 is_dir() is inaccurate result on Windows with japanese locale. +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php + +/* This file is in UTF-8. */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$old_cp = get_active_cp(); +set_active_cp(65001); + +$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug64699" . DIRECTORY_SEPARATOR; + +$dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "表"); + +mkdir($prefix); +foreach ($dirs as $d) { + mkdir($prefix . $d); +} + +$dir = $prefix; +if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + $path = $dir . $file; + $type = filetype($path); + $type2= is_dir($path) ? 'dir' : 'file'; + $comp = $type == $type2 ? 'OK' : 'NG'; + echo "filetype()[".str_pad($type, 4)."] == is_dir()[".str_pad($type2, 4)."] -> $comp: {$file}\n"; + } + closedir($dh); +} + +foreach ($dirs as $d) { + rmdir($prefix . $d); +} +rmdir($prefix); + +set_active_cp($old_cp); + +?> +===DONE=== +--EXPECTF-- +Active code page: 65001 +filetype()[dir ] == is_dir()[dir ] -> OK: . +filetype()[dir ] == is_dir()[dir ] -> OK: .. +filetype()[dir ] == is_dir()[dir ] -> OK: a +filetype()[dir ] == is_dir()[dir ] -> OK: şŞıİğĞ +filetype()[dir ] == is_dir()[dir ] -> OK: ソ +filetype()[dir ] == is_dir()[dir ] -> OK: ゾ +filetype()[dir ] == is_dir()[dir ] -> OK: 多国語 +filetype()[dir ] == is_dir()[dir ] -> OK: 表 +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug70903.phpt b/ext/standard/tests/file/windows_mb_path/bug70903.phpt new file mode 100644 index 0000000000..863fd4ab2e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug70903.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #70903 scandir wrongly interprets the Turkish "ı" character +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php + +/* This file is in UTF-8. */ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . "testBug70903" . DIRECTORY_SEPARATOR; + +$d0 = $prefix . "ı"; + +mkdir($prefix); + +mkdir($d0); + +get_basename_with_cp($d0, 65001); + +touch("$d0\\ı.txt"); + +var_dump(count(stat("$d0\\ı.txt")) > 0); + +unlink("$d0\\ı.txt"); + +rmdir($d0); + +rmdir($prefix); + +?> +===DONE=== +--EXPECTF-- +Active code page: 65001 +getting basename of %s\ı +string(2) "ı" +bool(true) +string(%d) "%s\ı" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/bug71509.phpt b/ext/standard/tests/file/windows_mb_path/bug71509.phpt new file mode 100644 index 0000000000..2d74bfc8b3 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/bug71509.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #71509 Zip problem with swedish letters in filename. +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("zip"); + +?> +--FILE-- +<?PHP +// + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv("ISO-8859-1", "UTF-8", "Rd_Statistics"); // cp1252 +$prefix = create_data("bug71509", "$item.txt"); +$testfile_zip = $prefix . DIRECTORY_SEPARATOR . "$item.txt"; +$outputfile_zip = $prefix . DIRECTORY_SEPARATOR . "$item.zip"; + +var_dump(file_exists($testfile_zip)); + +$zipfile = new ZipArchive; + +$return_code = $zipfile->open($outputfile_zip, ZipArchive::CREATE); +if ($return_code != true) die("Failed to open file: " . $return_code); + +$return_code = $zipfile->addfile($testfile_zip, basename($testfile_zip)); +if ($return_code != true) print("Failed to add file: " . $zipfile->getStatusString()); + +$return_code = $zipfile->close(); +if ($return_code != true) die("Failed to close archive: " . $zipfile->getStatusString()); + +var_dump(file_exists($outputfile_zip)); + +remove_data("bug71509"); +?> +===DONE=== +--EXPECT-- +bool(true) +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt new file mode 100644 index 0000000000..e291dd0855 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading big5 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(950, "ansi"); + +?> +--INI-- +defalut_charset=big5 +--FILE-- +<?php +/* +#vim: set fileencoding=big5 +#vim: set encoding=big5 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "զhr`|"; // BIG5 string +$prefix = create_data("file_big5", $item, 950); +$fn = $prefix . DIRECTORY_SEPARATOR . "$item"; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_big5"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(%d) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt new file mode 100644 index 0000000000..74202fa966 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir big5 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(950, "ansi"); + +?> +--INI-- +internal_encoding=big5 +--FILE-- +<?php +/* +#vim: set fileencoding=big5 +#vim: set encoding=big5 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "զhr`|"; // BIG5 string +$prefix = create_data("dir_big5", $item . "5", 950); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}5"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 950); + +var_dump(rmdir($subpath)); +remove_data("dir_big5"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 950 +getting basename of %sզhr`|5\զhr`|4 +string(%d) "զhr`|4" +bool(true) +string(%d) "%sզhr`|5\զhr`|4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt new file mode 100644 index 0000000000..3be40bf61e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen() for write big5 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(950, "ansi"); + +?> +--INI-- +defalut_charset=cp950 +--FILE-- +<?php +/* +#vim: set fileencoding=big5 +#vim: set encoding=big5 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "զhr`|"; // BIG5 string +$prefix = create_data("file_big5", $item . "25", 950); +$fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 950); + +var_dump(unlink($fn)); + +remove_data("file_big5"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 950 +getting basename of %sզhr`|25 +string(%d) "զhr`|25" +bool(true) +string(%d) "%s測試多字節路徑25" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt new file mode 100644 index 0000000000..3002b50c22 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading big5 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=big5 +#vim: set encoding=big5 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('big5', 'utf-8', "զhr`|"); // BIG5 string +$prefix = create_data("file_big5", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . "$item"; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_big5"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(%d) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt new file mode 100644 index 0000000000..abf3a76cc2 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir big5 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=big5 +#vim: set encoding=big5 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('big5', 'utf-8', "զhr`|"); // BIG5 string +$prefix = create_data("dir_big5", $item . "5"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}5"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_big5"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\測試多字節路徑5\測試多字節路徑4 +string(22) "測試多字節路徑4" +bool(true) +string(%d) "%s\測試多字節路徑5\測試多字節路徑4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt new file mode 100644 index 0000000000..f204790e8e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write big5 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=big5 +#vim: set encoding=big5 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('big5', 'utf-8', "զhr`|"); // BIG5 string +$prefix = create_data("file_big5", $item . "25"); +$fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +var_dump(unlink($fn)); + +remove_data("file_big5"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\測試多字節路徑25 +string(23) "測試多字節路徑25" +bool(true) +string(%d) "%s\測試多字節路徑25" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt new file mode 100644 index 0000000000..7a6496a619 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading UTF-8 path with cp1250 specific symbols +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1250 +#vim: set encoding=cp1250 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "šđčćž_ŠĐČĆŽ"; // cp1250 specific chars +$prefix = create_data("file_cp1250", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1250"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt new file mode 100644 index 0000000000..bd4421e7a2 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir UTF-8 path with cp1250 specific symbols +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1250 +#vim: set encoding=cp1250 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "šđčćž_ŠĐČĆŽ"; // cp1250 specific chars +$prefix = create_data("dir_cp1250", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1250"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\šđčćž_ŠĐČĆŽ42\šđčćž_ŠĐČĆŽ4 +string(22) "šđčćž_ŠĐČĆŽ4" +bool(true) +string(%d) "%s\šđčćž_ŠĐČĆŽ42\šđčćž_ŠĐČĆŽ4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt new file mode 100644 index 0000000000..488343d8d1 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write to UTF-8 path with cp1250 specific symbols +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1250 +#vim: set encoding=cp1250 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "šđčćž_ŠĐČĆŽ"; // cp1250 specific chars +$prefix = create_data("dir_cp1250", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp1250"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\šđčćž_ŠĐČĆŽ33 +string(23) "šđčćž_ŠĐČĆŽ33" +bool(true) +string(%d) "%s\šđčćž_ŠĐČĆŽ33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt new file mode 100644 index 0000000000..84b05b71d9 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading UTF-8 path with cp1250 specific symbols +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1250 +#vim: set encoding=cp1250 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "Árvíztűrő tükörfúrógép"; // cp1250 specific chars +$prefix = create_data("file_cp1250", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1250"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt new file mode 100644 index 0000000000..3759daa71d --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir UTF-8 path with cp1250 specific symbols +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1250 +#vim: set encoding=cp1250 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "Árvíztűrő tükörfúrógép"; // cp1250 specific chars +$prefix = create_data("dir_cp1250", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1250"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\Árvíztűrő tükörfúrógép42\Árvíztűrő tükörfúrógép4 +string(32) "Árvíztűrő tükörfúrógép4" +bool(true) +string(%d) "%s\Árvíztűrő tükörfúrógép42\Árvíztűrő tükörfúrógép4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt new file mode 100644 index 0000000000..7e1998ba2a --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write to UTF-8 path with cp1250 specific symbols +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1250 +#vim: set encoding=cp1250 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "Árvíztűrő tükörfúrógép"; // cp1250 specific chars +$prefix = create_data("dir_cp1250", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp1250"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\Árvíztűrő tükörfúrógép33 +string(33) "Árvíztűrő tükörfúrógép33" +bool(true) +string(%d) "%s\Árvíztűrő tükörfúrógép33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt new file mode 100644 index 0000000000..7dfd7eadbf --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test fopen() for reading CP1251 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1251, "ansi"); + +?> +--INI-- +default_charset=cp1251 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = ""; // cp1251 string +$prefix = create_data("file_cp1251", $item, 1251); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1251"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(35) "opened an utf8 filename for reading" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt new file mode 100644 index 0000000000..3abce0d0d5 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir CP1251 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1251, "ansi"); + +?> +--INI-- +default_charset=cp1251 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = ""; // cp1251 string +$prefix = create_data("dir_cp1251", $item . "3", 1251); +$path = $prefix . DIRECTORY_SEPARATOR . $item . "3"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 1251); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1251"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 1251 +getting basename of %s\3\4 +string(%d) "4" +bool(true) +string(%d) "%s\3\4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt new file mode 100644 index 0000000000..2a3b7390b1 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test fopen() for write CP1251 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1251, "ansi"); + +?> +--INI-- +internal_encoding=cp1251 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = ""; // cp1251 string +$prefix = create_data("file_cp1251", $item . "7", 1251); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 1251); + +var_dump(unlink($fn)); +remove_data("file_cp1251"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 1251 +getting basename of %s\7 +string(%d) "7" +bool(true) +string(%d) "%s\7" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt new file mode 100644 index 0000000000..13395d1017 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test fopen() for reading CP1251 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1251', 'utf-8', ""); // cp1251 string +$prefix = create_data("file_cp1251", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1251"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(35) "opened an utf8 filename for reading" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt new file mode 100644 index 0000000000..193e2fdc74 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir CP1251 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1251', 'utf-8', ""); // cp1251 string +$prefix = create_data("dir_cp1251", $item . "3"); +$path = $prefix . DIRECTORY_SEPARATOR . $item . "3"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1251"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\привет3\привет4 +string(13) "привет4" +bool(true) +string(%d) "%s\привет3\привет4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt new file mode 100644 index 0000000000..e552464214 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen() for write CP1251 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1251', 'utf-8', ""); // cp1251 string +$prefix = create_data("file_cp1251", $item . "7"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +var_dump(unlink($fn)); +remove_data("file_cp1251"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\привет7 +string(13) "привет7" +bool(true) +string(%d) "%s\привет7" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt new file mode 100644 index 0000000000..b638eb4822 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test fopen() for reading CP1251 with zend.multibyte +--INI-- +zend.multibyte=1 +zend.script_encoding=cp1251 +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("mbstring"); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = ""; // cp1251 string +$prefix = create_data("file_cp1251", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open failed\n"; +} + +remove_data("file_cp1251"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(35) "opened an utf8 filename for reading" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt new file mode 100644 index 0000000000..e44849b061 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir CP1251 with zend.multibyte +--INI-- +zend.multibyte=1 +zend.script_encoding=cp1251 +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("mbstring"); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = ""; // cp1251 string +$prefix = create_data("dir_cp1251", $item . "3"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}3"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1251"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\привет3\привет4 +string(13) "привет4" +bool(true) +string(%d) "%s\привет3\привет4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt new file mode 100644 index 0000000000..c0b685c55b --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test fopen() for write CP1251 with zend.multibyte +--INI-- +zend.multibyte=1 +zend.script_encoding=cp1251 +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("mbstring"); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1251 +#vim: set encoding=cp1251 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "7"; // cp1251 string +$prefix = create_data("file_cp1251", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +var_dump(unlink($fn)); +remove_data("file_cp1251"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\привет7 +string(13) "привет7" +bool(true) +string(%d) "%s\привет7" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt new file mode 100644 index 0000000000..85a1c41f07 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +cp1252 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(437, "oem"); + +?> +--INI-- +internal_encoding=cp1252 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "gef"; +$prefix = create_data("file", $item, 1252); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b " . $fn); + +remove_data("file"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\gef" +bool(true) +bool(true) +gef +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt new file mode 100644 index 0000000000..bdb1a7a878 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp1252 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1252', 'utf-8', "tsch"); // cp1252 string +$prefix = create_data("file_cp1252", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1252"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(%d) "hallo +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt new file mode 100644 index 0000000000..059ab8dd8f --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp1252 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1252', 'utf-8', "tsch"); // cp1252 string +$prefix = create_data("dir_cp1252", "${item}3"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}3"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1252"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\tschüß3\tschüß4 +string(9) "tschüß4" +bool(true) +string(%d) "%s\tschüß3\tschüß4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt new file mode 100644 index 0000000000..9ea2485eeb --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen() for write cp1252 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1252', 'utf-8', "tsch"); // cp1252 string +$prefix = create_data("dir_cp1252", "${item}3"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +var_dump(unlink($fn)); +remove_data("dir_cp1252"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\tschüß7 +string(9) "tschüß7" +bool(true) +string(%d) "%s\tschüß7" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt new file mode 100644 index 0000000000..cae3426e75 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test fopen() for reading cp1252 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1252', 'utf-8', "Volao"); // cp1252 string +$prefix = create_data("file2_cp1252", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file2_cp1252"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(4) "hola" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt new file mode 100644 index 0000000000..cacaf5d36d --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp1252 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1252', 'utf-8', "Volao"); // cp1252 string +$prefix = create_data("dir2_cp1252", "${item}3"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}3"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir2_cp1252"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\Voláçao3\Voláçao4 +string(10) "Voláçao4" +bool(true) +string(%d) "%s\Voláçao3\Voláçao4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt new file mode 100644 index 0000000000..3ac634134a --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen() for write cp1252 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1252 +#vim: set encoding=cp1252 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp1252', 'utf-8', "Volao"); // cp1252 string +$prefix = create_data("dir2_cp1252", "${item}3"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}7"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +var_dump(unlink($fn)); +remove_data("dir2_cp1252"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\Voláçao7 +string(10) "Voláçao7" +bool(true) +string(%d) "%s\Voláçao7" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt new file mode 100644 index 0000000000..12ae1ac7cd --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading cp1253 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1253, "ansi"); + +?> +--INI-- +internal_encoding=cp1253 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1253 +#vim: set encoding=cp1253 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("file_cp1253", $item, 1253); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1253"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt new file mode 100644 index 0000000000..9049a65ee1 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir cp1253 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1253, "ansi"); + +?> +--INI-- +default_charset=cp1253 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1253 +#vim: set encoding=cp1253 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("dir_cp1253", "${item}42", 1253); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 1253); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1253"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 1253 +getting basename of %s\ 42\ 4 +string(%d) " 4" +bool(true) +string(%d) "%s\ 42\ 4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt new file mode 100644 index 0000000000..4c39fb5bda --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write cp1253 +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1253, "ansi"); + +?> +--INI-- +internal_encoding=cp1253 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1253 +#vim: set encoding=cp1253 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("dir_cp1253", "${item}42}", 1253); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 1253); + +remove_data("dir_cp1253"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 1253 +getting basename of %s\ 33 +string(%d) " 33" +bool(true) +string(%d) "%s\ 33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt new file mode 100644 index 0000000000..0fbc78fc12 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp1253 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1253 +#vim: set encoding=cp1253 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "διαδρομή δοκιμής"; +$prefix = create_data("file_cp1253", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1253"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt new file mode 100644 index 0000000000..ddc79b1204 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp1253 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1253 +#vim: set encoding=cp1253 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "διαδρομή δοκιμής"; +$prefix = create_data("dir_cp1253", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1253"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\διαδρομή δοκιμής42\διαδρομή δοκιμής4 +string(32) "διαδρομή δοκιμής4" +bool(true) +string(%d) "%s\διαδρομή δοκιμής42\διαδρομή δοκιμής4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt new file mode 100644 index 0000000000..6e28c89e0c --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write cp1253 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1253 +#vim: set encoding=cp1253 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "διαδρομή δοκιμής"; +$prefix = create_data("dir_cp1253", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp1253"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\διαδρομή δοκιμής33 +string(33) "διαδρομή δοκιμής33" +bool(true) +string(%d) "%s\διαδρομή δοκιμής33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt new file mode 100644 index 0000000000..5fbcb74602 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading cp1254 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(857, "oem"); + +?> +--INI-- +default_charset=cp1254 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "okbaytl ileri"; +$prefix = create_data("file_cp1254", $item, 1254); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1254"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt new file mode 100644 index 0000000000..314f78ecb8 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir cp1254 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(857, "oem"); + +?> +--INI-- +internal_encoding=cp1254 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "okbaytl ileri"; +$prefix = create_data("dir_cp1254", "${item}42", 1254); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 1254); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1254"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 1254 +getting basename of %s\okbaytl ileri42\okbaytl ileri4 +string(%d) "okbaytl ileri4" +bool(true) +string(%d) "%s\okbaytl ileri42\okbaytl ileri4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt new file mode 100644 index 0000000000..d2a04d905a --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write cp1254 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(857, "oem"); + +?> +--INI-- +internal_encoding=cp1254 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "okbaytl ileri"; +$prefix = create_data("dir_cp1254", "${item}42}", 1254); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 1254); + +remove_data("dir_cp1254"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 1254 +getting basename of %s\okbaytl ileri33 +string(%d) "okbaytl ileri33" +bool(true) +string(%d) "%s\okbaytl ileri33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt new file mode 100644 index 0000000000..13357217c8 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt @@ -0,0 +1,43 @@ +--TEST-- +cp1254 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1254, "ansi"); + +?> +--INI-- +default_charset=cp1254 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$item = "okbaytl ileri"; +$prefix = create_data("file_cp1254", $item, 1254); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b \"" . $fn . "\""); + +remove_data("file_cp1254"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\okbaytl ileri" +bool(true) +bool(true) +okbaytl ileri +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt new file mode 100644 index 0000000000..9a92099cd0 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp1254 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "çokbaytlı işleri"; +$prefix = create_data("file_cp1254", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1254"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt new file mode 100644 index 0000000000..551a0f2235 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp1254 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "çokbaytlı işleri"; +$prefix = create_data("dir_cp1254", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1254"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\çokbaytlı işleri42\çokbaytlı işleri4 +string(20) "çokbaytlı işleri4" +bool(true) +string(%d) "%s\çokbaytlı işleri42\çokbaytlı işleri4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt new file mode 100644 index 0000000000..12df56b11e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write cp1254 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "çokbaytlı işleri"; +$prefix = create_data("dir_cp1254", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp1254"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\çokbaytlı işleri33 +string(%d) "çokbaytlı işleri33" +bool(true) +string(%d) "%s\çokbaytlı işleri33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt new file mode 100644 index 0000000000..cbaba44e4e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt @@ -0,0 +1,40 @@ +--TEST-- +cp1254 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1254 +#vim: set encoding=cp1254 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$item = "çokbaytlı işleri"; +$prefix = create_data("file_cp1254", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b \"" . $fn . "\""); + +remove_data("file_cp1254"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\çokbaytlı işleri" +bool(true) +bool(true) +çokbaytlı işleri +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt new file mode 100644 index 0000000000..8a685b68c4 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading cp1255 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1255, "ansi"); + +?> +--INI-- +internal_encoding=cp1255 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1255 +#vim: set encoding=cp1255 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("file_cp1255", $item, 1255); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1255"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt new file mode 100644 index 0000000000..391a282a69 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir cp1255 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1255, "ansi"); + +?> +--INI-- +default_charset=cp1255 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1255 +#vim: set encoding=cp1255 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("dir_cp1255", "${item}42", 1255); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 1255); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1255"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 1255 +getting basename of %s\ 42\ 4 +string(%d) " 4" +bool(true) +string(%d) "%s\ 42\ 4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt new file mode 100644 index 0000000000..2f38398bb5 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write cp1255 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1255, "ansi"); + +?> +--INI-- +internal_encoding=cp1255 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1255 +#vim: set encoding=cp1255 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("dir_cp1255", "${item}42}", 1255); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 1255); + +remove_data("dir_cp1255"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 1255 +getting basename of %s\ 33 +string(%d) " 33" +bool(true) +string(%d) "%s\ 33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt new file mode 100644 index 0000000000..31a48dbc0c --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp1255 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1255 +#vim: set encoding=cp1255 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "כללים מרובים"; +$prefix = create_data("file_cp1255", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1255"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt new file mode 100644 index 0000000000..b6a59e4be3 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp1255 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1255 +#vim: set encoding=cp1255 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "כללים מרובים"; +$prefix = create_data("dir_cp1255", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1255"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\כללים מרובים42\כללים מרובים4 +string(24) "כללים מרובים4" +bool(true) +string(%s) "%s\כללים מרובים42\כללים מרובים4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt new file mode 100644 index 0000000000..53f83b3a0e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write cp1255 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1255 +#vim: set encoding=cp1255 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "כללים מרובים"; +$prefix = create_data("dir_cp1255", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp1255"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\כללים מרובים33 +string(%s) "כללים מרובים33" +bool(true) +string(%d) "%s\כללים מרובים33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt new file mode 100644 index 0000000000..6b473abb54 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading cp1256 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1256, "ansi"); + +?> +--INI-- +internal_encoding=cp1256 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1256 +#vim: set encoding=cp1256 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; // cp1256 string +$prefix = create_data("file_cp1256", $item, 1256); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1256"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt new file mode 100644 index 0000000000..1a4233f2c2 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir cp1256 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1256, "ansi"); + +?> +--INI-- +internal_encoding=cp1256 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1256 +#vim: set encoding=cp1256 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("dir_cp1256", "${item}42", 1256); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 1256); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1256"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 1256 +getting basename of %s\ 42\ 4 +string(%d) " 4" +bool(true) +string(%d) "%s\ 42\ 4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt new file mode 100644 index 0000000000..5c25d60fc8 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write cp1256 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(1256, "ansi"); + +?> +--INI-- +default_charset=cp1256 +--FILE-- +<?php +/* +#vim: set fileencoding=cp1256 +#vim: set encoding=cp1256 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = " "; +$prefix = create_data("dir_cp1256", "${item}42}", 1256); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 1256); + +remove_data("dir_cp1256"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 1256 +getting basename of %s\ 33 +string(%d) " 33" +bool(true) +string(%d) "%s\ 33" +Active code page: %s +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt new file mode 100644 index 0000000000..b021df7fa4 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp1256 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1256 +#vim: set encoding=cp1256 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "مسار متعدد البايت اختبار"; +$prefix = create_data("file_cp1256", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp1256"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt new file mode 100644 index 0000000000..2fb10a97a5 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp1256 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1256 +#vim: set encoding=cp1256 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "مسار متعدد البايت اختبار"; +$prefix = create_data("dir_cp1256", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp1256"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\مسار متعدد البايت اختبار42\مسار متعدد البايت اختبار4 +string(46) "مسار متعدد البايت اختبار4" +bool(true) +string(%d) "%s\مسار متعدد البايت اختبار42\مسار متعدد البايت اختبار4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt new file mode 100644 index 0000000000..ba70e1a77e --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write cp1256 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp1256 +#vim: set encoding=cp1256 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "مسار متعدد البايت اختبار"; +$prefix = create_data("dir_cp1256", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp1256"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\مسار متعدد البايت اختبار33 +string(47) "مسار متعدد البايت اختبار33" +bool(true) +string(%d) "%s\مسار متعدد البايت اختبار33" +Active code page: %s +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt new file mode 100644 index 0000000000..52f080e2c2 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt @@ -0,0 +1,114 @@ +--TEST-- +Thai cp874 basic test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(874, "oem"); + +?> +--INI-- +default_charset=cp874 +--FILE-- +<?php +/* +#vim: set fileencoding=cp874 +#vim: set encoding=cp874 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$names = array( /* cp874 */ + "跴ͺ1", + "跴ͺ2", + "跴ͺ3", + "跴ͺ4", + "跴ͺ5", + "跴ͺ6", + "跴ͺ7", + "跴ͺ8", + "跴ͺ8 10", +); + +$i = 0; +foreach ($names as $name) { + $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $name . ".txt"; + + file_put_contents($path, "hello" . $i++); + + get_basename_with_cp($path, 874); + var_dump(file_get_contents($path)); + + unlink($path); +} + +?> +===DONE=== +--EXPECTF-- +Active code page: %d +getting basename of %s跴ͺ1.txt +string(%d) "跴ͺ1.txt" +bool(true) +string(%d) "%s跴ͺ1.txt" +Active code page: %d +string(6) "hello0" +Active code page: %d +getting basename of %s跴ͺ2.txt +string(%d) "跴ͺ2.txt" +bool(true) +string(%d) "%s跴ͺ2.txt" +Active code page: %d +string(6) "hello1" +Active code page: %d +getting basename of %s跴ͺ3.txt +string(%d) "跴ͺ3.txt" +bool(true) +string(%d) "%s跴ͺ3.txt" +Active code page: %d +string(6) "hello2" +Active code page: %d +getting basename of %s跴ͺ4.txt +string(%d) "跴ͺ4.txt" +bool(true) +string(%d) "%s跴ͺ4.txt" +Active code page: %d +string(6) "hello3" +Active code page: %d +getting basename of %s跴ͺ5.txt +string(%d) "跴ͺ5.txt" +bool(true) +string(%d) "%s跴ͺ5.txt" +Active code page: %d +string(6) "hello4" +Active code page: %d +getting basename of %s跴ͺ6.txt +string(%d) "跴ͺ6.txt" +bool(true) +string(%d) "%s跴ͺ6.txt" +Active code page: %d +string(6) "hello5" +Active code page: %d +getting basename of %s跴ͺ7.txt +string(%d) "跴ͺ7.txt" +bool(true) +string(%d) "%s跴ͺ7.txt" +Active code page: %d +string(6) "hello6" +Active code page: %d +getting basename of %s跴ͺ8.txt +string(%d) "跴ͺ8.txt" +bool(true) +string(%d) "%s跴ͺ8.txt" +Active code page: %d +string(6) "hello7" +Active code page: %d +getting basename of %s跴ͺ8 10.txt +string(%d) "跴ͺ8 10.txt" +bool(true) +string(%d) "%s跴ͺ8 10.txt" +Active code page: %d +string(6) "hello8" +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt new file mode 100644 index 0000000000..6cb2fb7eee --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt @@ -0,0 +1,43 @@ +--TEST-- +Thai cp874 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(874, "ansi"); + +?> +--INI-- +internal_encoding=cp874 +--FILE-- +<?php +/* +#vim: set fileencoding=cp874 +#vim: set encoding=cp874 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$item = "跴ͺ11"; +$prefix = create_data("file_cp874", $item, 874); +$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b " . $fn); + +remove_data("file_cp874"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\跴ͺ11" +bool(true) +bool(true) +跴ͺ11 +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt new file mode 100644 index 0000000000..8d32f88a8c --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt @@ -0,0 +1,111 @@ +--TEST-- +Thai UTF-8 basic test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp874 +#vim: set encoding=cp874 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$names = array( /* cp874 */ + "跴ͺ1", + "跴ͺ2", + "跴ͺ3", + "跴ͺ4", + "跴ͺ5", + "跴ͺ6", + "跴ͺ7", + "跴ͺ8", + "跴ͺ8 10", +); + +$i = 0; +foreach ($names as $name) { + $pathw = dirname(__FILE__) . DIRECTORY_SEPARATOR . iconv('cp874', 'utf-8', $name) . ".txt"; + + file_put_contents($pathw, "hello" . $i++); + + get_basename_with_cp($pathw, 65001); + var_dump(file_get_contents($pathw)); + + unlink($pathw); +} + +?> +===DONE=== +--EXPECTF-- +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ1.txt +string(%d) "เป็นแฟ้มที่ทดสอบ1.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ1.txt" +Active code page: %d +string(6) "hello0" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ2.txt +string(%d) "เป็นแฟ้มที่ทดสอบ2.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ2.txt" +Active code page: %d +string(6) "hello1" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ3.txt +string(%d) "เป็นแฟ้มที่ทดสอบ3.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ3.txt" +Active code page: %d +string(6) "hello2" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ4.txt +string(%d) "เป็นแฟ้มที่ทดสอบ4.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ4.txt" +Active code page: %d +string(6) "hello3" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ5.txt +string(%d) "เป็นแฟ้มที่ทดสอบ5.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ5.txt" +Active code page: %d +string(6) "hello4" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ6.txt +string(%d) "เป็นแฟ้มที่ทดสอบ6.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ6.txt" +Active code page: %d +string(6) "hello5" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ7.txt +string(%d) "เป็นแฟ้มที่ทดสอบ7.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ7.txt" +Active code page: %d +string(6) "hello6" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ8.txt +string(%d) "เป็นแฟ้มที่ทดสอบ8.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ8.txt" +Active code page: %d +string(6) "hello7" +Active code page: %d +getting basename of %sเป็นแฟ้มที่ทดสอบ8 10.txt +string(%d) "เป็นแฟ้มที่ทดสอบ8 10.txt" +bool(true) +string(%d) "%sเป็นแฟ้มที่ทดสอบ8 10.txt" +Active code page: %d +string(6) "hello8" +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt new file mode 100644 index 0000000000..843c66f4a2 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt @@ -0,0 +1,40 @@ +--TEST-- +Thai UTF-8 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp874 +#vim: set encoding=cp874 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$item = "เป็นแฟ้มที่ทดสอบ11"; +$prefix = create_data("file_cp874", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b " . $fn); + +remove_data("file_cp874"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\เป็นแฟ้มที่ทดสอบ11" +bool(true) +bool(true) +เป็นแฟ้มที่ทดสอบ11 +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt new file mode 100644 index 0000000000..1835f0d360 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading cp932 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(932, "ansi"); + +?> +--INI-- +default_charset=cp932 +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "eXg}`oCgEpX"; // cp932 string +$prefix = create_data("file_cp932", $item, 932); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp932"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt new file mode 100644 index 0000000000..f7f24c045d --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir cp932 +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(932, "oem"); + +?> +--INI-- +default_charset=cp932 +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "eXg}`oCgEpX"; // cp932 string +$prefix = create_data("dir_cp932", "${item}42", 932); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 932); + +var_dump(rmdir($subpath)); +remove_data("dir_cp932"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 932 +getting basename of %s\eXg}`oCgEpX42\eXg}`oCgEpX4 +string(%d) "eXg}`oCgEpX4" +bool(true) +string(%d) "%s\eXg}`oCgEpX42\eXg}`oCgEpX4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt new file mode 100644 index 0000000000..d529f6a484 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write to cp932 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(932, "oem"); + +?> +--INI-- +internal_encoding=cp932 +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "eXg}`oCgEpX"; // cp932 string +$prefix = create_data("dir_cp932", "${item}42}", 932); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 932); + +remove_data("dir_cp932"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 932 +getting basename of %s\eXg}`oCgEpX33 +string(%d) "eXg}`oCgEpX33" +bool(true) +string(%d) "%s\eXg}`oCgEpX33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt new file mode 100644 index 0000000000..db31c1ad7a --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt @@ -0,0 +1,43 @@ +--TEST-- +cp932 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(932, "ansi"); + +?> +--INI-- +internal_encoding=cp932 +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$item = "eXg}`oCgEpX77"; // cp932 string +$prefix = create_data("file_cp932", $item, 932); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b " . $fn); + +remove_data("file_cp932"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\eXg}`oCgEpX77" +bool(true) +bool(true) +eXg}`oCgEpX77 +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt new file mode 100644 index 0000000000..a04c14d276 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp932 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp932', 'utf-8', "eXg}`oCgEpX"); // cp932 string +$prefix = create_data("file_cp932", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp932"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt new file mode 100644 index 0000000000..9b13922a7a --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp932 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp932', 'utf-8', "eXg}`oCgEpX"); // cp932 string +$prefix = create_data("dir_cp932", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp932"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\テストマルチバイト・パス42\テストマルチバイト・パス4 +string(37) "テストマルチバイト・パス4" +bool(true) +string(%d) "%s\テストマルチバイト・パス42\テストマルチバイト・パス4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt new file mode 100644 index 0000000000..fbe290468c --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write cp932 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp932 +#vim: set encoding=cp932 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp932', 'utf-8', "eXg}`oCgEpX"); // cp932 string +$prefix = create_data("dir_cp932", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_cp932"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\テストマルチバイト・パス33 +string(38) "テストマルチバイト・パス33" +bool(true) +string(%d) "%s\テストマルチバイト・パス33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt new file mode 100644 index 0000000000..bcaa31353f --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test fopen() for reading cp936 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(936, "ansi"); + +?> +--INI-- +internal_encoding=cp936 +--FILE-- +<?php +/* +#vim: set fileencoding=cp936 +#vim: set encoding=cp936 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "yԇֹ·"; // cp936 string +$prefix = create_data("file_cp936", $item, 936); +$fn = $prefix . DIRECTORY_SEPARATOR . "$item"; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp936"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(%d) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt new file mode 100644 index 0000000000..9edb6d1301 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test mkdir/rmdir cp936 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(936, "oem"); + +?> +--INI-- +internal_encoding=cp936 +--FILE-- +<?php +/* +#vim: set fileencoding=cp936 +#vim: set encoding=cp936 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "yԇֹ·"; // cp936 string +$prefix = create_data("dir_cp936", $item . "5", 936); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}5"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 936); + +var_dump(rmdir($subpath)); +remove_data("dir_cp936"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 936 +getting basename of %s\yԇֹ·5\yԇֹ·4 +string(15) "yԇֹ·4" +bool(true) +string(%d) "%s\yԇֹ·5\yԇֹ·4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt new file mode 100644 index 0000000000..2c05c313e9 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fopen() for write cp936 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); +skip_if_wrong_cp(936, "oem"); + +?> +--INI-- +default_charset=cp936 +--FILE-- +<?php +/* +#vim: set fileencoding=cp936 +#vim: set encoding=cp936 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "yԇֹ·"; // cp936 string +$prefix = create_data("file_cp936", $item . "25", 936); +$fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 936); + +var_dump(unlink($fn)); + +remove_data("file_cp936"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 936 +getting basename of %s\yԇֹ·25 +string(%d) "yԇֹ·25" +bool(true) +string(%d) "%s\yԇֹ·25" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt new file mode 100644 index 0000000000..554a05d94c --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading cp936 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp936 +#vim: set encoding=cp936 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp936', 'utf-8', "yԇֹ·"); // cp936 string +$prefix = create_data("file_cp936", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . "$item"; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_cp936"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(%d) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt new file mode 100644 index 0000000000..79bdfa4283 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir cp936 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp936 +#vim: set encoding=cp936 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp936', 'utf-8', "yԇֹ·"); // cp936 string +$prefix = create_data("dir_cp936", $item . "5"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}5"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_cp936"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\測試多字節路徑5\測試多字節路徑4 +string(22) "測試多字節路徑4" +bool(true) +string(%d) "%s\測試多字節路徑5\測試多字節路徑4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt new file mode 100644 index 0000000000..22b64c31f9 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test fopen() for write cp936 to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp936 +#vim: set encoding=cp936 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('cp936', 'utf-8', "yԇֹ·"); // cp936 string +$prefix = create_data("file_cp936", $item . "25"); +$fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +var_dump(unlink($fn)); + +remove_data("file_cp936"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\測試多字節路徑25 +string(23) "測試多字節路徑25" +bool(true) +string(%d) "%s\測試多字節路徑25" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt new file mode 100644 index 0000000000..d41a215b68 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test chdir()/getcwd() with a dir for multibyte filenames + +--SKIPIF-- + +<?php + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + + +?> + +--FILE-- + +<?php + + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = create_data("dir_mb"); +$dirw = $prefix . DIRECTORY_SEPARATOR . "テストマルチバイト・パス42"; +touch($dirw . DIRECTORY_SEPARATOR . "dummy.txt"); + +$old_cp = get_active_cp(); +set_active_cp(65001); + +$oldcwd = getcwd(); +var_dump(chdir($dirw)); +var_dump(getcwd()); + +var_dump(file_exists("dummy.txt")); + +set_active_cp($old_cp); + +chdir($oldcwd); +remove_data("dir_mb"); + +?> +===DONE=== + +--EXPECTF-- +Active code page: 65001 +bool(true) +string(%d) "%s\テストマルチバイト・パス42" +bool(true) +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt new file mode 100644 index 0000000000..0ff640aa35 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading eucjp to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=eucjp +#vim: set encoding=eucjp +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('eucjp', 'utf-8', "ƥȥޥХȡѥ"); // EUCJP string +$prefix = create_data("file_eucjp", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_eucjp"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt new file mode 100644 index 0000000000..5a481e8d12 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir eucjp to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=eucjp +#vim: set encoding=eucjp +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('eucjp', 'utf-8', "ƥȥޥХȡѥ"); // EUCJP string +$prefix = create_data("dir_eucjp", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_eucjp"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\テストマルチバイト・パス42\テストマルチバイト・パス4 +string(37) "テストマルチバイト・パス4" +bool(true) +string(%d) "%s\テストマルチバイト・パス42\テストマルチバイト・パス4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt new file mode 100644 index 0000000000..50727a9d71 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write eucjp to UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=eucjp +#vim: set encoding=eucjp +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = iconv('eucjp', 'utf-8', "ƥȥޥХȡѥ"); // EUCJP string +$prefix = create_data("dir_eucjp", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_eucjp"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\テストマルチバイト・パス33 +string(38) "テストマルチバイト・パス33" +bool(true) +string(%d) "%s\テストマルチバイト・パス33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt new file mode 100644 index 0000000000..32b6f9b066 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test fopen() for reading Kartuli UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=utf-8 +#vim: set encoding=utf-8 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "ქართველები"; +$prefix = create_data("file_kartuli", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +$f = fopen($fn, 'r'); +if ($f) { + var_dump($f, fread($f, 42)); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +remove_data("file_kartuli"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +string(37) "reading file wihh multibyte filename +" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt new file mode 100644 index 0000000000..a92e7c34ed --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test mkdir/rmdir Kartuli UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=utf-8 +#vim: set encoding=utf-8 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "ქართველები"; +$prefix = create_data("dir_kartuli", "${item}42"); +$path = $prefix . DIRECTORY_SEPARATOR . "${item}42"; + +$subpath = $path . DIRECTORY_SEPARATOR . "${item}4"; + +/* The mb dirname exists*/ +var_dump(file_exists($path)); + +var_dump(mkdir($subpath)); +var_dump(file_exists($subpath)); + +get_basename_with_cp($subpath, 65001); + +var_dump(rmdir($subpath)); +remove_data("dir_kartuli"); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +Active code page: 65001 +getting basename of %s\ქართველები42\ქართველები4 +string(31) "ქართველები4" +bool(true) +string(%d) "%s\ქართველები42\ქართველები4" +Active code page: %d +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt new file mode 100644 index 0000000000..edfb279cd2 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test fopen() for write Kartuli UTF-8 path +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=kartuli +#vim: set encoding=kartuli +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$item = "ქართველები"; +$prefix = create_data("dir_kartuli", "${item}42}"); +$fn = $prefix . DIRECTORY_SEPARATOR . "${item}33"; + +$f = fopen($fn, 'w'); +if ($f) { + var_dump($f, fwrite($f, "writing to an mb filename")); + var_dump(fclose($f)); +} else { + echo "open utf8 failed\n"; +} + +var_dump(file_get_contents($fn)); + +get_basename_with_cp($fn, 65001); + +remove_data("dir_kartuli"); + +?> +===DONE=== +--EXPECTF-- +resource(%d) of type (stream) +int(25) +bool(true) +string(25) "writing to an mb filename" +Active code page: 65001 +getting basename of %s\ქართველები33 +string(32) "ქართველები33" +bool(true) +string(%d) "%s\ქართველები33" +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt new file mode 100644 index 0000000000..46077258d1 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt @@ -0,0 +1,40 @@ +--TEST-- +Kartuli UTF-8 cmd test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php +/* +#vim: set fileencoding=cp874 +#vim: set encoding=cp874 +*/ + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$item = "ქართველები55"; +$prefix = create_data("file_kartuli", $item); +$fn = $prefix . DIRECTORY_SEPARATOR . $item; + +var_dump($fn); +var_dump(touch($fn)); +var_dump(file_exists($fn)); +system("dir /b " . $fn); + +remove_data("file_kartuli"); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\ქართველები55" +bool(true) +bool(true) +ქართველები55 +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt new file mode 100644 index 0000000000..6bc28110e0 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt @@ -0,0 +1,47 @@ +--TEST-- +Basic long path test +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("mbstring"); + +?> +--FILE-- +<?php + +$p = ""; +$s = str_repeat('a', 50); +$how_many = 32; + +for ($i = 0; $i < $how_many; $i++) { + $p .= "$s"; + $p .= DIRECTORY_SEPARATOR; +} + +$p = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $p; + +echo strlen($p), "\n", $p, "\n"; + + +var_dump(mkdir($p, 0777, true)); +var_dump(file_exists($p)); + +for ($i = 0; $i < $how_many; $i++) { + $p0 = substr($p, 0, strlen($p) - $i*51); + rmdir($p0); +} + +var_dump(file_exists(realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $s)); + +?> +===DONE=== +--EXPECTF-- +%d%d%d%d +%s\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ +bool(true) +bool(true) +bool(false) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt new file mode 100644 index 0000000000..94518e7a65 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt @@ -0,0 +1,55 @@ +--TEST-- +Basic long path test with file I/O +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); + +?> +--FILE-- +<?php + +$p = ""; +$s = str_repeat('a', 50); +$how_many = 32; + + +for ($i = 0; $i < $how_many; $i++) { + $p .= "$s"; + $p .= DIRECTORY_SEPARATOR; +} + +$p = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $p; + +echo strlen($p), "\n", $p, "\n"; + + +var_dump(mkdir($p, 0777, true)); +var_dump(file_exists($p)); + +$p7 = $p . "hello.txt"; + +file_put_contents($p7, "hello"); +var_dump(file_get_contents($p7)); + +unlink($p7); + +for ($i = 0; $i < $how_many; $i++) { + $p0 = substr($p, 0, strlen($p) - $i*51); + rmdir($p0); +} + +var_dump(file_exists(realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $s)); + +?> +===DONE=== +--EXPECTF-- +%d%d%d%d +%s\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ +bool(true) +bool(true) +string(5) "hello" +bool(false) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt new file mode 100644 index 0000000000..3be1850c5a --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt @@ -0,0 +1,64 @@ +--TEST-- +Basic long path test with file I/O, multibyte path and realpath() check +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts("mbstring"); + +?> +--FILE-- +<?php +$p = ""; +$s = str_repeat('x', 50) . "ü"; +$how_many = 32; + + +for ($i = 0; $i < $how_many; $i++) { + $p .= "$s"; + $p .= DIRECTORY_SEPARATOR; +} + +/* path doesn't exist at this point! */ +$p = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $p; + +echo strlen($p), "\n", $p, "\n"; + +var_dump(mkdir($p, 0777, true)); +var_dump(file_exists($p)); + +/* path exists now, ensure realpath() works! */ +$p2 = realpath($p); +var_dump($p2); +/* realpath() will cut off the trailing slash */ +var_dump(substr($p, 0, strlen($p) - 1) == $p2); + +$p7 = $p . "hello.txt"; + +var_dump(file_put_contents($p7, "hello")); +var_dump(file_get_contents($p7)); + +unlink($p7); + +for ($i = 0; $i < $how_many; $i++) { + $p0 = substr($p, 0, strlen($p) - $i*(strlen($s) + 1)); + rmdir($p0); +} + +var_dump(file_exists(realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . $s)); + +?> +===DONE=== +--EXPECTF-- +%d%d%d%d +%s\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\ +bool(true) +bool(true) +string(%d%d%d%d) "%s\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü" +bool(true) +int(5) +string(5) "hello" +bool(false) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt new file mode 100644 index 0000000000..5ea66058ea --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #30730 Filename path length limit broken on NTFS volume, using rename +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); + +?> +--FILE-- +<?php + +$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test_bug30730"; +$file = $dir . DIRECTORY_SEPARATOR . "test_file"; + +var_dump(mkdir($dir)); + +// Create a file in that directory + +$fp = fopen($file, 'wb+'); +fclose($fp); + +// Rename that directory in order that the file full path will be long enough to trigger the bug + +$dest_dir =str_pad($dir, 200, '0'); +$dest_file = $dest_dir . DIRECTORY_SEPARATOR . "test_file"; + +var_dump(rename($dir, $dest_dir)); + +var_dump(file_exists($dest_file)); + +var_dump(unlink($dest_file)); +var_dump(rmdir($dest_dir)); + +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt new file mode 100644 index 0000000000..6eb484fcd0 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #70943 fopen() can't open a file if path is 259 characters long +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); + +?> +--FILE-- +<?php +// Generates a sample file whose path is exactly 259 characters long +$testFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_repeat("a", 254 - strlen(dirname(__FILE__))).".dat"; +echo "Generating a file with a path length of ".strlen($testFile)." characters...\r\n"; +touch($testFile); + +echo "Opening file... "; +if ($fp = fopen($testFile, "r")) { + fclose($fp); + echo "OK", "\n"; +} + +unlink($testFile); + +?> +===DONE=== +--EXPECTF-- +Generating a file with a path length of 259 characters... +Opening file... OK +===DONE=== + diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt new file mode 100644 index 0000000000..4b5bd445f4 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #71103 file_exists and is_readable fail silently +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); + +?> +--FILE-- +<?php + +$base = dirname(__FILE__); +$d = $base . '\\dev\\http\\tproj\\app\\cache\\dev_old\\annotations\\72'; + +$foo = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b.doctrinecache.data'; +$bar = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b315d.doctrinecache.data'; + +mkdir($d, NULL, true); + +foreach (array($foo, $bar) as $f) { + touch($f); + + $foo_obj = new \SplFileInfo($f); + var_dump( + $f, + strlen($f) > 260, /* exceeds _MAX_PATH */ + file_exists($f), + file_exists($foo_obj), + is_readable($f), + is_readable($foo_obj), + is_writable($f), + is_writable($foo_obj) + ); + + unlink($f); +} + +$p = $d; +do { + rmdir($p); + $p = dirname($p); +} while ($p != $base); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%s\dev\http\tproj\app\cache\dev_old\annotations\72\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b.doctrinecache.data" +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +string(%d) "%s\dev\http\tproj\app\cache\dev_old\annotations\72\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b315d.doctrinecache.data" +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt new file mode 100644 index 0000000000..9550857b54 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test readdir() with a dir for multibyte filenames +--SKIPIF-- +<?php +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + +?> +--FILE-- +<?php + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + +$prefix = create_data("mb_names"); +$content = ""; +create_verify_file($prefix, "českýtestování.inc", $content); +create_verify_file($prefix, "Röd_Statistics.txt", $content); +create_verify_file($prefix, "š.txt", ""); +create_verify_file($prefix, "tschüß", $content); +create_verify_file($prefix, "Voláçao", "hola"); +create_verify_file($prefix, "Ελλάδα.txt", ""); +create_verify_file($prefix, "привет", "opened an utf8 filename for reading"); +create_verify_file($prefix, "テストマルチバイト・パス", $content); +create_verify_file($prefix, "測試多字節路徑", $content); +create_verify_dir($prefix, "tschüß3"); +create_verify_dir($prefix, "Voláçao3"); +create_verify_dir($prefix, "привет3"); +create_verify_dir($prefix, "テストマルチバイト・パス42"); +create_verify_dir($prefix, "測試多字節路徑5"); + + +$dirw = $prefix . DIRECTORY_SEPARATOR; + +$old_cp = get_active_cp(); +set_active_cp(65001); + +if (is_dir($dirw)) { + if ($dh = opendir($dirw)) { + while (($file = readdir($dh)) !== false) { + echo "filename: $file : filetype: " . filetype($dirw . $file) . "\n"; + } + closedir($dh); + } +} else { + echo "is_dir failed\n"; +} +set_active_cp($old_cp); + +remove_data("mb_names"); + +?> +===DONE=== +--EXPECTF-- +Active code page: 65001 +filename: . : filetype: dir +filename: .. : filetype: dir +filename: Röd_Statistics.txt : filetype: file +filename: tschüß : filetype: file +filename: tschüß3 : filetype: dir +filename: Voláçao : filetype: file +filename: Voláçao3 : filetype: dir +filename: českýtestování.inc : filetype: file +filename: š.txt : filetype: file +filename: Ελλάδα.txt : filetype: file +filename: привет : filetype: file +filename: привет3 : filetype: dir +filename: テストマルチバイト・パス : filetype: file +filename: テストマルチバイト・パス42 : filetype: dir +filename: 測試多字節路徑 : filetype: file +filename: 測試多字節路徑5 : filetype: dir +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt new file mode 100644 index 0000000000..da87fe9f8b --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test rename() with a dir for multibyte filenames + +--SKIPIF-- + +<?php + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +skip_if_not_win(); +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +skip_if_no_required_exts(); + + +?> + +--FILE-- + +<?php + + +include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc"; + + +$prefix = create_data("file2_mb"); + +$fw_orig = $prefix . DIRECTORY_SEPARATOR . "Ελλάδα.txt"; + + + +$fw_copied = $prefix . DIRECTORY_SEPARATOR . "Ελλάδα_copy.txt"; + + +$fw_renamed = $prefix . DIRECTORY_SEPARATOR . "測試多字節路徑17.txt"; + + + +$old_cp = get_active_cp(); + +set_active_cp(65001); + + + + + +var_dump(copy($fw_orig, $fw_copied)); +var_dump(get_basename_with_cp($fw_copied, get_active_cp(), false)); +var_dump(file_exists($fw_copied)); + +var_dump(rename($fw_copied, $fw_renamed)); +var_dump(get_basename_with_cp($fw_renamed, get_active_cp(), false)); +var_dump(file_exists($fw_renamed)); + +var_dump(unlink($fw_renamed)); + +set_active_cp($old_cp); + +remove_data("file2_mb"); + +?> +===DONE=== + +--EXPECTF-- +Active code page: 65001 +bool(true) +string(21) "Ελλάδα_copy.txt" +bool(true) +bool(true) +string(27) "測試多字節路徑17.txt" +bool(true) +bool(true) +Active code page: %d +===DONE=== diff --git a/ext/standard/tests/file/windows_mb_path/util.inc b/ext/standard/tests/file/windows_mb_path/util.inc new file mode 100644 index 0000000000..57fd8f9427 --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/util.inc @@ -0,0 +1,149 @@ +<?php + +function get_active_cp($kind = "") +{ + if (version_compare(PHP_VERSION, '7.1', '<')) { + $s = exec("chcp"); + preg_match(",.*: (\d+),", $s, $m); + + return $m[1]; + } else { + return sapi_windows_cp_get($kind); + } +} + +function set_active_cp($cp, $echo = true) +{ + if (version_compare(PHP_VERSION, '7.1', '<')) { + $ret = exec("chcp $cp"); + } else { + if (!sapi_windows_cp_set($cp)) { + echo "Failed to set cp $cp\n"; + return; + } + + if ($echo) echo "Active code page: ", get_active_cp(), "\n"; + } +} + +function get_basename_with_cp($path, $cp, $echo = true) +{ + $old_cp = get_active_cp(); + set_active_cp($cp, $echo); + + if ($echo) echo "getting basename of $path\n"; + + $cmd = "powershell -command \"Get-Item -Path '$path' | Format-Table -HideTableHeaders Name\""; + $out = trim(shell_exec($cmd)); + + if ($echo) var_dump($out, $out == basename($path)); + if ($echo) var_dump(realpath($path)); + + set_active_cp($old_cp, $echo); + + return $out; +} + +function skip_if_wrong_cp($cp, $kind = "") +{ + if (get_active_cp($kind) != $cp) { + die("skip this test expect codepage $cp"); + } +} + +function skip_if_no_required_exts() +{ + $exts = func_get_args(); + $exts[] = "iconv"; + + foreach ($exts as $ext) { + if (!extension_loaded($ext)) { + die("skip $ext is not loaded"); + } + } +} + +function skip_if_not_win() +{ + if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); + } +} + +function create_verify_file($prefix, $basename, $content = "", $cp = 65001) +{ + $full = $prefix . DIRECTORY_SEPARATOR . $basename; + + if (!touch($full)) { + echo "failed to touch create $full\n"; + return; + } + + $now = get_basename_with_cp($full, $cp, false); + if ($now !== $basename) { + echo "expected '$basename', got '$now'\n"; + return; + } + + if ($content) { + file_put_contents($full, $content); + } +} + +function create_verify_dir($prefix, $basename, $cp = 65001) +{ + $full = $prefix . DIRECTORY_SEPARATOR . $basename; + + if (!mkdir($full) || get_basename_with_cp($full, $cp, false) !== $basename) { + echo "failed to create dir '$full'\n"; + } +} + +function remove_data($id, $dir = NULL) +{ + if (!$dir) { + $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; + } + + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir") + remove_data($id, $dir . DIRECTORY_SEPARATOR . $object); + else + unlink($dir . DIRECTORY_SEPARATOR . $object); + } + } + reset($objects); + rmdir($dir); + } +} + +function create_data($id, $item = "", $cp = 65001, $utf8 = true) +{ + if ($utf8) { + /* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */ + include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc"; + return create_data_from_utf8($id, $item, $cp); + } else { + + $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; + + if (!is_dir($prefix)) { + mkdir($prefix); + } + + if (0 === strpos($id, "dir")) { + create_verify_dir($prefix, $item, $cp); + } else if (0 === strpos($id, "file")) { + /* a bit unhandy, but content can be put from outside, if needed */ + create_verify_file($prefix, $item, "dummy content", $cp); + } else { + echo "Item has either to start with \"dir\" or \"file\""; + } + } + + return $prefix; +} + diff --git a/ext/standard/tests/file/windows_mb_path/util_utf8.inc b/ext/standard/tests/file/windows_mb_path/util_utf8.inc new file mode 100644 index 0000000000..8d7009f91c --- /dev/null +++ b/ext/standard/tests/file/windows_mb_path/util_utf8.inc @@ -0,0 +1,95 @@ +<?php + +function create_data_from_utf8($id, $item = "", $cp = 65001) +{ + $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id; + + if (!is_dir($prefix)) { + mkdir($prefix); + } + + /* Using a UTF-8 encoded filenames if !zend.multibyte, otherwise files in retrospective charset. */ + switch ($id) { + + case "file_mb3": + $content = "<?php + +echo \"hello there from the include\n\";"; + create_verify_file($prefix, "českýtestování.inc", $content); + break; + + case "bug71509": + $content = "that's my file with swedish filename +"; + create_verify_file($prefix, $item, $content); + break; + + case "file_mb4": + create_verify_file($prefix, "š.txt", ""); + break; + + case "file_cp1252": + $content = "hallo +"; + create_verify_file($prefix, "tschüß", $content); + break; + + case "file2_cp1252": + create_verify_file($prefix, $item, "hola"); + break; + + case "file2_mb": + create_verify_file($prefix, "Ελλάδα.txt", ""); + break; + + case "file_cp1251": + create_verify_file($prefix, $item, "opened an utf8 filename for reading", $cp); + break; + + case "file_cp1255": + case "file_cp1254": + case "file_cp1253": + case "file_kartuli": + case "file_cp1250": + case "file_cp1256": + case "file_cp874": + case "file_big5": + case "file_cp936": + case "file_cp932": + case "file_eucjp": + case "file_mb": + $content = "reading file wihh multibyte filename +"; + create_verify_file($prefix, $item, $content, $cp); + break; + + case "dir_mb": + create_verify_dir($prefix, "テストマルチバイト・パス42"); + break; + + case "dir_cp1255": + case "dir_cp1254": + case "dir_cp1253": + case "dir_kartuli": + case "dir_cp1250": + case "dir_cp1256": + case "dir_cp874": + case "dir_cp932": + case "dir_cp936": + case "dir_eucjp": + case "dir2_cp1252": + case "dir_cp1252": + case "dir_cp1251": + case "dir_big5": + case "dir": + create_verify_dir($prefix, $item, $cp); + break; + + case "file": + create_verify_file($prefix, $item, "", $cp); + break; + } + + return $prefix; +} + diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic-win32-mb.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic-win32-mb.phpt new file mode 100644 index 0000000000..f85f4a4195 --- /dev/null +++ b/ext/standard/tests/general_functions/escapeshellarg_basic-win32-mb.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test escapeshellarg() function: basic test with UTF-8 strings +--SKIPIF-- +<?php +if( substr(PHP_OS, 0, 3) != "WIN" ) + die("skip.. only for Windows"); +?> +--FILE-- +<?php +/* Prototype : string escapeshellarg ( string $arg ) + * Description: Escape a string to be used as a shell argument. + * Source code: ext/standard/exec.c + * Alias to functions: + */ + +echo "Simple testcase for escapeshellarg() function\n"; + +var_dump(escapeshellarg("テストマルチバイ'ト・パス")); +var_dump(escapeshellarg("測試多字\'節路徑")); +var_dump(escapeshellarg("%füße")); +var_dump(escapeshellarg("!шницель")); + +echo "Done\n"; +?> +--EXPECT-- +Simple testcase for escapeshellarg() function +string(39) ""テストマルチバイ'ト・パス"" +string(25) ""測試多字\'節路徑"" +string(9) "" füße"" +string(17) "" шницель"" +Done diff --git a/ext/standard/tests/general_functions/proc_open-win32-mb0.phpt b/ext/standard/tests/general_functions/proc_open-win32-mb0.phpt new file mode 100644 index 0000000000..d3ead08e74 --- /dev/null +++ b/ext/standard/tests/general_functions/proc_open-win32-mb0.phpt @@ -0,0 +1,49 @@ +--TEST-- +proc_open with bypass_shell subprocess parameter passing +--SKIPIF-- +<?php # vim:syn=php +if (substr(PHP_OS, 0, 3) != 'WIN') die("skip Valid only on Windows"); +if (php_sapi_name() != "cli") die('skip CLI only test'); +if (!function_exists("proc_open")) echo "skip proc_open() is not available"; +?> +--FILE-- +<?php + +$php = PHP_BINARY; + +$f = dirname(__FILE__) . DIRECTORY_SEPARATOR . "proc_only_mb0.php"; +file_put_contents($f,'<?php var_dump($argv); ?>'); + +$ds = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); + +$p = proc_open( + "$php -n $f テストマルチバイト・パス füße карамба", + $ds, + $pipes, + NULL, + NULL, + array("bypass_shell" => true) + ); + +echo fread($pipes[1], 1024); + +proc_close($p); + +?> +==DONE== +--EXPECTF-- +array(4) { + [0]=> + string(%d) "%sproc_only_mb0.php" + [1]=> + string(36) "テストマルチバイト・パス" + [2]=> + string(6) "füße" + [3]=> + string(14) "карамба" +} +==DONE== diff --git a/ext/standard/tests/general_functions/proc_open-win32-mb1.phpt b/ext/standard/tests/general_functions/proc_open-win32-mb1.phpt new file mode 100644 index 0000000000..da17a92b89 --- /dev/null +++ b/ext/standard/tests/general_functions/proc_open-win32-mb1.phpt @@ -0,0 +1,46 @@ +--TEST-- +proc_open without bypass_shell subprocess parameter passing +--SKIPIF-- +<?php # vim:syn=php +if (substr(PHP_OS, 0, 3) != 'WIN') die("skip Valid only on Windows"); +if (php_sapi_name() != "cli") die('skip CLI only test'); +if (!function_exists("proc_open")) echo "skip proc_open() is not available"; +?> +--FILE-- +<?php + +$php = PHP_BINARY; + +$f = dirname(__FILE__) . DIRECTORY_SEPARATOR . "proc_only_mb1.php"; +file_put_contents($f,'<?php var_dump($argv); ?>'); + +$ds = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); + +$p = proc_open( + "$php -n $f テストマルチバイト・パス füße карамба", + $ds, + $pipes + ); + +echo fread($pipes[1], 1024); + +proc_close($p); + +?> +==DONE== +--EXPECTF-- +array(4) { + [0]=> + string(%d) "%sproc_only_mb1.php" + [1]=> + string(36) "テストマルチバイト・パス" + [2]=> + string(6) "füße" + [3]=> + string(14) "карамба" +} +==DONE== |