1--TEST--
2File type functions
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--SKIPIF--
6<?php
7if (substr(PHP_OS, 0, 3) != 'WIN') {
8    die('skip only for Windows');
9}
10?>
11--FILE--
12<?php
13chdir(__DIR__);
14
15$fname = 'test_私はガラスを食べられます.file';
16
17@unlink($fname);
18if (file_exists($fname)) {
19    echo "$fname exists\n";
20} else {
21    echo "$fname does not exist\n";
22}
23fclose (fopen($fname, 'w'));
24chmod ($fname, 0744);
25if (file_exists($fname)) {
26    echo "$fname exists\n";
27} else {
28    echo "$fname does not exist\n";
29}
30if (is_link($fname)) {
31    echo "$fname is a symlink\n";
32} else {
33    echo "$fname is not a symlink\n";
34}
35if (file_exists($fname)) {
36    echo "$fname exists\n";
37} else {
38    echo "$fname does not exist\n";
39}
40$s = stat ($fname);
41$ls = lstat ($fname);
42for ($i = 0; $i <= 12; $i++) {
43    if ($ls[$i] != $s[$i]) {
44        echo "$fname lstat and stat differ at element $i\n";
45    }
46}
47echo "$fname is " . filetype($fname) . "\n";
48printf ("$fname permissions are 0%o\n", 0777 & fileperms($fname));
49echo "$fname size is " . filesize($fname) . "\n";
50if (is_writeable($fname)) {
51    echo "$fname is writeable\n";
52} else {
53    echo "$fname is not writeable\n";
54}
55if (is_readable($fname)) {
56    echo "$fname is readable\n";
57} else {
58    echo "$fname is not readable\n";
59}
60if (is_file($fname)) {
61    echo "$fname is a regular file\n";
62} else {
63    echo "$fname is not a regular file\n";
64}
65if (is_dir('../file')) {
66    echo "../file is a directory\n";
67} else {
68    echo "../file is not a directory\n";
69}
70if (is_dir($fname)) {
71    echo "$fname is a directory\n";
72} else {
73    echo "$fname is not a directory\n";
74}
75unlink($fname);
76if (file_exists($fname)) {
77    echo "$fname exists (cached)\n";
78} else {
79    echo "$fname does not exist\n";
80}
81clearstatcache();
82if (file_exists($fname)) {
83    echo "$fname exists\n";
84} else {
85    echo "$fname does not exist\n";
86}
87?>
88--EXPECT--
89test_私はガラスを食べられます.file does not exist
90test_私はガラスを食べられます.file exists
91test_私はガラスを食べられます.file is not a symlink
92test_私はガラスを食べられます.file exists
93test_私はガラスを食べられます.file is file
94test_私はガラスを食べられます.file permissions are 0666
95test_私はガラスを食べられます.file size is 0
96test_私はガラスを食べられます.file is writeable
97test_私はガラスを食べられます.file is readable
98test_私はガラスを食べられます.file is a regular file
99../file is a directory
100test_私はガラスを食べられます.file is not a directory
101test_私はガラスを食べられます.file does not exist
102test_私はガラスを食べられます.file does not exist
103