From f689708192f839668354a0c9740e43469bbdbb57 Mon Sep 17 00:00:00 2001 From: Ant Phillips Date: Wed, 26 Nov 2008 10:10:19 +0000 Subject: File system tests: checked on PHP 5.3 (Windows, Linux and Linux 64 bit). --- ext/standard/tests/file/001-win32.phpt | 35 +- ext/standard/tests/file/005_variation2-win32.phpt | 125 +++ ext/standard/tests/file/005_variation2.phpt | 113 +++ ext/standard/tests/file/006_error.phpt | 11 +- ext/standard/tests/file/006_variation2.phpt | 63 +- ext/standard/tests/file/007_error.phpt | 8 +- ext/standard/tests/file/basename-win32.phpt | 341 +++++++ ext/standard/tests/file/basename.phpt | Bin 0 -> 8229 bytes ext/standard/tests/file/basename_error.phpt | 38 + ext/standard/tests/file/bug41655_1.phpt | 7 +- ext/standard/tests/file/chmod_variation3.phpt | 209 ++++ ext/standard/tests/file/chmod_variation4.phpt | 202 ++++ ext/standard/tests/file/copy_variation13.phpt | 2 +- ext/standard/tests/file/copy_variation18.phpt | 10 +- ext/standard/tests/file/dirname_basic-win32.phpt | 93 ++ ext/standard/tests/file/dirname_basic.phpt | 94 ++ ext/standard/tests/file/dirname_error.phpt | 40 + ext/standard/tests/file/dirname_variation1.phpt | 190 ++++ ext/standard/tests/file/disk.phpt | 4 +- ext/standard/tests/file/disk_free_space_basic.phpt | 37 +- ext/standard/tests/file/disk_free_space_error.phpt | 19 +- .../tests/file/disk_free_space_variation.phpt | 80 +- .../tests/file/disk_total_space_basic.phpt | 38 +- .../tests/file/disk_total_space_error.phpt | 11 +- .../tests/file/disk_total_space_variation.phpt | 47 +- ext/standard/tests/file/feof_basic.phpt | 101 ++ ext/standard/tests/file/fflush_error.phpt | 11 +- ext/standard/tests/file/fgets_error.phpt | 3 +- .../tests/file/fgets_socket_variation1.phpt | 56 ++ .../tests/file/fgets_socket_variation2.phpt | 63 ++ ext/standard/tests/file/fgets_variation2.phpt | 5 +- ext/standard/tests/file/file.inc | 6 +- ext/standard/tests/file/file_exists_error.phpt | 44 + .../tests/file/file_exists_variation1.phpt | 30 + .../tests/file/file_get_contents_basic.phpt | 47 + .../tests/file/file_get_contents_error.phpt | 64 ++ .../tests/file/file_get_contents_variation1.phpt | 51 + .../tests/file/file_get_contents_variation2.phpt | 52 + .../tests/file/file_get_contents_variation3.phpt | 218 ++++ .../tests/file/file_get_contents_variation4.phpt | 251 +++++ .../tests/file/file_get_contents_variation5.phpt | 222 +++++ .../tests/file/file_get_contents_variation6.phpt | 215 ++++ .../file/file_get_contents_variation7-win32.phpt | 115 +++ .../tests/file/file_get_contents_variation7.phpt | 104 ++ .../file/file_get_contents_variation8-win32.phpt | 79 ++ .../tests/file/file_get_contents_variation8.phpt | 79 ++ .../tests/file/file_get_contents_variation9.phpt | 56 ++ .../tests/file/file_put_contents_variation1.phpt | 43 + .../tests/file/file_put_contents_variation2.phpt | 167 ++++ .../tests/file/file_put_contents_variation3.phpt | 250 +++++ .../tests/file/file_put_contents_variation4.phpt | 54 + .../tests/file/file_put_contents_variation5.phpt | 59 ++ .../tests/file/file_put_contents_variation6.phpt | 55 + .../file/file_put_contents_variation7-win32.phpt | 130 +++ .../tests/file/file_put_contents_variation7.phpt | 119 +++ .../file/file_put_contents_variation8-win32.phpt | 82 ++ .../tests/file/file_put_contents_variation8.phpt | 81 ++ .../tests/file/file_put_contents_variation9.phpt | 70 ++ ext/standard/tests/file/file_variation8-win32.phpt | 142 +++ ext/standard/tests/file/file_variation8.phpt | 128 +++ ext/standard/tests/file/file_variation9.phpt | 89 ++ ext/standard/tests/file/filegroup_variation1.phpt | 47 + ext/standard/tests/file/filegroup_variation2.phpt | 71 ++ ext/standard/tests/file/filegroup_variation3.phpt | 81 ++ ext/standard/tests/file/fileinode_variation1.phpt | 48 + ext/standard/tests/file/fileinode_variation2.phpt | 72 ++ ext/standard/tests/file/fileinode_variation3.phpt | 82 ++ ext/standard/tests/file/fileowner_variation1.phpt | 48 + ext/standard/tests/file/fileowner_variation2.phpt | 72 ++ ext/standard/tests/file/fileowner_variation3.phpt | 82 ++ ext/standard/tests/file/fileperms_variation1.phpt | 47 + ext/standard/tests/file/fileperms_variation2.phpt | 71 ++ ext/standard/tests/file/fileperms_variation3.phpt | 81 ++ ext/standard/tests/file/filesize_variation1.phpt | 22 +- ext/standard/tests/file/filesize_variation5.phpt | 34 + ext/standard/tests/file/filetype_variation2.phpt | 36 + ext/standard/tests/file/flock_error.phpt | 2 +- ext/standard/tests/file/flock_variation.phpt | 360 +------ ext/standard/tests/file/flock_variation1.phpt | 62 ++ ext/standard/tests/file/fopen_include_path.inc | 92 ++ .../tests/file/fopen_variation10-win32.phpt | 148 +++ .../tests/file/fopen_variation11-win32.phpt | 147 +++ ext/standard/tests/file/fopen_variation12.phpt | 54 + ext/standard/tests/file/fopen_variation13.phpt | 56 ++ .../tests/file/fopen_variation14-win32.phpt | 189 ++++ ext/standard/tests/file/fopen_variation14.phpt | 134 +++ .../tests/file/fopen_variation15-win32.phpt | 193 ++++ ext/standard/tests/file/fopen_variation15.phpt | 138 +++ ext/standard/tests/file/fopen_variation16.phpt | 74 ++ ext/standard/tests/file/fopen_variation17.phpt | 74 ++ ext/standard/tests/file/fopen_variation19.phpt | 110 ++ ext/standard/tests/file/fopen_variation3.phpt | 218 ++++ ext/standard/tests/file/fopen_variation4.phpt | 251 +++++ ext/standard/tests/file/fopen_variation5.phpt | 172 ++++ ext/standard/tests/file/fopen_variation6.phpt | 44 + ext/standard/tests/file/fopen_variation7.phpt | 69 ++ ext/standard/tests/file/fopen_variation8.phpt | 171 ++++ ext/standard/tests/file/fopen_variation9.phpt | 68 ++ ext/standard/tests/file/fpassthru_error.phpt | 8 + ext/standard/tests/file/fpassthru_variation1.phpt | 228 +++++ ext/standard/tests/file/fread_error.phpt | 3 +- ext/standard/tests/file/fread_fwrite_basic.phpt | 72 ++ ext/standard/tests/file/fseek_dir_basic.phpt | 2 +- .../tests/file/fseek_ftell_rewind_error1.phpt | 3 +- .../tests/file/fseek_ftell_rewind_error2.phpt | 3 +- .../tests/file/fseek_ftell_rewind_error3.phpt | 3 +- ext/standard/tests/file/fseek_variation1.phpt | 198 ++++ ext/standard/tests/file/fseek_variation2.phpt | 163 +++ ext/standard/tests/file/fseek_variation3.phpt | 58 ++ ext/standard/tests/file/ftruncate_error.phpt | 17 +- ext/standard/tests/file/fwrite_error.phpt | 3 +- ext/standard/tests/file/fwrite_variation5.phpt | 173 ++++ ext/standard/tests/file/glob_basic.phpt | 17 +- ext/standard/tests/file/glob_error_002-win32.phpt | 27 + ext/standard/tests/file/glob_error_002.phpt | 27 + ext/standard/tests/file/is_dir_variation2.phpt | 4 +- ext/standard/tests/file/is_dir_variation3.phpt | 7 +- .../tests/file/is_executable_variation3.phpt | 13 + ext/standard/tests/file/is_file_variation3.phpt | 9 +- ext/standard/tests/file/is_file_variation4.phpt | 2 +- .../tests/file/is_readable_variation1.phpt | 12 +- .../tests/file/is_readable_variation3.phpt | 16 +- .../tests/file/is_uploaded_file_basic.phpt | 50 + .../tests/file/is_writable_variation1.phpt | 16 +- .../tests/file/is_writable_variation3.phpt | 16 +- ext/standard/tests/file/lstat_stat_variation2.phpt | 16 +- .../tests/file/lstat_stat_variation22.phpt | 49 + .../tests/file/mkdir_variation1-win32.phpt | 123 +++ ext/standard/tests/file/mkdir_variation1.phpt | 122 +++ ext/standard/tests/file/mkdir_variation2.phpt | 189 ++++ ext/standard/tests/file/mkdir_variation3.phpt | 208 ++++ ext/standard/tests/file/mkdir_variation4.phpt | 220 ++++ .../tests/file/mkdir_variation5-win32.phpt | 106 ++ ext/standard/tests/file/mkdir_variation5.phpt | 99 ++ .../tests/file/move_uploaded_file_basic.phpt | 78 ++ .../tests/file/parse_ini_file_variation1.phpt | 68 ++ .../tests/file/parse_ini_file_variation2.phpt | 111 +++ .../tests/file/parse_ini_file_variation3.phpt | 99 ++ .../tests/file/parse_ini_file_variation4.phpt | 211 ++++ .../tests/file/parse_ini_file_variation5.phpt | 254 +++++ .../file/parse_ini_file_variation6-win32.phpt | 143 +++ .../tests/file/parse_ini_file_variation6.phpt | 129 +++ ext/standard/tests/file/pathinfo_basic1-win32.phpt | 609 +++++++++++ ext/standard/tests/file/pathinfo_basic1.phpt | 609 +++++++++++ ext/standard/tests/file/pathinfo_basic2-win32.phpt | 270 +++++ ext/standard/tests/file/pathinfo_basic2.phpt | 272 +++++ ext/standard/tests/file/pathinfo_variation1.phpt | 190 ++++ ext/standard/tests/file/pathinfo_variation2.phpt | 197 ++++ ext/standard/tests/file/pathinfo_variation3.phpt | 80 ++ ext/standard/tests/file/pclose_variation1.phpt | 232 +++++ .../tests/file/popen_pclose_error-sunos.phpt | 10 +- .../tests/file/readfile_variation10-win32.phpt | 72 ++ ext/standard/tests/file/readfile_variation10.phpt | 72 ++ ext/standard/tests/file/readfile_variation4.phpt | 251 +++++ ext/standard/tests/file/readfile_variation5.phpt | 221 ++++ ext/standard/tests/file/readfile_variation6.phpt | 50 + ext/standard/tests/file/readfile_variation7.phpt | 50 + .../tests/file/readfile_variation8-win32.phpt | 109 ++ ext/standard/tests/file/readfile_variation9.phpt | 99 ++ .../tests/file/readlink_realpath_basic1.phpt | 13 +- .../tests/file/readlink_realpath_basic2.phpt | 8 +- ext/standard/tests/file/readlink_variation1.phpt | 78 ++ ext/standard/tests/file/realpath_variation2.phpt | 74 ++ ext/standard/tests/file/rename_variation10.phpt | 253 +++++ .../tests/file/rename_variation11-win32.phpt | 128 +++ ext/standard/tests/file/rename_variation12.phpt | 117 +++ .../tests/file/rename_variation13-win32.phpt | Bin 0 -> 3614 bytes ext/standard/tests/file/rename_variation13.phpt | 132 +++ .../tests/file/rmdir_variation1-win32.phpt | 127 +++ ext/standard/tests/file/rmdir_variation1.phpt | 127 +++ ext/standard/tests/file/rmdir_variation2.phpt | 244 +++++ .../tests/file/rmdir_variation3-win32.phpt | 108 ++ ext/standard/tests/file/rmdir_variation3.phpt | 96 ++ .../file/symlink_link_linkinfo_is_link_error2.phpt | 21 +- .../tests/file/tempnam_variation1-win32.phpt | 50 +- ext/standard/tests/file/tempnam_variation1.phpt | 47 +- .../tests/file/tempnam_variation2-win32.phpt | 98 +- ext/standard/tests/file/tempnam_variation2.phpt | 96 +- .../tests/file/tempnam_variation3-win32.phpt | 68 +- ext/standard/tests/file/tempnam_variation3.phpt | 68 +- ext/standard/tests/file/tempnam_variation4.phpt | 1052 ++++++++++---------- .../tests/file/tempnam_variation5-win32.phpt | 54 + ext/standard/tests/file/tempnam_variation5.phpt | 14 +- .../tests/file/tempnam_variation6-win32.phpt | 62 ++ ext/standard/tests/file/tempnam_variation6.phpt | 31 +- .../tests/file/tempnam_variation7-win32.phpt | 49 +- ext/standard/tests/file/tempnam_variation7.phpt | 51 +- .../tests/file/tempnam_variation8-win32.phpt | 147 +++ ext/standard/tests/file/touch.phpt | 11 +- ext/standard/tests/file/touch_basic-win32.phpt | 97 ++ ext/standard/tests/file/touch_basic.phpt | 96 ++ ext/standard/tests/file/touch_error.phpt | 22 + ext/standard/tests/file/touch_variation1.phpt | 39 + ext/standard/tests/file/touch_variation2.phpt | 24 + .../tests/file/touch_variation3-win32.phpt | 199 ++++ ext/standard/tests/file/touch_variation3.phpt | 199 ++++ .../tests/file/touch_variation4-win32.phpt | 199 ++++ ext/standard/tests/file/touch_variation4.phpt | 199 ++++ .../tests/file/touch_variation5-win32.phpt | 249 +++++ ext/standard/tests/file/touch_variation5.phpt | 230 +++++ .../tests/file/touch_variation6-win32.phpt | 263 +++++ ext/standard/tests/file/umask_variation3.phpt | 237 +++++ ext/standard/tests/file/unlink_variation10.phpt | 106 ++ ext/standard/tests/file/unlink_variation6.phpt | 41 + ext/standard/tests/file/unlink_variation7.phpt | 246 +++++ .../tests/file/unlink_variation8-win32.phpt | 112 +++ ext/standard/tests/file/unlink_variation8.phpt | 206 ++++ .../tests/file/unlink_variation9-win32.phpt | 120 +++ 208 files changed, 20666 insertions(+), 1288 deletions(-) create mode 100644 ext/standard/tests/file/005_variation2-win32.phpt create mode 100644 ext/standard/tests/file/005_variation2.phpt create mode 100644 ext/standard/tests/file/basename-win32.phpt create mode 100644 ext/standard/tests/file/basename.phpt create mode 100644 ext/standard/tests/file/basename_error.phpt create mode 100644 ext/standard/tests/file/chmod_variation3.phpt create mode 100644 ext/standard/tests/file/chmod_variation4.phpt create mode 100644 ext/standard/tests/file/dirname_basic-win32.phpt create mode 100644 ext/standard/tests/file/dirname_basic.phpt create mode 100644 ext/standard/tests/file/dirname_error.phpt create mode 100644 ext/standard/tests/file/dirname_variation1.phpt create mode 100644 ext/standard/tests/file/feof_basic.phpt create mode 100644 ext/standard/tests/file/fgets_socket_variation1.phpt create mode 100644 ext/standard/tests/file/fgets_socket_variation2.phpt create mode 100644 ext/standard/tests/file/file_exists_error.phpt create mode 100644 ext/standard/tests/file/file_exists_variation1.phpt create mode 100644 ext/standard/tests/file/file_get_contents_basic.phpt create mode 100644 ext/standard/tests/file/file_get_contents_error.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation1.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation2.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation3.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation4.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation5.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation6.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation7-win32.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation7.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation8-win32.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation8.phpt create mode 100644 ext/standard/tests/file/file_get_contents_variation9.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation1.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation2.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation3.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation4.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation5.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation6.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation7-win32.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation7.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation8-win32.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation8.phpt create mode 100644 ext/standard/tests/file/file_put_contents_variation9.phpt create mode 100644 ext/standard/tests/file/file_variation8-win32.phpt create mode 100644 ext/standard/tests/file/file_variation8.phpt create mode 100644 ext/standard/tests/file/file_variation9.phpt create mode 100644 ext/standard/tests/file/filegroup_variation1.phpt create mode 100644 ext/standard/tests/file/filegroup_variation2.phpt create mode 100644 ext/standard/tests/file/filegroup_variation3.phpt create mode 100644 ext/standard/tests/file/fileinode_variation1.phpt create mode 100644 ext/standard/tests/file/fileinode_variation2.phpt create mode 100644 ext/standard/tests/file/fileinode_variation3.phpt create mode 100644 ext/standard/tests/file/fileowner_variation1.phpt create mode 100644 ext/standard/tests/file/fileowner_variation2.phpt create mode 100644 ext/standard/tests/file/fileowner_variation3.phpt create mode 100644 ext/standard/tests/file/fileperms_variation1.phpt create mode 100644 ext/standard/tests/file/fileperms_variation2.phpt create mode 100644 ext/standard/tests/file/fileperms_variation3.phpt create mode 100644 ext/standard/tests/file/filesize_variation5.phpt create mode 100644 ext/standard/tests/file/filetype_variation2.phpt create mode 100644 ext/standard/tests/file/flock_variation1.phpt create mode 100644 ext/standard/tests/file/fopen_include_path.inc create mode 100644 ext/standard/tests/file/fopen_variation10-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation11-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation12.phpt create mode 100644 ext/standard/tests/file/fopen_variation13.phpt create mode 100644 ext/standard/tests/file/fopen_variation14-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation14.phpt create mode 100644 ext/standard/tests/file/fopen_variation15-win32.phpt create mode 100644 ext/standard/tests/file/fopen_variation15.phpt create mode 100644 ext/standard/tests/file/fopen_variation16.phpt create mode 100644 ext/standard/tests/file/fopen_variation17.phpt create mode 100644 ext/standard/tests/file/fopen_variation19.phpt create mode 100644 ext/standard/tests/file/fopen_variation3.phpt create mode 100644 ext/standard/tests/file/fopen_variation4.phpt create mode 100644 ext/standard/tests/file/fopen_variation5.phpt create mode 100644 ext/standard/tests/file/fopen_variation6.phpt create mode 100644 ext/standard/tests/file/fopen_variation7.phpt create mode 100644 ext/standard/tests/file/fopen_variation8.phpt create mode 100644 ext/standard/tests/file/fopen_variation9.phpt create mode 100644 ext/standard/tests/file/fpassthru_variation1.phpt create mode 100644 ext/standard/tests/file/fread_fwrite_basic.phpt create mode 100644 ext/standard/tests/file/fseek_variation1.phpt create mode 100644 ext/standard/tests/file/fseek_variation2.phpt create mode 100644 ext/standard/tests/file/fseek_variation3.phpt create mode 100644 ext/standard/tests/file/fwrite_variation5.phpt create mode 100644 ext/standard/tests/file/glob_error_002-win32.phpt create mode 100644 ext/standard/tests/file/glob_error_002.phpt create mode 100644 ext/standard/tests/file/is_uploaded_file_basic.phpt create mode 100644 ext/standard/tests/file/lstat_stat_variation22.phpt create mode 100644 ext/standard/tests/file/mkdir_variation1-win32.phpt create mode 100644 ext/standard/tests/file/mkdir_variation1.phpt create mode 100644 ext/standard/tests/file/mkdir_variation2.phpt create mode 100644 ext/standard/tests/file/mkdir_variation3.phpt create mode 100644 ext/standard/tests/file/mkdir_variation4.phpt create mode 100644 ext/standard/tests/file/mkdir_variation5-win32.phpt create mode 100644 ext/standard/tests/file/mkdir_variation5.phpt create mode 100644 ext/standard/tests/file/move_uploaded_file_basic.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation1.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation2.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation3.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation4.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation5.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation6-win32.phpt create mode 100644 ext/standard/tests/file/parse_ini_file_variation6.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic1-win32.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic1.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic2-win32.phpt create mode 100644 ext/standard/tests/file/pathinfo_basic2.phpt create mode 100644 ext/standard/tests/file/pathinfo_variation1.phpt create mode 100644 ext/standard/tests/file/pathinfo_variation2.phpt create mode 100644 ext/standard/tests/file/pathinfo_variation3.phpt create mode 100644 ext/standard/tests/file/pclose_variation1.phpt create mode 100644 ext/standard/tests/file/readfile_variation10-win32.phpt create mode 100644 ext/standard/tests/file/readfile_variation10.phpt create mode 100644 ext/standard/tests/file/readfile_variation4.phpt create mode 100644 ext/standard/tests/file/readfile_variation5.phpt create mode 100644 ext/standard/tests/file/readfile_variation6.phpt create mode 100644 ext/standard/tests/file/readfile_variation7.phpt create mode 100644 ext/standard/tests/file/readfile_variation8-win32.phpt create mode 100644 ext/standard/tests/file/readfile_variation9.phpt create mode 100644 ext/standard/tests/file/readlink_variation1.phpt create mode 100644 ext/standard/tests/file/realpath_variation2.phpt create mode 100644 ext/standard/tests/file/rename_variation10.phpt create mode 100644 ext/standard/tests/file/rename_variation11-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation12.phpt create mode 100644 ext/standard/tests/file/rename_variation13-win32.phpt create mode 100644 ext/standard/tests/file/rename_variation13.phpt create mode 100644 ext/standard/tests/file/rmdir_variation1-win32.phpt create mode 100644 ext/standard/tests/file/rmdir_variation1.phpt create mode 100644 ext/standard/tests/file/rmdir_variation2.phpt create mode 100644 ext/standard/tests/file/rmdir_variation3-win32.phpt create mode 100644 ext/standard/tests/file/rmdir_variation3.phpt create mode 100644 ext/standard/tests/file/tempnam_variation5-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation6-win32.phpt create mode 100644 ext/standard/tests/file/tempnam_variation8-win32.phpt create mode 100644 ext/standard/tests/file/touch_basic-win32.phpt create mode 100644 ext/standard/tests/file/touch_basic.phpt create mode 100644 ext/standard/tests/file/touch_error.phpt create mode 100644 ext/standard/tests/file/touch_variation1.phpt create mode 100644 ext/standard/tests/file/touch_variation2.phpt create mode 100644 ext/standard/tests/file/touch_variation3-win32.phpt create mode 100644 ext/standard/tests/file/touch_variation3.phpt create mode 100644 ext/standard/tests/file/touch_variation4-win32.phpt create mode 100644 ext/standard/tests/file/touch_variation4.phpt create mode 100644 ext/standard/tests/file/touch_variation5-win32.phpt create mode 100644 ext/standard/tests/file/touch_variation5.phpt create mode 100644 ext/standard/tests/file/touch_variation6-win32.phpt create mode 100644 ext/standard/tests/file/umask_variation3.phpt create mode 100644 ext/standard/tests/file/unlink_variation10.phpt create mode 100644 ext/standard/tests/file/unlink_variation6.phpt create mode 100644 ext/standard/tests/file/unlink_variation7.phpt create mode 100644 ext/standard/tests/file/unlink_variation8-win32.phpt create mode 100644 ext/standard/tests/file/unlink_variation8.phpt create mode 100644 ext/standard/tests/file/unlink_variation9-win32.phpt diff --git a/ext/standard/tests/file/001-win32.phpt b/ext/standard/tests/file/001-win32.phpt index d6709e8d04..ee520940e4 100644 --- a/ext/standard/tests/file/001-win32.phpt +++ b/ext/standard/tests/file/001-win32.phpt @@ -1,5 +1,7 @@ --TEST-- File type functions +--CREDITS-- +Dave Kelsey --SKIPIF-- \n"; printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file')); echo "test.file size is " . filesize('test.file') . "\n"; if (is_writeable('test.file')) { @@ -70,16 +59,6 @@ if (is_file('test.file')) { } else { echo "test.file is not a regular file\n"; } -if (is_file('test.link')) { - echo "test.link is a regular file\n"; -} else { - echo "test.link is not a regular file\n"; -} -if (is_dir('test.link')) { - echo "test.link is a directory\n"; -} else { - echo "test.link is not a directory\n"; -} if (is_dir('../file')) { echo "../file is a directory\n"; } else { @@ -103,25 +82,19 @@ if (file_exists('test.file')) { echo "test.file does not exist\n"; } ?> ---EXPECTF-- +--EXPECT-- test.file does not exist test.file exists -test.link does not exist test.file is not a symlink -test.link is not a symlink test.file exists test.file is file - -Warning: filetype(): Lstat failed for test.link in %s -test.link is <> test.file permissions are 0666 test.file size is 0 test.file is writeable test.file is readable test.file is a regular file -test.link is not a regular file -test.link is not a directory ../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/005_variation2-win32.phpt b/ext/standard/tests/file/005_variation2-win32.phpt new file mode 100644 index 0000000000..caed7e62fa --- /dev/null +++ b/ext/standard/tests/file/005_variation2-win32.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : usage variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + echo fileatime($filename)."\n"; + clearstatcache(); + echo "-- File modification time is => "; + echo filemtime($filename)."\n"; + clearstatcache(); + echo "-- inode change time is => "; + echo filectime($filename)."\n"; + clearstatcache(); + + +} + +echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; +echo "\n*** testing file info ***"; +stat_fn(NULL); +stat_fn(false); +stat_fn(''); +stat_fn(' '); +stat_fn('|'); +echo "\n*** testing touch ***"; +var_dump(touch(NULL)); +var_dump(touch(false)); +var_dump(touch('')); + +//php generates permission denied, we generate No such file or dir. +var_dump(touch(' ')); +var_dump(touch('|')); + + +echo "Done"; +?> +--EXPECTF-- +*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** + +*** testing file info *** +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File ' ' -- +-- File access time is => +Warning: fileatime(): stat failed for in %s on line %d + +-- File modification time is => +Warning: filemtime(): stat failed for in %s on line %d + +-- inode change time is => +Warning: filectime(): stat failed for in %s on line %d + + +-- File '|' -- +-- File access time is => +Warning: fileatime(): stat failed for | in %s on line %d + +-- File modification time is => +Warning: filemtime(): stat failed for | in %s on line %d + +-- inode change time is => +Warning: filectime(): stat failed for | in %s on line %d + + +*** testing touch *** +Warning: touch(): Unable to create file because No such file or directory in %s on line %d +bool(false) + +Warning: touch(): Unable to create file because No such file or directory in %s on line %d +bool(false) + +Warning: touch(): Unable to create file because No such file or directory in %s on line %d +bool(false) + +Warning: touch(): Unable to create file because %s in %s on line %d +bool(false) + +Warning: touch(): Unable to create file | because %s in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/file/005_variation2.phpt b/ext/standard/tests/file/005_variation2.phpt new file mode 100644 index 0000000000..4d9942402b --- /dev/null +++ b/ext/standard/tests/file/005_variation2.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test fileatime(), filemtime(), filectime() & touch() functions : usage variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + echo fileatime($filename)."\n"; + clearstatcache(); + echo "-- File modification time is => "; + echo filemtime($filename)."\n"; + clearstatcache(); + echo "-- inode change time is => "; + echo filectime($filename)."\n"; + clearstatcache(); + + +} + +echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; +echo "\n*** testing touch ***\n"; +var_dump(touch(NULL)); +var_dump(touch(false)); +var_dump(touch('')); +var_dump(touch(' ')); +var_dump(touch('|')); + +echo "\n*** testing file info ***"; +stat_fn(NULL); +stat_fn(false); +stat_fn(''); +stat_fn(' '); +stat_fn('|'); + +var_dump(unlink(' ')); +var_dump(unlink('|')); + +echo "Done"; +?> +--EXPECTF-- +*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** + +*** testing touch *** + +Warning: touch(): Unable to create file because No such file or directory in %s on line %d +bool(false) + +Warning: touch(): Unable to create file because No such file or directory in %s on line %d +bool(false) + +Warning: touch(): Unable to create file because No such file or directory in %s on line %d +bool(false) +bool(true) +bool(true) + +*** testing file info *** +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File '' -- +-- File access time is => +-- File modification time is => +-- inode change time is => + +-- File ' ' -- +-- File access time is => %d +-- File modification time is => %d +-- inode change time is => %d + +-- File '|' -- +-- File access time is => %d +-- File modification time is => %d +-- inode change time is => %d +bool(true) +bool(true) +Done diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt index 04cc274ecc..bef7a89f44 100644 --- a/ext/standard/tests/file/006_error.phpt +++ b/ext/standard/tests/file/006_error.phpt @@ -11,7 +11,7 @@ $fp = fopen($filename, 'w'); fclose($fp); if(fileowner($filename) == 0) { unlink ($filename); - die('skip cannot be run as root'); + die('skip...cannot be run as root\n'); } unlink($filename); @@ -68,13 +68,13 @@ unlink( dirname(__FILE__)."/006_error.tmp"); --EXPECTF-- *** Testing error conditions for fileperms(), chmod() *** -Warning: chmod(): %s in %s on line %d +Warning: chmod(): Operation not permitted in %s on line %d bool(false) -100%d44 +%d -Warning: chmod(): %s in %s on line %d +Warning: chmod(): Operation not permitted in %s on line %d bool(false) -40755 +%d Warning: chmod(): No such file or directory in %s on line %d bool(false) @@ -105,3 +105,4 @@ Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d NULL *** Done *** + diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index d56207a349..9c9707664e 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -11,7 +11,7 @@ $fp = fopen($filename, 'w'); fclose($fp); if(fileowner($filename) == 0) { unlink ($filename); - die('skip cannot be run as root'); + die('skip...cannot be run as root\n'); } unlink($filename); @@ -94,93 +94,94 @@ rmdir(dirname(__FILE__)."/006_variation2"); *** Testing fileperms(), chmod() with miscellaneous permissions *** -- Iteration 1 -- bool(true) -107777 +%d bool(true) -47777 +%d -- Iteration 2 -- bool(true) -100000 +%d bool(true) -40000 +%d -- Iteration 3 -- bool(true) -101000 +%d bool(true) -41000 +%d -- Iteration 4 -- bool(true) -101111 +%d bool(true) -41111 +%d -- Iteration 5 -- bool(true) -107001 +%d bool(true) -47001 +%d -- Iteration 6 -- bool(true) -100001 +%d bool(true) -40001 +%d -- Iteration 7 -- bool(true) -101411 +%d bool(true) -41411 +%d -- Iteration 8 -- bool(true) -107141 +%d bool(true) -47141 +%d -- Iteration 9 -- bool(true) -100637 +%d bool(true) -40637 +%d -- Iteration 10 -- bool(true) -103567 +%d bool(true) -43567 +%d -- Iteration 11 -- bool(true) -103567 +%d bool(true) -43567 +%d -- Iteration 12 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -103567 +%d Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -43567 +%d -- Iteration 13 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -103567 +%d Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -43567 +%d -- Iteration 14 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -103567 +%d Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -43567 +%d -- Iteration 15 -- Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -103567 +%d Warning: chmod() expects parameter 2 to be long, string given in %s on line %d NULL -43567 +%d *** Done *** + diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt index cc986ebdae..ecec336f84 100644 --- a/ext/standard/tests/file/007_error.phpt +++ b/ext/standard/tests/file/007_error.phpt @@ -1,5 +1,7 @@ --TEST-- Test fopen, fclose() & feof() functions: error conditions +--CREDITS-- +Dave Kelsey --FILE-- +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing basic operations *** + +--Iteration 1-- +string(3) "bar" + +--Iteration 2-- +string(3) "bar" + +--Iteration 3-- +string(3) "bar" + +--Iteration 4-- +string(3) "bar" + +--Iteration 5-- +string(3) "bar" + +--Iteration 6-- +string(3) "bar" + +--Iteration 7-- +string(3) "bar" + +--Iteration 8-- +string(3) "bar" + +--Iteration 9-- +string(3) "bar" + +--Iteration 10-- +string(3) "bar" + +--Iteration 11-- +string(7) "bar.zip" + +--Iteration 12-- +string(3) "bar" + +--Iteration 13-- +string(3) "bar" + +--Iteration 14-- +string(3) "bar" + +--Iteration 15-- +string(3) "bar" + +--Iteration 16-- +string(3) "bar" + +--Iteration 17-- +string(3) "bar" + +--Iteration 18-- +string(3) "bar" + +--Iteration 19-- +string(3) "bar" + +--Iteration 20-- +string(4) ".zip" + +--Iteration 21-- +string(4) ".zip" + +--Iteration 22-- +string(4) ".zip" + +--Iteration 23-- +string(4) ".zip" + +--Iteration 24-- +string(4) ".zip" + +--Iteration 25-- +string(4) ".zip" + +*** Testing possible variations in path and suffix *** + +--Iteration 1-- +string(3) "bar" + +--Iteration 2-- +string(3) "bar" + +--Iteration 3-- +string(3) "bar" + +--Iteration 4-- +string(3) "bar" + +--Iteration 5-- +string(3) "bar" + +--Iteration 6-- +string(7) "bar.tar" + +--Iteration 7-- +string(7) "bar.tar" + +--Iteration 8-- +string(7) "bar.tar" + +--Iteration 9-- +string(7) "bar.tar" + +--Iteration 10-- +string(7) "bar.tar" + +--Iteration 11-- +string(7) "bar.tar" + +--Iteration 12-- +string(4) "10.5" + +--Iteration 13-- +string(2) "10" + +--Iteration 14-- +string(4) "10.5" + +--Iteration 15-- +string(2) "10" + +--Iteration 16-- +string(2) "10" + +--Iteration 17-- +string(4) "10.5" + +--Iteration 18-- +string(4) "10.5" + +--Iteration 19-- +string(6) "10.zip" + +--Iteration 20-- +string(1) "0" + +--Iteration 21-- +string(1) "0" + +--Iteration 22-- +string(7) "bar.zip" + +--Iteration 23-- +string(7) "bar.zip" + +--Iteration 24-- +string(7) "bar.zip" + +--Iteration 25-- +string(1) " " + +--Iteration 26-- +string(1) " " + +--Iteration 27-- +string(0) "" + +--Iteration 28-- +string(1) " " + +--Iteration 29-- +string(1) " " + +--Iteration 30-- +string(0) "" + +--Iteration 31-- +string(0) "" + +--Iteration 32-- +string(0) "" + +*** Testing error conditions *** + +Warning: basename() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: basename() expects at most 2 parameters, 3 given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: basename() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: basename() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: basename() expects parameter 2 to be string, object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt new file mode 100644 index 0000000000..c0e7498f14 Binary files /dev/null and b/ext/standard/tests/file/basename.phpt differ diff --git a/ext/standard/tests/file/basename_error.phpt b/ext/standard/tests/file/basename_error.phpt new file mode 100644 index 0000000000..53c53cf8b9 --- /dev/null +++ b/ext/standard/tests/file/basename_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test basename() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing basename() : error conditions *** + +-- Testing basename() function with Zero arguments -- + +Warning: basename() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing basename() function with more than expected no. of arguments -- + +Warning: basename() expects at most 2 parameters, 3 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/file/bug41655_1.phpt b/ext/standard/tests/file/bug41655_1.phpt index d02de7066a..62d64dfb1e 100644 --- a/ext/standard/tests/file/bug41655_1.phpt +++ b/ext/standard/tests/file/bug41655_1.phpt @@ -1,12 +1,15 @@ --TEST-- Bug #41655 (open_basedir bypass via glob()) 1/2 +--CREDITS-- +Dave Kelsey --INI-- open_basedir=/tmp --FILE-- --EXPECT-- +bool(false) Done \ No newline at end of file diff --git a/ext/standard/tests/file/chmod_variation3.phpt b/ext/standard/tests/file/chmod_variation3.phpt new file mode 100644 index 0000000000..c2dd607fe2 --- /dev/null +++ b/ext/standard/tests/file/chmod_variation3.phpt @@ -0,0 +1,209 @@ +--TEST-- +Test chmod() function : first parameter variation +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // 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 filename + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( chmod($value, $mode) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing chmod() : usage variation *** + +--int 0-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--int 1-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--float .5-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--empty array-- +Error: 2 - chmod() expects parameter 1 to be string, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - chmod() expects parameter 1 to be string, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - chmod() expects parameter 1 to be string, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - chmod() expects parameter 1 to be string, array given, %s(%d) +NULL + +--uppercase NULL-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - chmod() expects parameter 1 to be string, object given, %s(%d) +NULL + +--undefined var-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) + +--unset var-- +Error: 2 - chmod(): No such file or directory, %s(%d) +bool(false) +===DONE=== + diff --git a/ext/standard/tests/file/chmod_variation4.phpt b/ext/standard/tests/file/chmod_variation4.phpt new file mode 100644 index 0000000000..4ff85f0026 --- /dev/null +++ b/ext/standard/tests/file/chmod_variation4.phpt @@ -0,0 +1,202 @@ +--TEST-- +Test chmod() function : second parameter variation +--XFAIL-- +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for mode + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( chmod($filename, $value) ); +}; + +chmod($filename, 0777); +unlink($filename); + +?> +===DONE=== +--EXPECTF-- +*** Testing chmod() : usage variation *** + +--float 10.5-- +bool(true) + +--float -10.5-- +bool(true) + +--float 12.3456789000e10-- +bool(true) + +--float -12.3456789000e10-- +bool(true) + +--float .5-- +bool(true) + +--empty array-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - chmod() expects parameter 2 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - chmod() expects parameter 2 to be long, 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 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - chmod() expects parameter 2 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - chmod() expects parameter 2 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - chmod() expects parameter 2 to be long, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/copy_variation13.phpt b/ext/standard/tests/file/copy_variation13.phpt index a71c597e41..779f82b6f6 100644 --- a/ext/standard/tests/file/copy_variation13.phpt +++ b/ext/standard/tests/file/copy_variation13.phpt @@ -1,5 +1,5 @@ --TEST-- -Test copy() function: usage variations - src as dir and dest as an existing file (Bug #42243) +Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243) --FILE-- "; -var_dump( compare_stats($stat_before_copy, $stat_after_copy, $all_stat_keys) ); +var_dump( compare_stats($stat_before_copy, $stat_after_copy, $stat_keys_to_compare) ); echo "*** Done ***\n"; ?> @@ -43,6 +48,7 @@ echo "*** Done ***\n"; unlink(dirname(__FILE__)."/copy_copy_variation18.tmp"); unlink(dirname(__FILE__)."/copy_variation18.tmp"); ?> + --EXPECTF-- *** Test copy() function: stat of file before and after copy *** Copy operation => bool(true) diff --git a/ext/standard/tests/file/dirname_basic-win32.phpt b/ext/standard/tests/file/dirname_basic-win32.phpt new file mode 100644 index 0000000000..61a6e33f5a --- /dev/null +++ b/ext/standard/tests/file/dirname_basic-win32.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test dirname() function : basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing dirname() : basic functionality *** +string(0) "" +string(1) "." +string(2) "c:" +string(3) "c:\" +string(3) "c:\" +string(1) "." +string(7) "c:\test" +string(7) "c:\test" +string(8) "c://test" +string(7) "c:\test" +string(15) "/usr/lib/locale" +string(17) "//usr/lib//locale" +string(1) "\" +string(1) "\" +string(1) "\" +string(1) "\" +string(1) "\" +string(15) "/usr/lib/locale" +string(31) "c:\windows/system32\drivers/etc" +string(15) "/usr\lib/locale" +string(15) " c:\test\adir" +string(12) "c:\test\adir" +string(15) " c:\test\adir" +string(18) " /usr/lib/locale" +string(15) "/usr/lib/locale" +string(18) " /usr/lib/locale" +string(1) "." +string(14) " c:\test\adir" +string(1) "\" +string(1) "\" +===DONE=== diff --git a/ext/standard/tests/file/dirname_basic.phpt b/ext/standard/tests/file/dirname_basic.phpt new file mode 100644 index 0000000000..8f1944e2c7 --- /dev/null +++ b/ext/standard/tests/file/dirname_basic.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test dirname() function : basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing dirname() : basic functionality *** +string(0) "" +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(1) "." +string(8) "c://test" +string(1) "." +string(15) "/usr/lib/locale" +string(17) "//usr/lib//locale" +string(1) "." +string(1) "." +string(1) "/" +string(1) "/" +string(1) "/" +string(15) "/usr/lib/locale" +string(27) "c:\windows/system32\drivers" +string(8) "/usr\lib" +string(1) "." +string(1) "." +string(1) "." +string(18) " /usr/lib/locale" +string(15) "/usr/lib/locale" +string(18) " /usr/lib/locale" +string(1) "." +string(1) "." +string(1) "/" +string(1) "/" +===DONE=== + diff --git a/ext/standard/tests/file/dirname_error.phpt b/ext/standard/tests/file/dirname_error.phpt new file mode 100644 index 0000000000..dc7814f7f7 --- /dev/null +++ b/ext/standard/tests/file/dirname_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test dirname() function : error conditions +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing dirname() : error conditions *** + +-- Testing dirname() function with Zero arguments -- + +Warning: dirname() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing dirname() function with more than expected no. of arguments -- + +Warning: dirname() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== + diff --git a/ext/standard/tests/file/dirname_variation1.phpt b/ext/standard/tests/file/dirname_variation1.phpt new file mode 100644 index 0000000000..15041ffd53 --- /dev/null +++ b/ext/standard/tests/file/dirname_variation1.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test dirname() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // 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 path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( dirname($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing dirname() : usage variation *** + +--int 0-- +string(1) "." + +--int 1-- +string(1) "." + +--int 12345-- +string(1) "." + +--int -12345-- +string(1) "." + +--float 10.5-- +string(1) "." + +--float -10.5-- +string(1) "." + +--float 12.3456789000e10-- +string(1) "." + +--float -12.3456789000e10-- +string(1) "." + +--float .5-- +string(1) "." + +--empty array-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - dirname() expects parameter 1 to be string, array given, %s(%d) +NULL + +--uppercase NULL-- +string(0) "" + +--lowercase null-- +string(0) "" + +--lowercase true-- +string(1) "." + +--lowercase false-- +string(0) "" + +--uppercase TRUE-- +string(1) "." + +--uppercase FALSE-- +string(0) "" + +--empty string DQ-- +string(0) "" + +--empty string SQ-- +string(0) "" + +--instance of classWithToString-- +string(1) "." + +--instance of classWithoutToString-- +Error: 2 - dirname() expects parameter 1 to be string, object given, %s(%d) +NULL + +--undefined var-- +string(0) "" + +--unset var-- +string(0) "" +===DONE=== + diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt index 6eef4b4a77..e1a74fc984 100644 --- a/ext/standard/tests/file/disk.phpt +++ b/ext/standard/tests/file/disk.phpt @@ -37,8 +37,8 @@ bool(false) Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) -float(%d) -float(%d) +float(%f) +float(%f) Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_basic.phpt b/ext/standard/tests/file/disk_free_space_basic.phpt index f8684e92a9..cae37bad59 100644 --- a/ext/standard/tests/file/disk_free_space_basic.phpt +++ b/ext/standard/tests/file/disk_free_space_basic.phpt @@ -7,27 +7,26 @@ memory_limit=32M /* * Prototype: float disk_free_space( string directory ) * Description: Given a string containing a directory, this function - * will return the number of bytes available on the corresponding - * filesystem or disk partition + * will return the number of bytes available on the corresponding + * filesystem or disk partition */ $file_path = dirname(__FILE__); +include($file_path."/file.inc"); echo "*** Testing with existing directory ***\n"; var_dump( disk_free_space($file_path) ); var_dump( diskfreespace($file_path) ); +$dir = "/disk_free_space"; echo "*** Testing with newly created directory ***\n"; -$dir = "/disk_free_space"; mkdir($file_path.$dir); echo" \n Free Space before writing to a file\n"; $space1 = disk_free_space($file_path.$dir); -var_dump( $space1 ); +var_dump($space1); -$fh = fopen($file_path.$dir."/disk_free_space.tmp", "a"); -for( $i=1; $i<=1000; $i++) -fwrite($fh, (binary)"x"); -fclose($fh); +fill_buffer($buffer, "text", 3000000); +file_put_contents($file_path.$dir."/disk_free_space.tmp", $buffer); echo "\n Free Space after writing to a file\n"; $space2 = disk_free_space($file_path.$dir); @@ -38,33 +37,29 @@ if( $space1 > $space2 ) else echo "\n Free Space Value Is Incorrect\n"; -echo "*** Testing with Binary Input ***\n"; -var_dump( disk_free_space(b"$file_path") ); - -echo"\n--- Done ---"; +echo"\n-- Done --"; ?> --CLEAN-- --EXPECTF-- *** Testing with existing directory *** -float(%d) -float(%d) +float(%f) +float(%f) *** Testing with newly created directory *** Free Space before writing to a file -float(%d) +float(%f) Free Space after writing to a file -float(%d) +float(%f) Free Space Value Is Correct -*** Testing with Binary Input *** -float(%d) ---- Done --- +-- Done -- diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt index ddd25a35db..945b7b9c84 100644 --- a/ext/standard/tests/file/disk_free_space_error.phpt +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -1,15 +1,15 @@ --TEST-- -Test disk_free_space and its alias diskfreespace() functions : error conditions. +Test disk_free_space and its alias diskfreespace() functions : error conditions --SKIPIF-- --FILE-- - --EXPECTF-- -*** Testing with a directory *** -float(%d) -float(%d) +*** Testing disk_free_space() function with a directory *** +float(%f) +float(%f) -Testing for the return type *** +*** Testing for the return type *** bool(true) -*** Testing with different directory combinations *** +*** Testing disk_free_space() function with different styles of file and directory *** -- Iteration 1 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 2 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 3 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 4 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 5 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 6 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 7 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 8 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 9 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 10 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 11 -- -float(%d) -float(%d) +float(%f) +float(%f) -- Iteration 12 -- -float(%d) -float(%d) +float(%f) +float(%f) --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_basic.phpt b/ext/standard/tests/file/disk_total_space_basic.phpt index d211f39437..8f3a2f21c3 100644 --- a/ext/standard/tests/file/disk_total_space_basic.phpt +++ b/ext/standard/tests/file/disk_total_space_basic.phpt @@ -4,31 +4,31 @@ Test disk_total_space() function : basic functionality + --CLEAN-- --EXPECTF-- -*** Testing with normal directory *** -float(%d) +*** Testing with existing directory *** +float(%f) *** Testing with newly created directory *** -float(%d) - -Total Space after writing to a file -float(%d) +float(%f) + + Total Space after writing to a file +float(%f) --- Done -- +--- Done --- diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt index d986f779ba..196028007e 100644 --- a/ext/standard/tests/file/disk_total_space_error.phpt +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -2,14 +2,14 @@ Test disk_total_space() function : error conditions --SKIPIF-- --FILE-- --CLEAN-- - - --EXPECTF-- *** Testing with a directory *** -float(%d) +float(%f) Testing for the return type *** bool(true) -*** Testing with different directory combinations *** +*** Testing disk_total_space() function with different directory combinations *** -- Iteration 1 -- -float(%d) +float(%f) -- Iteration 2 -- -float(%d) +float(%f) -- Iteration 3 -- -float(%d) +float(%f) -- Iteration 4 -- -float(%d) +float(%f) -- Iteration 5 -- -float(%d) +float(%f) -- Iteration 6 -- -float(%d) +float(%f) -- Iteration 7 -- -float(%d) +float(%f) -- Iteration 8 -- -float(%d) +float(%f) -- Iteration 9 -- -float(%d) +float(%f) -- Iteration 10 -- -float(%d) +float(%f) -- Iteration 11 -- -float(%d) +float(%f) -- Iteration 12 -- -float(%d) -*** Testing with Binary Input *** -float(%d) +float(%f) --- Done --- diff --git a/ext/standard/tests/file/feof_basic.phpt b/ext/standard/tests/file/feof_basic.phpt new file mode 100644 index 0000000000..ff1d179f6f --- /dev/null +++ b/ext/standard/tests/file/feof_basic.phpt @@ -0,0 +1,101 @@ +--TEST-- +Test feof() function : basic functionality +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing feof() : basic functionality *** + +*** testing reading complete file using feof to stop *** +some data 10 +bool(false) +*** writing 10 lines, testing feof *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** testing feof on unclosed file after a read *** +bool(true) +*** testing feof after a seek to near the beginning *** +bool(false) +*** testing feof after a seek to end *** +bool(false) +*** testing feof after a seek passed the end *** +bool(false) +*** closing file, testing eof *** + +Warning: feof(): %d is not a valid stream resource in %s on line %d +Done diff --git a/ext/standard/tests/file/fflush_error.phpt b/ext/standard/tests/file/fflush_error.phpt index 6d7f731763..9f745e5202 100644 --- a/ext/standard/tests/file/fflush_error.phpt +++ b/ext/standard/tests/file/fflush_error.phpt @@ -24,9 +24,10 @@ if($file_handle == false) var_dump( fflush($file_handle, $file_handle) ); fclose($file_handle); +fflush($file_handle); // test invalid arguments : non-resources -echo "-- Testing fflush(): with invalid arguments --\n"; +echo "\n-- Testing fflush(): with invalid arguments --\n"; $invalid_args = array ( "string", 10, @@ -41,7 +42,7 @@ for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { echo "-- Iteration $loop_counter --\n"; var_dump( fflush($invalid_args[$loop_counter - 1]) ); } -echo "\n*** Done ***"; +echo "Done\n"; ?> --CLEAN-- @@ -60,6 +61,9 @@ bool(false) Warning: fflush() expects exactly 1 parameter, 2 given in %s on line %d bool(false) + +Warning: fflush(): %d is not a valid stream resource in %s on line %d + -- Testing fflush(): with invalid arguments -- -- Iteration 1 -- @@ -85,6 +89,5 @@ bool(false) Warning: fflush() expects parameter 1 to be resource, object given in %s on line %d bool(false) - -*** Done *** +Done diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt index a55c53f9bf..51ae3c6a37 100644 --- a/ext/standard/tests/file/fgets_error.phpt +++ b/ext/standard/tests/file/fgets_error.phpt @@ -99,9 +99,10 @@ bool(false) Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing fgets() with closed/unset file handle -- -Warning: fgets(): 5 is not a valid stream resource in %s on line %d +Warning: fgets(): %d is not a valid stream resource in %s on line %d bool(false) Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/fgets_socket_variation1.phpt b/ext/standard/tests/file/fgets_socket_variation1.phpt new file mode 100644 index 0000000000..57944d8b56 --- /dev/null +++ b/ext/standard/tests/file/fgets_socket_variation1.phpt @@ -0,0 +1,56 @@ +--TEST-- +fgets() with a socket stream +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECT-- +Write some data: + + +Read a line from the client: +string(6) "line1 +" + + +Read another line from the client: +string(6) "line2 +" + + +Close the server side socket and read the remaining data from the client +done diff --git a/ext/standard/tests/file/fgets_socket_variation2.phpt b/ext/standard/tests/file/fgets_socket_variation2.phpt new file mode 100644 index 0000000000..3500837133 --- /dev/null +++ b/ext/standard/tests/file/fgets_socket_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +fgets() over a socket with more than a buffer's worth of data +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECT-- +Write data from the file: +int(9000) + +Read lines from the client + +Close the server side socket and read the remaining data from the client +done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index b24956a59d..964216bf8c 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -43,10 +43,10 @@ echo "Done"; *** Testing fgets() : usage variations *** -- Testing fgets() with closed handle -- -Warning: fgets(): 6 is not a valid stream resource in %s on line %d +Warning: fgets(): %d is not a valid stream resource in %s on line %d bool(false) -Warning: fgets(): 6 is not a valid stream resource in %s on line %d +Warning: fgets(): %d is not a valid stream resource in %s on line %d bool(false) -- Testing fgets() with unset handle -- @@ -60,3 +60,4 @@ Notice: Undefined variable: file_handle in %s on line %d Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index a18fd2ceb4..efb425ca42 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -7,7 +7,7 @@ delete_links() : delete links fill_files() : fill file with specified contents change_file_perms() : Change permission of files - fill_buffer() : fill buffer with specified contents + fill_buffer() : fills buffer with specified contents compare_self_stat() : compares the first 13 elements of the stat with the corresponding named key values of the same stat. @@ -80,7 +80,7 @@ function fill_buffer(&$buffer, $fill_type, $fill_size) { } /* - Function : bool fill_file(resource $file_handle, string $fill_type, int $file_size); + Function : bool fill_file(resource $file_handle, string $fill_type, string $file_size); Description: Fills the file with data as specified with requested size. $file_handle = file handle, opened with write options, $fill_type: @@ -638,8 +638,6 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) { // if the result is false(i.e values are not as expected), // dump the stat array so that easy to figure out the error if ( $result == false ) { - echo "\n Dumping diff between stat array 1 and 2...\n"; - var_dump(array_diff($stat1, $stat2)); echo "\n Dumping stat array 1...\n"; var_dump($stat1); echo "\n Dumping stat array 2...\n"; diff --git a/ext/standard/tests/file/file_exists_error.phpt b/ext/standard/tests/file/file_exists_error.phpt new file mode 100644 index 0000000000..bd890f9b29 --- /dev/null +++ b/ext/standard/tests/file/file_exists_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test file_exists() function : error conditions +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing file_exists() : error conditions *** + +-- Testing file_exists() function with Zero arguments -- + +Warning: file_exists() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing file_exists() function with more than expected no. of arguments -- + +Warning: file_exists() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/standard/tests/file/file_exists_variation1.phpt b/ext/standard/tests/file/file_exists_variation1.phpt new file mode 100644 index 0000000000..35c86a2808 --- /dev/null +++ b/ext/standard/tests/file/file_exists_variation1.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test file_exists() function : usage variations +--CREDITS-- +Dave Kelsey +--FILE-- + + +--EXPECTF-- +*** Testing file_exists() : usage variations *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/file_get_contents_basic.phpt b/ext/standard/tests/file/file_get_contents_basic.phpt new file mode 100644 index 0000000000..5dc0a5e5c6 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +file_get_contents() function : basic functionality +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing the basic functionality of the file_get_contents() function *** +-- Testing with simple valid data file -- +string(100) "text text text text text text text text text text text text text text text text text text text text " + +-- Testing with empty file -- +string(0) "" + +*** Done *** diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt new file mode 100644 index 0000000000..9c30c2357c --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_error.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test file_get_contents() function : error conditions +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing error conditions *** + +-- Testing with Non-existing file -- + +Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d + +-- Testing No.of arguments less than expected -- + +Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d + +-- Testing No.of arguments greater than expected -- + +Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d + +-- Testing for invalid negative maxlen values -- +Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_get_contents_variation1.phpt b/ext/standard/tests/file/file_get_contents_variation1.phpt new file mode 100644 index 0000000000..ddc926180d --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation1.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test file_get_contents() function : variation - include path testing +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing file_get_contents() : variation *** +File in include path +===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation2.phpt b/ext/standard/tests/file/file_get_contents_variation2.phpt new file mode 100644 index 0000000000..510ec12aed --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test file_get_contents() function : variation - include path testing +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing file_get_contents() : variation *** +File in script location +===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation3.phpt b/ext/standard/tests/file/file_get_contents_variation3.phpt new file mode 100644 index 0000000000..f485b0ecf5 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation3.phpt @@ -0,0 +1,218 @@ +--TEST-- +Test file_get_contents() function : usage variation - different type for use_include_path +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for use_include_path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( file_get_contents($absFile, $value) ); +}; + +unlink($absFile); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_get_contents() : usage variation *** + +--int 0-- +string(13) "contents read" + +--int 1-- +string(13) "contents read" + +--int 12345-- +string(%d) "contents read" + +--int -12345-- +string(%d) "contents read" + +--float 10.5-- +string(%d) "contents read" + +--float -10.5-- +string(%d) "contents read" + +--float 12.3456789000e10-- +string(%d) "contents read" + +--float -12.3456789000e10-- +string(%d) "contents read" + +--float .5-- +string(%d) "contents read" + +--empty array-- +Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - file_get_contents() expects parameter 2 to be boolean, array given, %s(%d) +NULL + +--uppercase NULL-- +string(%d) "contents read" + +--lowercase null-- +string(%d) "contents read" + +--lowercase true-- +string(%d) "contents read" + +--lowercase false-- +string(%d) "contents read" + +--uppercase TRUE-- +string(%d) "contents read" + +--uppercase FALSE-- +string(%d) "contents read" + +--empty string DQ-- +string(%d) "contents read" + +--empty string SQ-- +string(%d) "contents read" + +--string DQ-- +string(%d) "contents read" + +--string SQ-- +string(%d) "contents read" + +--mixed case string-- +string(%d) "contents read" + +--heredoc-- +string(%d) "contents read" + +--instance of classWithToString-- +Error: 2 - file_get_contents() expects parameter 2 to be boolean, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - file_get_contents() expects parameter 2 to be boolean, object given, %s(%d) +NULL + +--undefined var-- +string(%d) "contents read" + +--unset var-- +string(%d) "contents read" +===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation4.phpt b/ext/standard/tests/file/file_get_contents_variation4.phpt new file mode 100644 index 0000000000..3b494b4491 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation4.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test file_get_contents() function : usage variation - different types for context. +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //non context resource + 'file resource' => $fileRes, + + //valid stream context + 'stream context' => $strContext, +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( file_get_contents($absFile, false, $value) ); +}; + +unlink($absFile); +fclose($fileRes); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_get_contents() : usage variation *** + +--int 0-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d) +NULL + +--int 1-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d) +NULL + +--int 12345-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d) +NULL + +--int -12345-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, integer given, %s(%d) +NULL + +--float 10.5-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d) +NULL + +--float -10.5-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d) +NULL + +--float 12.3456789000e10-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d) +NULL + +--float -12.3456789000e10-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d) +NULL + +--float .5-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, double given, %s(%d) +NULL + +--empty array-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, array given, %s(%d) +NULL + +--uppercase NULL-- +string(%d) "contents read" + +--lowercase null-- +string(%d) "contents read" + +--lowercase true-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d) +NULL + +--lowercase false-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d) +NULL + +--uppercase TRUE-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d) +NULL + +--uppercase FALSE-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, boolean given, %s(%d) +NULL + +--empty string DQ-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - file_get_contents() expects parameter 3 to be resource, object given, %s(%d) +NULL + +--undefined var-- +string(%d) "contents read" + +--unset var-- +string(%d) "contents read" + +--file resource-- +Error: 2 - file_get_contents(): supplied resource is not a valid Stream-Context resource, %s(%d) +string(%d) "contents read" + +--stream context-- +string(%d) "contents read" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/file_get_contents_variation5.phpt b/ext/standard/tests/file/file_get_contents_variation5.phpt new file mode 100644 index 0000000000..9b400310cb --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation5.phpt @@ -0,0 +1,222 @@ +--TEST-- +Test file_get_contents() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for offset + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( file_get_contents($absFile, false, null, $value) ); +}; + +unlink($absFile); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_get_contents() : usage variation *** + +--int 0-- +string(%d) "contents read" + +--int 1-- +string(%d) "ontents read" + +--int 12345-- +string(%d) "" + +--int -12345-- +string(%d) "contents read" + +--float 10.5-- +string(3) "ead" + +--float -10.5-- +string(%d) "contents read" + +--float 12.3456789000e10-- +string(%d) %s + +--float -12.3456789000e10-- +string(%d) %s + +--float .5-- +string(%d) "contents read" + +--empty array-- +Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - file_get_contents() expects parameter 4 to be long, array given, %s(%d) +NULL + +--uppercase NULL-- +string(%d) "contents read" + +--lowercase null-- +string(%d) "contents read" + +--lowercase true-- +string(12) "ontents read" + +--lowercase false-- +string(%d) "contents read" + +--uppercase TRUE-- +string(12) "ontents read" + +--uppercase FALSE-- +string(%d) "contents read" + +--empty string DQ-- +Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - file_get_contents() expects parameter 4 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - file_get_contents() expects parameter 4 to be long, object given, %s(%d) +NULL + +--undefined var-- +string(%d) "contents read" + +--unset var-- +string(%d) "contents read" +===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation6.phpt b/ext/standard/tests/file/file_get_contents_variation6.phpt new file mode 100644 index 0000000000..6795e0165a --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation6.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test file_get_contents() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + '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 maxlen + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( file_get_contents($absFile, false, null, 0, $value) ); +}; + +unlink($absFile); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_get_contents() : usage variation *** + +--int 0-- +string(%d) "" + +--int 1-- +string(%d) "c" + +--int 12345-- +string(%d) "contents read" + +--int -12345-- +Error: 2 - file_get_contents(): length must be greater than or equal to zero, %s(%d) +bool(false) + +--float 10.5-- +string(%d) "contents r" + +--float -10.5-- +Error: 2 - file_get_contents(): length must be greater than or equal to zero, %s(%d) +bool(false) + +--float .5-- +string(%d) "" + +--empty array-- +Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - file_get_contents() expects parameter 5 to be long, array given, %s(%d) +NULL + +--uppercase NULL-- +string(%d) "" + +--lowercase null-- +string(%d) "" + +--lowercase true-- +string(%d) "c" + +--lowercase false-- +string(%d) "" + +--uppercase TRUE-- +string(%d) "c" + +--uppercase FALSE-- +string(%d) "" + +--empty string DQ-- +Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - file_get_contents() expects parameter 5 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - file_get_contents() expects parameter 5 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - file_get_contents() expects parameter 5 to be long, object given, %s(%d) +NULL + +--undefined var-- +string(%d) "" + +--unset var-- +string(%d) "" +===DONE=== diff --git a/ext/standard/tests/file/file_get_contents_variation7-win32.phpt b/ext/standard/tests/file/file_get_contents_variation7-win32.phpt new file mode 100644 index 0000000000..d350b4b037 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation7-win32.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test file_get_contents() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--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 *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_get_contents_variation7.phpt b/ext/standard/tests/file/file_get_contents_variation7.phpt new file mode 100644 index 0000000000..c076857025 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation7.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test file_get_contents() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--FILE-- + +--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) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt new file mode 100644 index 0000000000..4e67a33452 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test file_get_contents() function : variation - obscure filenames +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file_get_contents() : variation *** +-- Iteration 0 -- + +Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 1 -- + +Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- + +Warning: file_get_contents( ): failed to open stream: Permission denied in %s on line %d +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- + +Warning: file_get_contents() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt new file mode 100644 index 0000000000..21b3d2b311 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test file_get_contents() function : variation - obscure filenames +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file_get_contents() : variation *** +-- Iteration 0 -- + +Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 1 -- + +Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- + +Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- + +Warning: file_get_contents() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: file_get_contents(php/php): failed to open stream: %s directory in %s on line %d +bool(false) + +*** Done *** diff --git a/ext/standard/tests/file/file_get_contents_variation9.phpt b/ext/standard/tests/file/file_get_contents_variation9.phpt new file mode 100644 index 0000000000..988a3102d2 --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_variation9.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test file_get_contents() function : variation - linked files +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file_get_contents() : variation *** +string(330) "Here is a repeated amount of data%s" +string(330) "Here is a repeated amount of data%s" +string(330) "Here is a repeated amount of data%s" + +*** Done *** + diff --git a/ext/standard/tests/file/file_put_contents_variation1.phpt b/ext/standard/tests/file/file_put_contents_variation1.phpt new file mode 100644 index 0000000000..35d193095c --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation1.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test file_put_contents() function : variation - test append flag +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing file_put_contents() : variation *** +int(25) +int(18) +43 +The first string to write, followed by this +25 +The first string to write +===DONE=== diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt new file mode 100644 index 0000000000..dccb967921 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -0,0 +1,167 @@ +--TEST-- +Test file_put_contents() function : usage variation - different data types to write +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // 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 str + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + file_put_contents($filename, $value); + readfile($filename); +}; +unlink($filename); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_put_contents() : usage variation *** + +--int 0-- +0 +--int 1-- +1 +--int 12345-- +12345 +--int -12345-- +-2345 +--float 10.5-- +10.5 +--float -10.5-- +-10.5 +--float 12.3456789000e10-- +123456789000 +--float -12.3456789000e10-- +-123456789000 +--float .5-- +0.5 +--empty array-- + +--int indexed array-- +123 +--associative array-- +12 +--nested arrays-- +Error: 8 - Array to string conversion, %s(%d) +Error: 8 - Array to string conversion, %s(%d) +fooArrayArray +--uppercase NULL-- + +--lowercase null-- + +--lowercase true-- +1 +--lowercase false-- + +--uppercase TRUE-- +1 +--uppercase FALSE-- + +--empty string DQ-- + +--empty string SQ-- + +--instance of classWithToString-- +Class A object +--instance of classWithoutToString-- + +--undefined var-- + +--unset var-- +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/file_put_contents_variation3.phpt b/ext/standard/tests/file/file_put_contents_variation3.phpt new file mode 100644 index 0000000000..e16f6403c0 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation3.phpt @@ -0,0 +1,250 @@ +--TEST-- +Test file_put_contents() function : usage variation - different types for context. +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //non context resource + 'file resource' => $fileRes, + + //valid stream context + 'stream context' => $strContext, +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( file_put_contents($absFile, $data, null, $value) ); +}; + +unlink($absFile); +fclose($fileRes); + +?> +===DONE=== +--EXPECTF-- +*** Testing file_put_contents() : usage variation *** + +--int 0-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d) +NULL + +--int 1-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d) +NULL + +--int 12345-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d) +NULL + +--int -12345-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, integer given, %s(%d) +NULL + +--float 10.5-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d) +NULL + +--float -10.5-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d) +NULL + +--float 12.3456789000e10-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d) +NULL + +--float -12.3456789000e10-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d) +NULL + +--float .5-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, double given, %s(%d) +NULL + +--empty array-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, array given, %s(%d) +NULL + +--uppercase NULL-- +int(13) + +--lowercase null-- +int(13) + +--lowercase true-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d) +NULL + +--lowercase false-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d) +NULL + +--uppercase TRUE-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d) +NULL + +--uppercase FALSE-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, boolean given, %s(%d) +NULL + +--empty string DQ-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - file_put_contents() expects parameter 4 to be resource, object given, %s(%d) +NULL + +--undefined var-- +int(13) + +--unset var-- +int(13) + +--file resource-- +Error: 2 - file_put_contents(): supplied resource is not a valid Stream-Context resource, %s(%d) +int(13) + +--stream context-- +int(13) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/file_put_contents_variation4.phpt b/ext/standard/tests/file/file_put_contents_variation4.phpt new file mode 100644 index 0000000000..ef05a39721 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation4.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test file_put_contents() function : variation - include path testing +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing file_put_contents() : variation *** +File in include path +File in include path +===DONE=== diff --git a/ext/standard/tests/file/file_put_contents_variation5.phpt b/ext/standard/tests/file/file_put_contents_variation5.phpt new file mode 100644 index 0000000000..0d3daad5fe --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation5.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test file_put_contents() function : variation - include path testing +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing file_put_contents() : variation *** +File in script location +File in script location +File in script location +File in script location +===DONE=== + diff --git a/ext/standard/tests/file/file_put_contents_variation6.phpt b/ext/standard/tests/file/file_put_contents_variation6.phpt new file mode 100644 index 0000000000..d31308fe7d --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation6.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test file_put_contents() function : variation - include path testing +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing file_put_contents() : variation *** +File in include path. This was appended +File in include path. This was appended +===DONE=== diff --git a/ext/standard/tests/file/file_put_contents_variation7-win32.phpt b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt new file mode 100644 index 0000000000..d7bfdf9233 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt @@ -0,0 +1,130 @@ +--TEST-- +Test file_put_contents() function : usage variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file_put_contents() : usage variation *** + +-- Iteration 1 -- +Data written correctly + +-- Iteration 2 -- +Data written correctly + +-- Iteration 3 -- +Data written correctly + +-- Iteration 4 -- +Data written correctly + +-- Iteration 5 -- + +Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\..\\\filePutContentsVar7Sub\\..\\..\filePutContentsVar7Sub\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d +No data written + +-- Iteration 6 -- + +Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d +No data written + +-- Iteration 7 -- +Data written correctly + +-- Iteration 8 -- +Data written correctly + +-- Iteration 9 -- +Data written correctly + +-- Iteration 10 -- +Data written correctly + +-- Iteration 11 -- + +Warning: file_put_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d +No data written + +-- Iteration 12 -- +Data written correctly + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_put_contents_variation7.phpt b/ext/standard/tests/file/file_put_contents_variation7.phpt new file mode 100644 index 0000000000..5c8e5f3602 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation7.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test file_put_contents() function : usage variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing file_put_contents() : usage variation *** + +-- Iteration 1 -- +Data written correctly + +-- Iteration 2 -- +Data written correctly + +-- Iteration 3 -- +Data written correctly + +-- Iteration 4 -- +Data written correctly + +-- Iteration 5 -- + +Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/..///filePutContentsVar7Sub//..//../filePutContentsVar7Sub/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d +No data written + +-- Iteration 6 -- + +Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d +No data written + +-- Iteration 7 -- +Data written correctly + +-- Iteration 8 -- +Data written correctly + +-- Iteration 9 -- +Data written correctly + +-- Iteration 10 -- +Data written correctly + +-- Iteration 11 -- + +Warning: file_put_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d +No data written + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt new file mode 100644 index 0000000000..ce06019e86 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test file_put_contents() function : usage variation - obscure filenames +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file_put_contents() : usage variation *** +-- Iteration 0 -- +9 bytes written to: -1 +-- Iteration 1 -- +9 bytes written to: 1 +-- Iteration 2 -- +Failed to write data to: +-- Iteration 3 -- +Failed to write data to: +-- Iteration 4 -- +Failed to write data to: +-- Iteration 5 -- + +Warning: file_put_contents( ): failed to open stream: Permission denied in %s on line %d +Failed to write data to: +-- Iteration 6 -- +Failed to write data to:%s +-- Iteration 7 -- + +Warning: file_put_contents() expects parameter 1 to be string, array given in %s on line %d +Failed to write data to: Array +-- Iteration 8 -- + +Warning: file_put_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d +Failed to write data to: /no/such/file/dir +-- Iteration 9 -- + +Warning: file_put_contents(php/php): failed to open stream: %s in %s on line %d +Failed to write data to: php/php + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt new file mode 100644 index 0000000000..6042ecf982 --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test file_put_contents() function : usage variation - obscure filenames +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file_put_contents() : usage variation *** +-- Iteration 0 -- +9 bytes written to: -1 +-- Iteration 1 -- +9 bytes written to: 1 +-- Iteration 2 -- +Failed to write data to: +-- Iteration 3 -- +Failed to write data to: +-- Iteration 4 -- +Failed to write data to: +-- Iteration 5 -- +9 bytes written to: +-- Iteration 6 -- +Failed to write data to:%s +-- Iteration 7 -- + +Warning: file_put_contents() expects parameter 1 to be string, array given in %s on line %d +Failed to write data to: Array +-- Iteration 8 -- + +Warning: file_put_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d +Failed to write data to: /no/such/file/dir +-- Iteration 9 -- + +Warning: file_put_contents(php/php): failed to open stream: %s in %s on line %d +Failed to write data to: php/php + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_put_contents_variation9.phpt b/ext/standard/tests/file/file_put_contents_variation9.phpt new file mode 100644 index 0000000000..7ad09c449d --- /dev/null +++ b/ext/standard/tests/file/file_put_contents_variation9.phpt @@ -0,0 +1,70 @@ +--TEST-- +est file_put_contents() function : usage variation - linked files +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing file_put_contents() : usage variation *** +int(17) +int(11) +Here is some data, more data +int(17) +int(11) +Here is some data, more data +int(17) +int(11) +Here is some data, more data + +*** Done *** diff --git a/ext/standard/tests/file/file_variation8-win32.phpt b/ext/standard/tests/file/file_variation8-win32.phpt new file mode 100644 index 0000000000..ca3be36b56 --- /dev/null +++ b/ext/standard/tests/file/file_variation8-win32.phpt @@ -0,0 +1,142 @@ +--TEST-- +Test file() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing file() : variation *** + +-- Iteration 1 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 2 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 3 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 4 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 5 -- + +Warning: file(%sfileVar8.dir\fileVar8Sub\..\\\fileVar8Sub\\..\\..\fileVar8Sub\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: file(%sfileVar8.dir\fileVar8Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 7 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 8 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 9 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 10 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 11 -- + +Warning: file(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 12 -- +array(1) { + [0]=> + string(13) "contents read" +} + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_variation8.phpt b/ext/standard/tests/file/file_variation8.phpt new file mode 100644 index 0000000000..be18fcb032 --- /dev/null +++ b/ext/standard/tests/file/file_variation8.phpt @@ -0,0 +1,128 @@ +--TEST-- +Test file function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing file() : variation *** + +-- Iteration 1 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 2 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 3 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 4 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 5 -- + +Warning: file(%sfileVar8.dir/fileVar8Sub/..///fileVar8Sub//..//../fileVar8Sub/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: file(%sfileVar8.dir/fileVar8Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 7 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 8 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 9 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 10 -- +array(1) { + [0]=> + string(13) "contents read" +} + +-- Iteration 11 -- + +Warning: file(BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/file_variation9.phpt b/ext/standard/tests/file/file_variation9.phpt new file mode 100644 index 0000000000..9ddd1e6209 --- /dev/null +++ b/ext/standard/tests/file/file_variation9.phpt @@ -0,0 +1,89 @@ +--TEST-- +Test file function : variation - test various endings of a file +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing file() : variation *** +array(2) { + [0]=> + string(32) "File ends on a single character +" + [1]=> + string(1) "a" +} +array(1) { + [0]=> + string(24) "File ends on a new line +" +} +array(4) { + [0]=> + string(31) "File ends on multiple newlines +" + [1]=> + string(1) " +" + [2]=> + string(1) " +" + [3]=> + string(1) " +" +} +array(4) { + [0]=> + string(9) "File has +" + [1]=> + string(1) " +" + [2]=> + string(28) "multiple lines and newlines +" + [3]=> + string(1) " +" +} +array(3) { + [0]=> + string(10) "File has +" + [1]=> + string(15) "multiple crlfs +" + [2]=> + string(2) " +" +} + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/filegroup_variation1.phpt b/ext/standard/tests/file/filegroup_variation1.phpt new file mode 100644 index 0000000000..ee76477ac8 --- /dev/null +++ b/ext/standard/tests/file/filegroup_variation1.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test filegroup() function: usage variations - links +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing filegroup() with links *** +int(%d) +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt new file mode 100644 index 0000000000..d5b7b1bac8 --- /dev/null +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test filegroup() function: usage variations - invalid filenames +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing Invalid file types *** + +Warning: filegroup(): stat failed for -2.34555 in %s on line %d +bool(false) + +Warning: filegroup(): stat failed for in %s on line %d +bool(false) +bool(false) + +Warning: filegroup(): stat failed for 1 in %s on line %d +bool(false) +bool(false) +bool(false) + +Warning: filegroup() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: filegroup(): stat failed for 1234 in %s on line %d +bool(false) + +Warning: filegroup(): stat failed for 0 in %s on line %d +bool(false) + +*** Done *** + diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt new file mode 100644 index 0000000000..dd875a082b --- /dev/null +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test filegroup() function: usage variations - diff. path notations +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing filegroup() with different notations of file names *** +- Iteration 1 - +int(%d) +- Iteration 2 - + +Warning: filegroup(): stat failed for %s//filegroup_variation3/filegroup_variation3.tmp/ in %s on line %d +bool(false) +- Iteration 3 - +int(%d) +- Iteration 4 - +int(%d) +- Iteration 5 - + +Warning: filegroup(): stat failed for %s//filegroup_variation3/*.tmp in %s on line %d +bool(false) +- Iteration 6 - + +Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d +bool(false) +- Iteration 7 - +int(%d) +- Iteration 8 - +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/fileinode_variation1.phpt b/ext/standard/tests/file/fileinode_variation1.phpt new file mode 100644 index 0000000000..d251cc3f85 --- /dev/null +++ b/ext/standard/tests/file/fileinode_variation1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test fileinode() function: usage variations - links +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing fileinode() with links *** +int(%d) +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt new file mode 100644 index 0000000000..7d71ef4ab2 --- /dev/null +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test fileinode() function: usage variations - invalid filenames +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing Invalid file types *** + +Warning: fileinode(): stat failed for -2.34555 in %s on line %d +bool(false) + +Warning: fileinode(): stat failed for in %s on line %d +bool(false) +bool(false) + +Warning: fileinode(): stat failed for 1 in %s on line %d +bool(false) +bool(false) +bool(false) + +Warning: fileinode() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: fileinode(): stat failed for 1234 in %s on line %d +bool(false) + +Warning: fileinode(): stat failed for 0 in %s on line %d +bool(false) + +*** Done *** + diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt new file mode 100644 index 0000000000..c81b573246 --- /dev/null +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test fileinode() function: usage variations - diff. path notations +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fileinode() with different notations of file names *** +- Iteration 1 - +int(%d) +- Iteration 2 - + +Warning: fileinode(): stat failed for %s//fileinode_variation3/fileinode_variation3.tmp/ in %s on line %d +bool(false) +- Iteration 3 - +int(%d) +- Iteration 4 - +int(%d) +- Iteration 5 - + +Warning: fileinode(): stat failed for %s//fileinode_variation3/*.tmp in %s on line %d +bool(false) +- Iteration 6 - + +Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d +bool(false) +- Iteration 7 - +int(%d) +- Iteration 8 - +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/fileowner_variation1.phpt b/ext/standard/tests/file/fileowner_variation1.phpt new file mode 100644 index 0000000000..b70ac366d2 --- /dev/null +++ b/ext/standard/tests/file/fileowner_variation1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test fileowner() function: usage variations - links +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing fileowner() with links *** +int(%d) +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt new file mode 100644 index 0000000000..07eb6ec8b6 --- /dev/null +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test fileowner() function: usage variations - invalid filenames +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing Invalid file types *** + +Warning: fileowner(): stat failed for -2.34555 in %s on line %d +bool(false) + +Warning: fileowner(): stat failed for in %s on line %d +bool(false) +bool(false) + +Warning: fileowner(): stat failed for 1 in %s on line %d +bool(false) +bool(false) +bool(false) + +Warning: fileowner() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: fileowner(): stat failed for 1234 in %s on line %d +bool(false) + +Warning: fileowner(): stat failed for 0 in %s on line %d +bool(false) + +*** Done *** + diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt new file mode 100644 index 0000000000..2a322b6dbc --- /dev/null +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test fileowner() function: usage variations - diff. path notations +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fileowner() with different notations of file names *** +- Iteration 1 - +int(%d) +- Iteration 2 - + +Warning: fileowner(): stat failed for %s//fileowner_variation3/fileowner_variation3.tmp/ in %s on line %d +bool(false) +- Iteration 3 - +int(%d) +- Iteration 4 - +int(%d) +- Iteration 5 - + +Warning: fileowner(): stat failed for %s//fileowner_variation3/*.tmp in %s on line %d +bool(false) +- Iteration 6 - + +Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d +bool(false) +- Iteration 7 - +int(%d) +- Iteration 8 - +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/fileperms_variation1.phpt b/ext/standard/tests/file/fileperms_variation1.phpt new file mode 100644 index 0000000000..e90cf8784f --- /dev/null +++ b/ext/standard/tests/file/fileperms_variation1.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test fileperms() function: usage variations - links +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--CLEAN-- + + +--EXPECTF-- +*** Testing fileperms() with links *** +int(%d) +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt new file mode 100644 index 0000000000..ad809a1559 --- /dev/null +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test fileperms() function: usage variations - invalid filenames +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing Invalid file types *** + +Warning: fileperms(): stat failed for -2.34555 in %s on line %d +bool(false) + +Warning: fileperms(): stat failed for in %s on line %d +bool(false) +bool(false) + +Warning: fileperms(): stat failed for 1 in %s on line %d +bool(false) +bool(false) +bool(false) + +Warning: fileperms() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: fileperms(): stat failed for 1234 in %s on line %d +bool(false) + +Warning: fileperms(): stat failed for 0 in %s on line %d +bool(false) + +*** Done *** + diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt new file mode 100644 index 0000000000..38101e363c --- /dev/null +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test fileperms() function: usage variations - diff. path notations +--CREDITS-- +Dave Kelsey +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing fileperms() with different notations of file names *** +- Iteration 1 - +int(%d) +- Iteration 2 - + +Warning: fileperms(): stat failed for %s//fileperms_variation3/fileperms_variation3.tmp/ in %s on line %d +bool(false) +- Iteration 3 - +int(%d) +- Iteration 4 - +int(%d) +- Iteration 5 - + +Warning: fileperms(): stat failed for %s//fileperms_variation3/*.tmp in %s on line %d +bool(false) +- Iteration 6 - + +Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d +bool(false) +- Iteration 7 - +int(%d) +- Iteration 8 - +int(%d) + +*** Done *** diff --git a/ext/standard/tests/file/filesize_variation1.phpt b/ext/standard/tests/file/filesize_variation1.phpt index a8a4d4e7f5..0a490cd7e6 100644 --- a/ext/standard/tests/file/filesize_variation1.phpt +++ b/ext/standard/tests/file/filesize_variation1.phpt @@ -3,7 +3,7 @@ Test filesize() function: usage variations - size of files --SKIPIF-- +--FILE-- + +--EXPECTF-- +*** Testing filesize(): usage variations *** +bool(false) +bool(false) +bool(false) + +Warning: filesize(): stat failed for in %s on line %d +bool(false) + +Warning: filesize(): stat failed for | in %s on line %d +bool(false) +*** Done *** diff --git a/ext/standard/tests/file/filetype_variation2.phpt b/ext/standard/tests/file/filetype_variation2.phpt new file mode 100644 index 0000000000..95885757cd --- /dev/null +++ b/ext/standard/tests/file/filetype_variation2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test filetype() function: Variations +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing filetype() with various types *** +-- Checking for char -- +char +-- Checking for block -- +block + +*** Done *** diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index 077e5430ba..fe61e2a173 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -94,7 +94,7 @@ NULL Warning: flock() expects parameter 2 to be long, string given in %s on line %d NULL -Warning: flock(): 6 is not a valid stream resource in %s on line %d +Warning: flock(): %d is not a valid stream resource in %s on line %d bool(false) Warning: flock() expects parameter 1 to be resource, string given in %s on line %d diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt index af67ab402a..339f10cb9f 100644 --- a/ext/standard/tests/file/flock_variation.phpt +++ b/ext/standard/tests/file/flock_variation.phpt @@ -1,371 +1,45 @@ --TEST-- -Test flock() function: Variations +Test flock() function: usage variations --FILE-- --EXPECTF-- -*** Testing flock() fun with the various operation and - wouldblock values *** ---- Outer iteration 0 --- -bool(true) --- Inner iteration 0 in 0 -- -bool(true) --- Inner iteration 1 in 0 -- -bool(true) --- Inner iteration 2 in 0 -- -bool(true) --- Inner iteration 3 in 0 -- -bool(true) --- Inner iteration 4 in 0 -- -bool(true) --- Inner iteration 5 in 0 -- -bool(true) --- Inner iteration 6 in 0 -- -bool(true) --- Inner iteration 7 in 0 -- -bool(true) --- Inner iteration 8 in 0 -- -bool(true) --- Inner iteration 9 in 0 -- -bool(true) --- Inner iteration 10 in 0 -- -bool(true) --- Inner iteration 11 in 0 -- -bool(true) --- Inner iteration 12 in 0 -- -bool(true) --- Inner iteration 13 in 0 -- -bool(true) ---- Outer iteration 1 --- -bool(true) --- Inner iteration 0 in 1 -- -bool(true) --- Inner iteration 1 in 1 -- -bool(true) --- Inner iteration 2 in 1 -- -bool(true) --- Inner iteration 3 in 1 -- -bool(true) --- Inner iteration 4 in 1 -- -bool(true) --- Inner iteration 5 in 1 -- -bool(true) --- Inner iteration 6 in 1 -- -bool(true) --- Inner iteration 7 in 1 -- -bool(true) --- Inner iteration 8 in 1 -- -bool(true) --- Inner iteration 9 in 1 -- -bool(true) --- Inner iteration 10 in 1 -- -bool(true) --- Inner iteration 11 in 1 -- -bool(true) --- Inner iteration 12 in 1 -- -bool(true) --- Inner iteration 13 in 1 -- -bool(true) ---- Outer iteration 2 --- -bool(true) --- Inner iteration 0 in 2 -- -bool(true) --- Inner iteration 1 in 2 -- -bool(true) --- Inner iteration 2 in 2 -- -bool(true) --- Inner iteration 3 in 2 -- -bool(true) --- Inner iteration 4 in 2 -- -bool(true) --- Inner iteration 5 in 2 -- -bool(true) --- Inner iteration 6 in 2 -- -bool(true) --- Inner iteration 7 in 2 -- -bool(true) --- Inner iteration 8 in 2 -- -bool(true) --- Inner iteration 9 in 2 -- -bool(true) --- Inner iteration 10 in 2 -- -bool(true) --- Inner iteration 11 in 2 -- -bool(true) --- Inner iteration 12 in 2 -- -bool(true) --- Inner iteration 13 in 2 -- -bool(true) ---- Outer iteration 3 --- -bool(true) --- Inner iteration 0 in 3 -- -bool(true) --- Inner iteration 1 in 3 -- -bool(true) --- Inner iteration 2 in 3 -- -bool(true) --- Inner iteration 3 in 3 -- -bool(true) --- Inner iteration 4 in 3 -- -bool(true) --- Inner iteration 5 in 3 -- -bool(true) --- Inner iteration 6 in 3 -- -bool(true) --- Inner iteration 7 in 3 -- -bool(true) --- Inner iteration 8 in 3 -- -bool(true) --- Inner iteration 9 in 3 -- -bool(true) --- Inner iteration 10 in 3 -- -bool(true) --- Inner iteration 11 in 3 -- -bool(true) --- Inner iteration 12 in 3 -- -bool(true) --- Inner iteration 13 in 3 -- -bool(true) ---- Outer iteration 4 --- -bool(true) --- Inner iteration 0 in 4 -- -bool(true) --- Inner iteration 1 in 4 -- -bool(true) --- Inner iteration 2 in 4 -- -bool(true) --- Inner iteration 3 in 4 -- -bool(true) --- Inner iteration 4 in 4 -- -bool(true) --- Inner iteration 5 in 4 -- -bool(true) --- Inner iteration 6 in 4 -- -bool(true) --- Inner iteration 7 in 4 -- -bool(true) --- Inner iteration 8 in 4 -- -bool(true) --- Inner iteration 9 in 4 -- +*** Test flock() function: with the operations given as numeric values *** bool(true) --- Inner iteration 10 in 4 -- bool(true) --- Inner iteration 11 in 4 -- bool(true) --- Inner iteration 12 in 4 -- bool(true) --- Inner iteration 13 in 4 -- bool(true) ---- Outer iteration 5 --- bool(true) --- Inner iteration 0 in 5 -- bool(true) --- Inner iteration 1 in 5 -- bool(true) --- Inner iteration 2 in 5 -- -bool(true) --- Inner iteration 3 in 5 -- -bool(true) --- Inner iteration 4 in 5 -- -bool(true) --- Inner iteration 5 in 5 -- -bool(true) --- Inner iteration 6 in 5 -- -bool(true) --- Inner iteration 7 in 5 -- -bool(true) --- Inner iteration 8 in 5 -- -bool(true) --- Inner iteration 9 in 5 -- -bool(true) --- Inner iteration 10 in 5 -- -bool(true) --- Inner iteration 11 in 5 -- -bool(true) --- Inner iteration 12 in 5 -- -bool(true) --- Inner iteration 13 in 5 -- -bool(true) ---- Outer iteration 6 --- -bool(true) --- Inner iteration 0 in 6 -- -bool(true) --- Inner iteration 1 in 6 -- -bool(true) --- Inner iteration 2 in 6 -- -bool(true) --- Inner iteration 3 in 6 -- -bool(true) --- Inner iteration 4 in 6 -- -bool(true) --- Inner iteration 5 in 6 -- -bool(true) --- Inner iteration 6 in 6 -- -bool(true) --- Inner iteration 7 in 6 -- -bool(true) --- Inner iteration 8 in 6 -- -bool(true) --- Inner iteration 9 in 6 -- -bool(true) --- Inner iteration 10 in 6 -- -bool(true) --- Inner iteration 11 in 6 -- -bool(true) --- Inner iteration 12 in 6 -- -bool(true) --- Inner iteration 13 in 6 -- -bool(true) ---- Outer iteration 7 --- -bool(true) --- Inner iteration 0 in 7 -- -bool(true) --- Inner iteration 1 in 7 -- -bool(true) --- Inner iteration 2 in 7 -- -bool(true) --- Inner iteration 3 in 7 -- -bool(true) --- Inner iteration 4 in 7 -- -bool(true) --- Inner iteration 5 in 7 -- -bool(true) --- Inner iteration 6 in 7 -- -bool(true) --- Inner iteration 7 in 7 -- -bool(true) --- Inner iteration 8 in 7 -- -bool(true) --- Inner iteration 9 in 7 -- -bool(true) --- Inner iteration 10 in 7 -- -bool(true) --- Inner iteration 11 in 7 -- -bool(true) --- Inner iteration 12 in 7 -- -bool(true) --- Inner iteration 13 in 7 -- -bool(true) ---- Outer iteration 8 --- -bool(true) --- Inner iteration 0 in 8 -- -bool(true) --- Inner iteration 1 in 8 -- -bool(true) --- Inner iteration 2 in 8 -- -bool(true) --- Inner iteration 3 in 8 -- -bool(true) --- Inner iteration 4 in 8 -- -bool(true) --- Inner iteration 5 in 8 -- -bool(true) --- Inner iteration 6 in 8 -- -bool(true) --- Inner iteration 7 in 8 -- -bool(true) --- Inner iteration 8 in 8 -- -bool(true) --- Inner iteration 9 in 8 -- -bool(true) --- Inner iteration 10 in 8 -- -bool(true) --- Inner iteration 11 in 8 -- -bool(true) --- Inner iteration 12 in 8 -- -bool(true) --- Inner iteration 13 in 8 -- -bool(true) ---- Outer iteration 9 --- -bool(true) --- Inner iteration 0 in 9 -- -bool(true) --- Inner iteration 1 in 9 -- -bool(true) --- Inner iteration 2 in 9 -- -bool(true) --- Inner iteration 3 in 9 -- -bool(true) --- Inner iteration 4 in 9 -- -bool(true) --- Inner iteration 5 in 9 -- -bool(true) --- Inner iteration 6 in 9 -- -bool(true) --- Inner iteration 7 in 9 -- -bool(true) --- Inner iteration 8 in 9 -- -bool(true) --- Inner iteration 9 in 9 -- -bool(true) --- Inner iteration 10 in 9 -- -bool(true) --- Inner iteration 11 in 9 -- -bool(true) --- Inner iteration 12 in 9 -- -bool(true) --- Inner iteration 13 in 9 -- -bool(true) - *** Done *** diff --git a/ext/standard/tests/file/flock_variation1.phpt b/ext/standard/tests/file/flock_variation1.phpt new file mode 100644 index 0000000000..3e3f5108e8 --- /dev/null +++ b/ext/standard/tests/file/flock_variation1.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test flock() function: usage variations +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- diff --git a/ext/standard/tests/file/fopen_include_path.inc b/ext/standard/tests/file/fopen_include_path.inc new file mode 100644 index 0000000000..7d6723a815 --- /dev/null +++ b/ext/standard/tests/file/fopen_include_path.inc @@ -0,0 +1,92 @@ + \ No newline at end of file diff --git a/ext/standard/tests/file/fopen_variation10-win32.phpt b/ext/standard/tests/file/fopen_variation10-win32.phpt new file mode 100644 index 0000000000..10184b2e86 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation10-win32.phpt @@ -0,0 +1,148 @@ +--TEST-- +Test fopen() function : variation: interesting paths, no use include path +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** + +--c:\-- +file in root + +--c:-- +file in root + +--c-- + +Warning: fopen(c\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--\-- + +Warning: fopen(\\fopen_variation10.tmp): failed to open stream: Invalid argument in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--/-- + +Warning: fopen(/\fopen_variation10.tmp): failed to open stream: Invalid argument in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--c:fopen10.tmpdirTwo-- + +Warning: fopen(c:fopen10.tmpdirTwo\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--c:adir-- + +Warning: fopen(c:adir\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--c:\/-- +file in root + +--c:\fopen10.tmpdirTwo\/-- +file in fopen10.tmpdirTwo + +--c:\fopen10.tmpdirTwo\-- +file in fopen10.tmpdirTwo + +--c:\fopen10.tmpdirTwo/-- +file in fopen10.tmpdirTwo + +--%s/fopen10.tmpDir-- +file in fopen10.tmpDir + +--/sortout-- + +Warning: fopen(/sortout\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d +===DONE=== + diff --git a/ext/standard/tests/file/fopen_variation11-win32.phpt b/ext/standard/tests/file/fopen_variation11-win32.phpt new file mode 100644 index 0000000000..23a557ab01 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation11-win32.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test fopen() function : variation: interesting paths, use include path = true +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** + +--c:\-- +file in root + +--c:-- +file in root + +--c-- + +Warning: fopen(c\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--\-- + +Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: Invalid argument in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--/-- + +Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: Invalid argument in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--c:fopen11.tmpdirTwo-- + +Warning: fopen(c:fopen11.tmpdirTwo\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--c:adir-- + +Warning: fopen(c:adir\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d + +--c:\/-- +file in root + +--c:\fopen11.tmpdirTwo\/-- +file in fopen11.tmpdirTwo + +--c:\fopen11.tmpdirTwo\-- +file in fopen11.tmpdirTwo + +--c:\fopen11.tmpdirTwo/-- +file in fopen11.tmpdirTwo + +--%s/fopen11.tmpDir-- +file in fopen11.tmpDir + +--/sortout-- + +Warning: fopen(/sortout\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d +file not opened for read + +Warning: fclose() expects parameter 1 to be resource, boolean given in %s on line %d +===DONE=== + diff --git a/ext/standard/tests/file/fopen_variation12.phpt b/ext/standard/tests/file/fopen_variation12.phpt new file mode 100644 index 0000000000..3d3cdba166 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation12.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test fopen() function : variation: use include path (path is bad) create a file (relative) +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +Not created in working dir +created in script dir +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation13.phpt b/ext/standard/tests/file/fopen_variation13.phpt new file mode 100644 index 0000000000..d540d70006 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation13.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test fopen() function : variation: use include path create a file (absolute) +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +Created in correct location +Created in correct location +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation14-win32.phpt b/ext/standard/tests/file/fopen_variation14-win32.phpt new file mode 100644 index 0000000000..554d8c6ded --- /dev/null +++ b/ext/standard/tests/file/fopen_variation14-win32.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test fopen() function : variation: file uri, no use include path +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** +--- READ: file://fopen14.tmpDir\fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://fopen14.tmpDir\fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://./fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://.\fopen14.tmpDir\fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://.\fopen14.tmpDir\fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- READ: file://%s/fopen14.tmpDir\fopen_variation14.tmp --- +test passed +--- WRITE: file://%s/fopen14.tmpDir\fopen_variation14.tmp --- +test passed +--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- READ: file://../fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://..\fopen14.tmpDir\fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://..\fopen14.tmpDir\fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- READ: file://%s/fopen14.tmpDir\fopen_variation14.tmp --- +test passed +--- WRITE: file://%s/fopen14.tmpDir\fopen_variation14.tmp --- +test passed +--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +===DONE=== + diff --git a/ext/standard/tests/file/fopen_variation14.phpt b/ext/standard/tests/file/fopen_variation14.phpt new file mode 100644 index 0000000000..aa4e05b892 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation14.phpt @@ -0,0 +1,134 @@ +--TEST-- +Test fopen() function : variation: file uri, no use include path +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** +--- READ: file://fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://./fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- READ: file://../fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d + +Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp --- +test passed +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fopen_variation15-win32.phpt b/ext/standard/tests/file/fopen_variation15-win32.phpt new file mode 100644 index 0000000000..8599306eda --- /dev/null +++ b/ext/standard/tests/file/fopen_variation15-win32.phpt @@ -0,0 +1,193 @@ +--TEST-- +Test fopen() function : variation: file uri, use include path = true +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** +--- READ: file://fopen15.tmpDir\fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://fopen15.tmpDir\fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://./fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://./fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://.\fopen15.tmpDir\fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://.\fopen15.tmpDir\fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- WRITE: file://%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- READ: file://%s/fopen15.tmpDir\fopen_variation15.tmp --- +test passed +--- WRITE: file://%s/fopen15.tmpDir\fopen_variation15.tmp --- +test passed +--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- READ: file://../fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://../fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://..\fopen15.tmpDir\fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://..\fopen15.tmpDir\fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- WRITE: file://%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- READ: file://%s/fopen15.tmpDir\fopen_variation15.tmp --- +test passed +--- WRITE: file://%s/fopen15.tmpDir\fopen_variation15.tmp --- +test passed +--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +===DONE=== + diff --git a/ext/standard/tests/file/fopen_variation15.phpt b/ext/standard/tests/file/fopen_variation15.phpt new file mode 100644 index 0000000000..24b01fbe8c --- /dev/null +++ b/ext/standard/tests/file/fopen_variation15.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test fopen() function : variation: file uri, use include path = true +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** +--- READ: file://fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file://./fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://./fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- READ: file://../fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- WRITE: file://../fopen15.tmpDir/fopen_variation15.tmp --- + +Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d + +Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d +--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp --- +test passed +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/fopen_variation16.phpt b/ext/standard/tests/file/fopen_variation16.phpt new file mode 100644 index 0000000000..375747f7f1 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation16.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test fopen() function : variation: use include path create and read a file (relative) +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +created in dir1 +found file again in dir1 +created in dir1 +found file again in dir1 +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation17.phpt b/ext/standard/tests/file/fopen_variation17.phpt new file mode 100644 index 0000000000..b47060c908 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation17.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test fopen() function : variation: use include path create and read a file (relative) +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +created in dir1 +found file again in dir1 +created in dir1 +found file again in dir1 +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation19.phpt b/ext/standard/tests/file/fopen_variation19.phpt new file mode 100644 index 0000000000..031ba45734 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation19.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test fopen() function : variation: test opening linked files +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +*** testing reading of links *** +soft link:Hello World +hard link:Hello World +link of link:Hello World +*** test appending to links *** +soft link:Hello World again! +hard link:Hello World again! again! +link of link:Hello World again! again! again! +*** test overwriting links *** +soft link:Goodbye World +hard link:Goodbye World +link of link:Goodbye World +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation3.phpt b/ext/standard/tests/file/fopen_variation3.phpt new file mode 100644 index 0000000000..3467a3a606 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation3.phpt @@ -0,0 +1,218 @@ +--TEST-- +Test fopen() function : usage variation different datatypes for use_include_path +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for use_include_path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $h = fopen($filename, $mode, $value); + if ($h !== false) { + echo "ok\n"; + fclose($h); + } + else { + var_dump($h); + } +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing fopen() : usage variation *** + +--int 0-- +ok + +--int 1-- +ok + +--int 12345-- +ok + +--int -12345-- +ok + +--float 10.5-- +ok + +--float -10.5-- +ok + +--float 12.3456789000e10-- +ok + +--float -12.3456789000e10-- +ok + +--float .5-- +ok + +--empty array-- +Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - fopen() expects parameter 3 to be boolean, array given, %s(%d) +bool(false) + +--uppercase NULL-- +ok + +--lowercase null-- +ok + +--lowercase true-- +ok + +--lowercase false-- +ok + +--uppercase TRUE-- +ok + +--uppercase FALSE-- +ok + +--empty string DQ-- +ok + +--empty string SQ-- +ok + +--string DQ-- +ok + +--string SQ-- +ok + +--mixed case string-- +ok + +--heredoc-- +ok + +--instance of classWithToString-- +Error: 2 - fopen() expects parameter 3 to be boolean, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - fopen() expects parameter 3 to be boolean, object given, %s(%d) +bool(false) + +--undefined var-- +ok + +--unset var-- +ok +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation4.phpt b/ext/standard/tests/file/fopen_variation4.phpt new file mode 100644 index 0000000000..61d850c501 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation4.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test fopen() function : usage variation different datatypes for stream context +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + //file resource + 'file resource' => $fileresource +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $h = fopen($filename, $mode, false, $value); + if ($h !== false) { + echo "ok\n"; + fclose($h); + } + else { + var_dump($h); + } +}; + +fclose($fileresource); + +?> +===DONE=== +--EXPECTF-- +*** Testing fopen() : usage variation *** + +--int 0-- +Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d) +bool(false) + +--int 1-- +Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - fopen() expects parameter 4 to be resource, integer given, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d) +bool(false) + +--float .5-- +Error: 2 - fopen() expects parameter 4 to be resource, double given, %s(%d) +bool(false) + +--empty array-- +Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - fopen() expects parameter 4 to be resource, array given, %s(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - fopen() expects parameter 4 to be resource, boolean given, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) +bool(false) + +--string DQ-- +Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) +bool(false) + +--string SQ-- +Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) +bool(false) + +--mixed case string-- +Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) +bool(false) + +--heredoc-- +Error: 2 - fopen() expects parameter 4 to be resource, string given, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - fopen() expects parameter 4 to be resource, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - fopen() expects parameter 4 to be resource, object given, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d) +bool(false) + +--unset var-- +Error: 2 - fopen() expects parameter 4 to be resource, null given, %s(%d) +bool(false) + +--file resource-- +Error: 2 - fopen(): supplied resource is not a valid Stream-Context resource, %s(%d) +ok +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation5.phpt b/ext/standard/tests/file/fopen_variation5.phpt new file mode 100644 index 0000000000..c8cc582f27 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation5.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test fopen() function : variation: use include path and stream context (absolute directories in path) +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** + +--- testing include path --- + +** testing with mode=r ** +in dir2 +in dir1 +in dir1 + +Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d + +Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d + +in script dir + +** testing with mode=r+ ** +in dir2 +in dir1 +in dir1 + +Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d + +Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d + +in script dir + +** testing with mode=rt ** +in dir2 +in dir1 +in dir1 + +Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d + +Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d + +in script dir +===DONE=== + diff --git a/ext/standard/tests/file/fopen_variation6.phpt b/ext/standard/tests/file/fopen_variation6.phpt new file mode 100644 index 0000000000..3a99212afe --- /dev/null +++ b/ext/standard/tests/file/fopen_variation6.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test fopen() function : variation: use include path and stream context relative/absolute file +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** +This is an absolute file +This is a relative file +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation7.phpt b/ext/standard/tests/file/fopen_variation7.phpt new file mode 100644 index 0000000000..2d6647d00d --- /dev/null +++ b/ext/standard/tests/file/fopen_variation7.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test fopen() function : variation: use include path create a file (relative) +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +Not created in working dir +created in dir1 +Not created in working dir +created in dir1 +===DONE=== diff --git a/ext/standard/tests/file/fopen_variation8.phpt b/ext/standard/tests/file/fopen_variation8.phpt new file mode 100644 index 0000000000..6672b624c1 --- /dev/null +++ b/ext/standard/tests/file/fopen_variation8.phpt @@ -0,0 +1,171 @@ +--TEST-- +Test fopen() function : variation: use include path and stream context (relative directories in path) +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing fopen() : variation *** + +--- testing include path --- + +** testing with mode=r ** +in dir2 +in dir1 +in dir1 + +Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d + +Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d + +in script dir + +** testing with mode=r+ ** +in dir2 +in dir1 +in dir1 + +Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d + +Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d + +in script dir + +** testing with mode=rt ** +in dir2 +in dir1 +in dir1 + +Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d + +Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d + +Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d + +in script dir +===DONE=== + diff --git a/ext/standard/tests/file/fopen_variation9.phpt b/ext/standard/tests/file/fopen_variation9.phpt new file mode 100644 index 0000000000..63630d331a --- /dev/null +++ b/ext/standard/tests/file/fopen_variation9.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test fopen() function : variation: use include path and stream context create a file, relative path +--CREDITS-- +Dave Kelsey +--XFAIL-- +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing fopen() : variation *** +Not created in working dir +created in dir1 +Not created in working dir +created in dir1 +===DONE=== diff --git a/ext/standard/tests/file/fpassthru_error.phpt b/ext/standard/tests/file/fpassthru_error.phpt index 958397b0e5..16dacfada9 100644 --- a/ext/standard/tests/file/fpassthru_error.phpt +++ b/ext/standard/tests/file/fpassthru_error.phpt @@ -20,6 +20,11 @@ var_dump( fpassthru() ); /* No.of args greaer than expected */ var_dump( fpassthru("", "") ); +/* fpassthru on a closed file */ +$h = fopen(__FILE__,'r'); +fclose($h); +fpassthru($h); + echo "\n*** Done ***\n"; ?> @@ -37,4 +42,7 @@ bool(false) Warning: fpassthru() expects exactly 1 parameter, 2 given in %s on line %d bool(false) +Warning: fpassthru(): 5 is not a valid stream resource in %s on line %d + *** Done *** + diff --git a/ext/standard/tests/file/fpassthru_variation1.phpt b/ext/standard/tests/file/fpassthru_variation1.phpt new file mode 100644 index 0000000000..2f1a9632f6 --- /dev/null +++ b/ext/standard/tests/file/fpassthru_variation1.phpt @@ -0,0 +1,228 @@ +--TEST-- +Test fpassthru() function : usage variations - different parameter types +--CREDITS-- +Dave Kelsey +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new testClass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for fp + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( fpassthru($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing fpassthru() : usage variations *** + +Arg value 0 + +Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) + +Arg value 1 + +Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) + +Arg value 12345 + +Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) + +Arg value -2345 + +Warning: fpassthru() expects parameter 1 to be resource, integer given in %s on line %d +bool(false) + +Arg value 10.5 + +Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d +bool(false) + +Arg value -10.5 + +Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d +bool(false) + +Arg value 101234567000 + +Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d +bool(false) + +Arg value 1.07654321E-9 + +Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d +bool(false) + +Arg value 0.5 + +Warning: fpassthru() expects parameter 1 to be resource, double given in %s on line %d +bool(false) + +Arg value Array + +Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: fpassthru() expects parameter 1 to be resource, array given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d +bool(false) + +Arg value 1 + +Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) + +Arg value 1 + +Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, boolean given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Arg value string + +Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Arg value string + +Warning: fpassthru() expects parameter 1 to be resource, string given in %s on line %d +bool(false) + +Arg value testClass + +Warning: fpassthru() expects parameter 1 to be resource, object given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d +bool(false) + +Arg value + +Warning: fpassthru() expects parameter 1 to be resource, null given in %s on line %d +bool(false) +Done + diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt index 4bba8ecd7a..c6259b6642 100644 --- a/ext/standard/tests/file/fread_error.phpt +++ b/ext/standard/tests/file/fread_error.phpt @@ -103,7 +103,7 @@ bool(false) Notice: Undefined variable: file_content_type in %s on line %d -Warning: fread(): 5 is not a valid stream resource in %s on line %d +Warning: fread(): %d is not a valid stream resource in %s on line %d bool(false) Warning: fread() expects parameter 1 to be resource, null given in %s on line %d @@ -112,3 +112,4 @@ bool(false) Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/fread_fwrite_basic.phpt b/ext/standard/tests/file/fread_fwrite_basic.phpt new file mode 100644 index 0000000000..0f5c4ed763 --- /dev/null +++ b/ext/standard/tests/file/fread_fwrite_basic.phpt @@ -0,0 +1,72 @@ +--TEST-- +fread & fwrite - Test reading and writing using a single resource +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECT-- +--- testing rw moving about the file --- +start:The 1st +at end: +bool(true) +final:The 1st part of the text +--- testing eof --- +bool(true) +bool(true) +bool(true) +bool(true) +last bytes: xtra +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fseek_dir_basic.phpt b/ext/standard/tests/file/fseek_dir_basic.phpt index c6d0816e91..cde0bf2579 100644 --- a/ext/standard/tests/file/fseek_dir_basic.phpt +++ b/ext/standard/tests/file/fseek_dir_basic.phpt @@ -42,7 +42,7 @@ var_dump(rmdir($path)); ?> --EXPECTF-- call readdir(): -resource(12) of type (stream) +resource(%d) of type (stream) array(6) { [0]=> bool(false) diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index 0af71e65fc..23eb991ebe 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -91,9 +91,10 @@ bool(false) Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing fseek() with closed/unset file handle -- -Warning: fseek(): 5 is not a valid stream resource in %s on line %d +Warning: fseek(): %d is not a valid stream resource in %s on line %d bool(false) Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index 31c9be70be..af14dbb270 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -87,9 +87,10 @@ bool(false) Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing ftell with closed/unset file handle -- -Warning: ftell(): 5 is not a valid stream resource in %s on line %d +Warning: ftell(): %d is not a valid stream resource in %s on line %d bool(false) Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index 09ed54374d..2d8f52768e 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -87,9 +87,10 @@ bool(false) Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d bool(false) -- Testing rewind() with closed/unset file handle -- -Warning: rewind(): 5 is not a valid stream resource in %s on line %d +Warning: rewind(): %d is not a valid stream resource in %s on line %d bool(false) Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/fseek_variation1.phpt b/ext/standard/tests/file/fseek_variation1.phpt new file mode 100644 index 0000000000..ebf3cf698d --- /dev/null +++ b/ext/standard/tests/file/fseek_variation1.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test fseek() function : usage variations - different types for offset +--CREDITS-- +Dave Kelsey +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new testClass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for offset + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( fseek($fp, $value, $whence) ); + var_dump( ftell($fp)); +}; +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing fseek() : usage variations *** + +Arg value 10.5 +int(0) +int(10) + +Arg value -10.5 +int(-1) +int(10) + +Arg value 1.07654321E-9 +int(0) +int(0) + +Arg value 0.5 +int(0) +int(0) + +Arg value Array + +Warning: fseek() expects parameter 2 to be long, array given in %s on line %d +bool(false) +int(0) + +Arg value Array + +Warning: fseek() expects parameter 2 to be long, array given in %s on line %d +bool(false) +int(0) + +Arg value Array + +Warning: fseek() expects parameter 2 to be long, array given in %s on line %d +bool(false) +int(0) + +Arg value Array + +Warning: fseek() expects parameter 2 to be long, array given in %s on line %d +bool(false) +int(0) + +Arg value Array + +Warning: fseek() expects parameter 2 to be long, array given in %s on line %d +bool(false) +int(0) + +Arg value +int(0) +int(0) + +Arg value +int(0) +int(0) + +Arg value 1 +int(0) +int(1) + +Arg value +int(0) +int(0) + +Arg value 1 +int(0) +int(1) + +Arg value +int(0) +int(0) + +Arg value + +Warning: fseek() expects parameter 2 to be long, string given in %s on line %d +bool(false) +int(0) + +Arg value + +Warning: fseek() expects parameter 2 to be long, string given in %s on line %d +bool(false) +int(0) + +Arg value string + +Warning: fseek() expects parameter 2 to be long, string given in %s on line %d +bool(false) +int(0) + +Arg value string + +Warning: fseek() expects parameter 2 to be long, string given in %s on line %d +bool(false) +int(0) + +Arg value testClass + +Warning: fseek() expects parameter 2 to be long, object given in %s on line %d +bool(false) +int(0) + +Arg value +int(0) +int(0) + +Arg value +int(0) +int(0) +Done + diff --git a/ext/standard/tests/file/fseek_variation2.phpt b/ext/standard/tests/file/fseek_variation2.phpt new file mode 100644 index 0000000000..1524459a61 --- /dev/null +++ b/ext/standard/tests/file/fseek_variation2.phpt @@ -0,0 +1,163 @@ +--TEST-- +Test fseek() function : usage variations - different types for whence +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing fseek() : usage variations *** + +Arg value -100 +int(-1) +int(0) + +Arg value 100 +int(-1) +int(0) + +Arg value 10.5 +int(-1) +int(0) + +Arg value -10.5 +int(-1) +int(0) + +Arg value 101234567000 +int(-1) +int(0) + +Arg value 1.07654321E-9 +int(0) +int(3) + +Arg value 0.5 +int(0) +int(3) + +Arg value +int(0) +int(3) + +Arg value +int(0) +int(3) + +Arg value 1 +int(0) +int(6) + +Arg value +int(0) +int(3) + +Arg value 1 +int(0) +int(6) + +Arg value +int(0) +int(3) + +Arg value + +Warning: fseek() expects parameter 3 to be long, string given in %s on line %d +bool(false) +int(3) + +Arg value + +Warning: fseek() expects parameter 3 to be long, string given in %s on line %d +bool(false) +int(3) + +Arg value string + +Warning: fseek() expects parameter 3 to be long, string given in %s on line %d +bool(false) +int(3) + +Arg value string + +Warning: fseek() expects parameter 3 to be long, string given in %s on line %d +bool(false) +int(3) + +Arg value +int(0) +int(3) + +Arg value +int(0) +int(3) +Done + diff --git a/ext/standard/tests/file/fseek_variation3.phpt b/ext/standard/tests/file/fseek_variation3.phpt new file mode 100644 index 0000000000..57dad36775 --- /dev/null +++ b/ext/standard/tests/file/fseek_variation3.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test fseek() function : variation functionality beyond file boundaries +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing fseek() : variation - beyond file boundaries *** +--- fseek beyond start of file --- +int(-1) +after -4 seek: +int(0) +after seek back 1: 39 +int(-1) +after seek back 20: +--- fseek beyond end of file --- +int(0) +31323334353637383900000000000000656e64 +Done diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index a28095bc2d..2f22d4e25f 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -11,7 +11,7 @@ echo "*** Testing ftruncate() : error conditions ***\n"; $filename = dirname(__FILE__)."/ftruncate_error.tmp"; $file_handle = fopen($filename, "w" ); -fwrite($file_handle, (binary)"Testing ftruncate error conditions \n"); +fwrite($file_handle, "Testing ftruncate error conditions \n"); fflush($file_handle); echo "\n Initial file size = ".filesize($filename)."\n"; @@ -23,12 +23,14 @@ var_dump( ftruncate() ); // arguments less than expected numbers var_dump( ftruncate( $file_handle ) ); // check the first size +clearstatcache(); var_dump( filesize($filename) ); echo "-- Testing ftruncate() with more than expected number of arguments --\n"; // more than expected number of arguments var_dump( ftruncate($file_handle, 10, 20) ); -// check the first size +// check the first size +clearstatcache(); var_dump( filesize($filename) ); // test invalid arguments : non-resources @@ -53,14 +55,16 @@ echo "-- Testing ftruncate() with closed/unset file handle --\n"; // ftruncate on close file handle fclose($file_handle); var_dump( ftruncate($file_handle,10) ); -// check the first size +// check the first size +clearstatcache(); var_dump( filesize($filename) ); // ftruncate on a file handle which is unset $fp = fopen($filename, "w"); unset($fp); //unset file handle var_dump( ftruncate(@$fp,10)); -// check the first size +// check the first size +clearstatcache(); var_dump( filesize($filename) ); echo "Done\n"; @@ -114,11 +118,12 @@ Warning: ftruncate() expects parameter 1 to be resource, object given in %s on l bool(false) -- Testing ftruncate() with closed/unset file handle -- -Warning: ftruncate(): 5 is not a valid stream resource in %s on line %d +Warning: ftruncate(): %d is not a valid stream resource in %s on line %d bool(false) int(36) Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d bool(false) -int(36) +int(0) Done + diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index 2177c94b25..988d618c66 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -112,9 +112,10 @@ Warning: fwrite() expects parameter 1 to be resource, object given in %s on line bool(false) -- Testing fwrite() with closed/unset file handle -- -Warning: fwrite(): 6 is not a valid stream resource in %s on line %d +Warning: fwrite(): %d is not a valid stream resource in %s on line %d bool(false) Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d bool(false) Done + diff --git a/ext/standard/tests/file/fwrite_variation5.phpt b/ext/standard/tests/file/fwrite_variation5.phpt new file mode 100644 index 0000000000..63303afe6a --- /dev/null +++ b/ext/standard/tests/file/fwrite_variation5.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test fwrite() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // 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 str + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $fp = fopen($filename,'w'); + fwrite($fp, $value); + fclose($fp); + readfile($filename); +}; +unlink($filename); + +?> +===DONE=== +--EXPECTF-- +*** Testing fwrite() : usage variation *** + +--int 0-- +0 +--int 1-- +1 +--int 12345-- +12345 +--int -12345-- +-2345 +--float 10.5-- +10.5 +--float -10.5-- +-10.5 +--float 12.3456789000e10-- +123456789000 +--float -12.3456789000e10-- +-123456789000 +--float .5-- +0.5 +--empty array-- +Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) + +--int indexed array-- +Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) + +--associative array-- +Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) + +--nested arrays-- +Error: 2 - fwrite() expects parameter 2 to be string, array given, %s(%d) + +--uppercase NULL-- + +--lowercase null-- + +--lowercase true-- +1 +--lowercase false-- + +--uppercase TRUE-- +1 +--uppercase FALSE-- + +--empty string DQ-- + +--empty string SQ-- + +--instance of classWithToString-- +Class A object +--instance of classWithoutToString-- +Error: 2 - fwrite() expects parameter 2 to be string, object given, %s(%d) + +--undefined var-- + +--unset var-- +===DONE=== + diff --git a/ext/standard/tests/file/glob_basic.phpt b/ext/standard/tests/file/glob_basic.phpt index 68e1bc74b1..fc269c442f 100755 --- a/ext/standard/tests/file/glob_basic.phpt +++ b/ext/standard/tests/file/glob_basic.phpt @@ -25,14 +25,19 @@ $fp = fopen("$dirname/file.text", "w"); fclose($fp); // glob() with default arguments -var_dump( glob($dirname."/*") ); -var_dump( glob($dirname."/*.txt") ); -var_dump( glob($dirname."/*.t?t") ); -var_dump( glob($dirname."/*.t*t") ); -var_dump( glob($dirname."/*.?") ); -var_dump( glob($dirname."/*.*") ); +sort_var_dump( glob($dirname."/*") ); +sort_var_dump( glob($dirname."/*.txt") ); +sort_var_dump( glob($dirname."/*.t?t") ); +sort_var_dump( glob($dirname."/*.t*t") ); +sort_var_dump( glob($dirname."/*.?") ); +sort_var_dump( glob($dirname."/*.*") ); echo "Done\n"; + +function sort_var_dump($results) { + sort($results); + var_dump($results); +} ?> --CLEAN-- +--SKIPIF-- + +--FILE-- + +--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_error_002.phpt b/ext/standard/tests/file/glob_error_002.phpt new file mode 100644 index 0000000000..f5bad73694 --- /dev/null +++ b/ext/standard/tests/file/glob_error_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test glob() function: long pattern. +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing glob() : long pattern. *** +array(0) { +} +Done + diff --git a/ext/standard/tests/file/is_dir_variation2.phpt b/ext/standard/tests/file/is_dir_variation2.phpt index 022e06bb40..8817256793 100644 --- a/ext/standard/tests/file/is_dir_variation2.phpt +++ b/ext/standard/tests/file/is_dir_variation2.phpt @@ -14,7 +14,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { /* Testing is_dir() with dir, soft & hard link to dir, and with file, soft & hard link to file */ - + $file_path = dirname(__FILE__); echo "*** Testing is_dir() with dir and links to dir ***\n"; @@ -70,7 +70,7 @@ bool(true) -- With symlink -- bool(true) -- With hardlink -- -Warning: link(): %s in %s on line %d +Warning: link(): %s bool(false) *** Testing is_dir() with file and links to a file *** diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index 9c2cdf885a..2df297843b 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test is_dir() function: usage variations - invalid arguments +Test is_dir() function: usage variations - invalid arguments --FILE-- --FILE-- --FILE-- diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index fefd7a2c4c..dde47cc3b5 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -2,8 +2,17 @@ Test is_readable() function: usage variations - invalid file names --SKIPIF-- --FILE-- @@ -27,6 +36,7 @@ $misc_files = array( TRUE, FALSE, NULL, + " ", @array(), @$file_handle ); @@ -49,8 +59,10 @@ bool(false) bool(false) bool(false) bool(false) +bool(false) Warning: is_readable() expects parameter 1 to be string, array given in %s on line %d NULL bool(false) Done + diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt new file mode 100644 index 0000000000..355125e830 --- /dev/null +++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt @@ -0,0 +1,50 @@ +--TEST-- +is_uploaded_file() function +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--POST_RAW-- +Content-type: multipart/form-data, boundary=AaB03x + +--AaB03x +content-disposition: form-data; name="field1" + +Joe Blow +--AaB03x +content-disposition: form-data; name="pics"; filename="file1.txt" +Content-Type: text/plain + +abcdef123456789 +--AaB03x-- +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) +bool(false) +bool(false) + +Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d +NULL + diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index 97232b4320..bf3e7e1171 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -2,8 +2,18 @@ Test is_writable() and its alias is_writeable() function: usage variations - diff. path notations --SKIPIF-- --FILE-- @@ -100,4 +110,4 @@ bool(true) -- Iteration 11 -- bool(true) bool(true) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index e2cc13c33a..4c5bfa9082 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -2,8 +2,16 @@ Test is_writable() and its alias is_writeable() function: usage variations - invalid file names --SKIPIF-- --FILE-- @@ -26,6 +34,7 @@ $misc_files = array( TRUE, FALSE, NULL, + " ", @array(), @$file_handle ); @@ -55,6 +64,8 @@ bool(false) bool(false) bool(false) bool(false) +bool(false) +bool(false) Warning: is_writable() expects parameter 1 to be string, array given in %s on line %d NULL @@ -64,3 +75,4 @@ NULL bool(false) bool(false) Done + diff --git a/ext/standard/tests/file/lstat_stat_variation2.phpt b/ext/standard/tests/file/lstat_stat_variation2.phpt index c845bb478a..e7d704a20b 100755 --- a/ext/standard/tests/file/lstat_stat_variation2.phpt +++ b/ext/standard/tests/file/lstat_stat_variation2.phpt @@ -21,13 +21,12 @@ $file_path = dirname(__FILE__); require("file.inc"); /* create temp directory */ -@rmdir("$file_path/lstat_stat_variation2/"); //ensure that dir doesn't exists -mkdir("$file_path/lstat_stat_variation2/"); // temp dir +mkdir("$file_path/lstat_stat_variation1/"); // temp dir // renaming a directory and check stat echo "*** Testing stat() for directory after being renamed ***\n"; -$old_dirname = "$file_path/lstat_stat_variation2"; -$new_dirname = "$file_path/lstat_stat_variation2a"; +$old_dirname = "$file_path/lstat_stat_variation1"; +$new_dirname = "$file_path/lstat_stat_variation1a"; $old_stat = stat($old_dirname); clearstatcache(); var_dump( rename($old_dirname, $new_dirname) ); @@ -37,8 +36,11 @@ $new_stat = stat($new_dirname); 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) ); +// compare the two stats - all except ctime +$keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, + "dev", "ino", "mode", "nlink", "uid", "gid", + "rdev", "size", "atime", "mtime", "blksize", "blocks"); +var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) ); // clear the cache clearstatcache(); @@ -48,7 +50,7 @@ echo "\n--- Done ---"; --CLEAN-- --EXPECTF-- *** Testing stat() for directory after being renamed *** diff --git a/ext/standard/tests/file/lstat_stat_variation22.phpt b/ext/standard/tests/file/lstat_stat_variation22.phpt new file mode 100644 index 0000000000..c9072ce013 --- /dev/null +++ b/ext/standard/tests/file/lstat_stat_variation22.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - invalid filenames +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** testing stat *** +bool(false) +bool(false) +bool(false) + +Warning: stat(): stat failed for in %s on line %d +bool(false) + +Warning: stat(): stat failed for | in %s on line %d +bool(false) +*** testing lstat *** +bool(false) +bool(false) +bool(false) + +Warning: lstat(): Lstat failed for in %s on line %d +bool(false) + +Warning: lstat(): Lstat failed for | in %s on line %d +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/mkdir_variation1-win32.phpt b/ext/standard/tests/file/mkdir_variation1-win32.phpt new file mode 100644 index 0000000000..507a97b4ee --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation1-win32.phpt @@ -0,0 +1,123 @@ +--TEST-- +Test mkdir() function : usage variation: try invalid pathname +--CREDITS-- +Dave Kelsey +--XFAIL-- +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase false' =>false, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // other + // php.net bug outputs message File Exists + 'single space' => ' ', +); + +// loop through each element of the array for pathname + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $res = mkdir($value); + if ($res == true) { + echo "directory created\n"; + rmdir($value); + } +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing mkdir() : usage variation *** + +--uppercase NULL-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--lowercase null-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--lowercase false-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--uppercase FALSE-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--empty string DQ-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--empty string SQ-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--undefined var-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--unset var-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--single space-- +Error: 2 - mkdir(): %s, %s(%d) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/mkdir_variation1.phpt b/ext/standard/tests/file/mkdir_variation1.phpt new file mode 100644 index 0000000000..e8c500661c --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation1.phpt @@ -0,0 +1,122 @@ +--TEST-- +Test mkdir() function : usage variation: try invalid pathname +--CREDITS-- +Dave Kelsey +--XFAIL-- +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase false' =>false, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // other + 'single space' => ' ', +); + +// loop through each element of the array for pathname + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $res = mkdir($value); + if ($res == true) { + echo "directory created\n"; + rmdir($value); + } +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing mkdir() : usage variation *** + +--uppercase NULL-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--lowercase null-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--lowercase false-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--uppercase FALSE-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--empty string DQ-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--empty string SQ-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--undefined var-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--unset var-- +Error: 2 - mkdir(): No such file or directory, %s(%d) + +--single space-- +directory created +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/mkdir_variation2.phpt b/ext/standard/tests/file/mkdir_variation2.phpt new file mode 100644 index 0000000000..ab9a676ac1 --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation2.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test mkdir() function : usage variation: different types for mode +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for mode + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $h = mkdir($pathname, $value); + if ($h === true) { + echo "Directory created\n"; + rmdir($pathname); + } +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing mkdir() : usage variation *** + +--float 10.5-- +Directory created + +--float -10.5-- +Directory created + +--float 12.3456789000e10-- +Directory created + +--float -12.3456789000e10-- +Directory created + +--float .5-- +Directory created + +--empty array-- +Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d) + +--int indexed array-- +Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d) + +--associative array-- +Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d) + +--nested arrays-- +Error: 2 - mkdir() expects parameter 2 to be long, array given, %s(%d) + +--uppercase NULL-- +Directory created + +--lowercase null-- +Directory created + +--lowercase true-- +Directory created + +--lowercase false-- +Directory created + +--uppercase TRUE-- +Directory created + +--uppercase FALSE-- +Directory created + +--empty string DQ-- +Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d) + +--empty string SQ-- +Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d) + +--string DQ-- +Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d) + +--string SQ-- +Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d) + +--mixed case string-- +Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d) + +--heredoc-- +Error: 2 - mkdir() expects parameter 2 to be long, string given, %s(%d) + +--instance of classWithToString-- +Error: 2 - mkdir() expects parameter 2 to be long, object given, %s(%d) + +--instance of classWithoutToString-- +Error: 2 - mkdir() expects parameter 2 to be long, object given, %s(%d) + +--undefined var-- +Directory created + +--unset var-- +Directory created +===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation3.phpt b/ext/standard/tests/file/mkdir_variation3.phpt new file mode 100644 index 0000000000..7622e5f612 --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation3.phpt @@ -0,0 +1,208 @@ +--TEST-- +Test mkdir() function : usage variation: different types for recursive +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for recursive + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $h = mkdir($pathname, $mode, $value); + if ($h === true) { + echo "Directory created\n"; + rmdir($pathname); + } +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing mkdir() : usage variation *** + +--int 0-- +Directory created + +--int 1-- +Directory created + +--int 12345-- +Directory created + +--int -12345-- +Directory created + +--float 10.5-- +Directory created + +--float -10.5-- +Directory created + +--float 12.3456789000e10-- +Directory created + +--float -12.3456789000e10-- +Directory created + +--float .5-- +Directory created + +--empty array-- +Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d) + +--int indexed array-- +Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d) + +--associative array-- +Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d) + +--nested arrays-- +Error: 2 - mkdir() expects parameter 3 to be boolean, array given, %s(%d) + +--uppercase NULL-- +Directory created + +--lowercase null-- +Directory created + +--lowercase true-- +Directory created + +--lowercase false-- +Directory created + +--uppercase TRUE-- +Directory created + +--uppercase FALSE-- +Directory created + +--empty string DQ-- +Directory created + +--empty string SQ-- +Directory created + +--string DQ-- +Directory created + +--string SQ-- +Directory created + +--mixed case string-- +Directory created + +--heredoc-- +Directory created + +--instance of classWithToString-- +Error: 2 - mkdir() expects parameter 3 to be boolean, object given, %s(%d) + +--instance of classWithoutToString-- +Error: 2 - mkdir() expects parameter 3 to be boolean, object given, %s(%d) + +--undefined var-- +Directory created + +--unset var-- +Directory created +===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation4.phpt b/ext/standard/tests/file/mkdir_variation4.phpt new file mode 100644 index 0000000000..b97d4ebc74 --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation4.phpt @@ -0,0 +1,220 @@ +--TEST-- +Test mkdir() function : usage variation: different types for context +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +$fileRes = fopen(__FILE__,'r'); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // non stream context resource + 'file resource' => $fileRes, +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $h = mkdir($pathname, $mode, $recursive, $value); + if ($h === true) { + echo "Directory created\n"; + rmdir($pathname); + } +}; + +fclose($fileRes); + +?> +===DONE=== +--EXPECTF-- +*** Testing mkdir() : usage variation *** + +--int 0-- +Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d) + +--int 1-- +Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d) + +--int 12345-- +Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d) + +--int -12345-- +Error: 2 - mkdir() expects parameter 4 to be resource, integer given, %s(%d) + +--float 10.5-- +Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d) + +--float -10.5-- +Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d) + +--float 12.3456789000e10-- +Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d) + +--float -12.3456789000e10-- +Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d) + +--float .5-- +Error: 2 - mkdir() expects parameter 4 to be resource, double given, %s(%d) + +--empty array-- +Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) + +--int indexed array-- +Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) + +--associative array-- +Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) + +--nested arrays-- +Error: 2 - mkdir() expects parameter 4 to be resource, array given, %s(%d) + +--uppercase NULL-- +Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d) + +--lowercase null-- +Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d) + +--lowercase true-- +Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d) + +--lowercase false-- +Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d) + +--uppercase TRUE-- +Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d) + +--uppercase FALSE-- +Error: 2 - mkdir() expects parameter 4 to be resource, boolean given, %s(%d) + +--empty string DQ-- +Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) + +--empty string SQ-- +Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) + +--string DQ-- +Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) + +--string SQ-- +Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) + +--mixed case string-- +Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) + +--heredoc-- +Error: 2 - mkdir() expects parameter 4 to be resource, string given, %s(%d) + +--instance of classWithToString-- +Error: 2 - mkdir() expects parameter 4 to be resource, object given, %s(%d) + +--instance of classWithoutToString-- +Error: 2 - mkdir() expects parameter 4 to be resource, object given, %s(%d) + +--undefined var-- +Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d) + +--unset var-- +Error: 2 - mkdir() expects parameter 4 to be resource, null given, %s(%d) + +--file resource-- +Error: 2 - mkdir(): supplied resource is not a valid Stream-Context resource, %s(%d) +Directory created +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/mkdir_variation5-win32.phpt b/ext/standard/tests/file/mkdir_variation5-win32.phpt new file mode 100644 index 0000000000..d93f6c6a9b --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation5-win32.phpt @@ -0,0 +1,106 @@ +--TEST-- +Test mkdir() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--XFAIL-- +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing mkdir() : variation *** +-- creating mkdirVar5.tmp\aSubDir -- +Directory created +-- creating .\mkdirVar5.tmp\aSubDir -- +Directory created +-- creating mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir -- +Directory created +-- creating mkdirVar5.tmp\..\BADDIR\aSubDir -- + +Warning: mkdir(): No such file or directory in %s on line %d +-- creating BADDIR\aSubDir -- + +Warning: mkdir(): No such file or directory in %s on line %d +-- creating %s\mkdirVar5.tmp\aSubDir -- +Directory created +-- creating %s\.\mkdirVar5.tmp\aSubDir -- +Directory created +-- creating %s\mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir -- +Directory created +-- creating %s\BADDIR\aSubDir -- + +Warning: mkdir(): No such file or directory in %s on line %d +-- creating mkdirVar5.tmp\aSubDir\ -- +Directory created +-- creating %s\mkdirVar5.tmp\aSubDir\ -- +Directory created +-- creating mkdirVar5.tmp\\aSubDir -- +Directory created +-- creating %s\\mkdirVar5.tmp\\aSubDir -- +Directory created +-- creating /%s/mkdirVar5.tmp/aSubDir -- +Directory created +===DONE=== diff --git a/ext/standard/tests/file/mkdir_variation5.phpt b/ext/standard/tests/file/mkdir_variation5.phpt new file mode 100644 index 0000000000..51fb8260c1 --- /dev/null +++ b/ext/standard/tests/file/mkdir_variation5.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test mkdir() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--XFAIL-- +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing mkdir() : variation *** +-- creating mkdirVar5.tmp/aSubDir -- +Directory created +-- creating ./mkdirVar5.tmp/aSubDir -- +Directory created +-- creating mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir -- +Directory created +-- creating mkdirVar5.tmp/../BADDIR/aSubDir -- + +Warning: mkdir(): No such file or directory in %s on line %d +-- creating BADDIR/aSubDir -- + +Warning: mkdir(): No such file or directory in %s on line %d +-- creating %s/mkdirVar5.tmp/aSubDir -- +Directory created +-- creating %s/./mkdirVar5.tmp/aSubDir -- +Directory created +-- creating %s/mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir -- +Directory created +-- creating %s/BADDIR/aSubDir -- + +Warning: mkdir(): No such file or directory in %s on line %d +-- creating mkdirVar5.tmp/aSubDir/ -- +Directory created +-- creating %s/mkdirVar5.tmp/aSubDir/ -- +Directory created +-- creating mkdirVar5.tmp//aSubDir -- +Directory created +-- creating %s//mkdirVar5.tmp//aSubDir -- +Directory created +===DONE=== diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt new file mode 100644 index 0000000000..f008304f35 --- /dev/null +++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt @@ -0,0 +1,78 @@ +--TEST-- +move_uploaded_file() function +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--POST_RAW-- +Content-type: multipart/form-data, boundary=AaB03x + +--AaB03x +content-disposition: form-data; name="field1" + +Joe Blow +--AaB03x +content-disposition: form-data; name="file1"; filename="file1.txt" +Content-Type: text/plain + +abcdef123456789xxxDDDxxxDDDxxxDDD +--AaB03x +content-disposition: form-data; name="file2"; filename="file2.txt" +Content-Type: text/plain + +abcdef123456789 +--AaB03x-- +--FILE-- + +--EXPECTF-- +Valid move +bool(true) +bool(true) + +Original name of uploaded file +bool(false) +Non-uploaded source file +bool(false) +Valid move to existing file +bool(true) +Wrong parameters + +Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d +NULL + diff --git a/ext/standard/tests/file/parse_ini_file_variation1.phpt b/ext/standard/tests/file/parse_ini_file_variation1.phpt new file mode 100644 index 0000000000..a24bc1c051 --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation1.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test parse_ini_file() function : variation: identical properties and values are not referenced. +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing parse_ini_file() : variation *** +array(2) { + ["section1"]=> + array(2) { + ["value1"]=> + string(8) "original" + ["value2"]=> + string(8) "original" + } + ["section2"]=> + array(2) { + ["value1"]=> + string(8) "original" + ["value2"]=> + string(9) "different" + } +} +array(2) { + ["section1"]=> + array(2) { + ["value1"]=> + string(7) "changed" + ["value2"]=> + string(8) "original" + } + ["section2"]=> + array(2) { + ["value1"]=> + string(8) "original" + ["value2"]=> + string(9) "different" + } +} +===DONE=== diff --git a/ext/standard/tests/file/parse_ini_file_variation2.phpt b/ext/standard/tests/file/parse_ini_file_variation2.phpt new file mode 100644 index 0000000000..20ad6bb067 --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation2.phpt @@ -0,0 +1,111 @@ +--TEST-- +Test parse_ini_file() function : variation: handling different boolean values +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing parse_ini_file() : variation *** +array(8) { + ["section1"]=> + array(2) { + ["value1"]=> + string(1) "1" + ["value2"]=> + string(0) "" + } + ["section2"]=> + array(2) { + ["value1"]=> + string(1) "1" + ["value2"]=> + string(0) "" + } + ["section3"]=> + array(2) { + ["value1"]=> + string(1) "1" + ["value2"]=> + string(0) "" + } + ["section4"]=> + array(2) { + ["value1"]=> + string(0) "" + ["value2"]=> + string(0) "" + } + ["section5"]=> + array(2) { + ["value1"]=> + string(2) "on" + ["value2"]=> + string(3) "off" + } + ["section6"]=> + array(2) { + ["value1"]=> + string(4) "true" + ["value2"]=> + string(5) "false" + } + ["section7"]=> + array(2) { + ["value1"]=> + string(3) "yes" + ["value2"]=> + string(2) "no" + } + ["section8"]=> + array(2) { + ["value1"]=> + string(4) "null" + ["value2"]=> + string(0) "" + } +} +===DONE=== diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt new file mode 100644 index 0000000000..be147501d7 --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test parse_ini_file() function : variation: include path searching +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing parse_ini_file() : variation *** + +Warning: parse_ini_file(php.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: parse_ini_file(php.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) +array(11) { + ["error_reporting"]=> + string(%d) "%d" + ["display_errors"]=> + string(1) "1" + ["display_startup_errors"]=> + string(0) "" + ["log_errors"]=> + string(0) "" + ["log_errors_max_len"]=> + string(4) "1024" + ["ignore_repeated_errors"]=> + string(0) "" + ["ignore_repeated_source"]=> + string(0) "" + ["report_memleaks"]=> + string(1) "1" + ["track_errors"]=> + string(0) "" + ["docref_root"]=> + string(11) "/phpmanual/" + ["docref_ext"]=> + string(5) ".html" +} +===DONE=== diff --git a/ext/standard/tests/file/parse_ini_file_variation4.phpt b/ext/standard/tests/file/parse_ini_file_variation4.phpt new file mode 100644 index 0000000000..55bc22f969 --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation4.phpt @@ -0,0 +1,211 @@ +--TEST-- +Test parse_ini_file() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // 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 filename + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( parse_ini_file($value, $process_sections) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing parse_ini_file() : usage variation *** + +--int 0-- +Error: 2 - parse_ini_file(0): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--int 1-- +Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - parse_ini_file(12345): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - parse_ini_file(-2345): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - parse_ini_file(10.5): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - parse_ini_file(-10.5): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - parse_ini_file(123456789000): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - parse_ini_file(-123456789000): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--float .5-- +Error: 2 - parse_ini_file(0.5): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--empty array-- +Error: 2 - parse_ini_file() expects parameter 1 to be string, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - parse_ini_file() expects parameter 1 to be string, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - parse_ini_file() expects parameter 1 to be string, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - parse_ini_file() expects parameter 1 to be string, array given, %s(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - parse_ini_file(1): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - parse_ini_file(Class A object): failed to open stream: No such file or directory, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - parse_ini_file() expects parameter 1 to be string, object given, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) + +--unset var-- +Error: 2 - parse_ini_file(): Filename can not be empty!, %s(%d) +bool(false) +===DONE=== + diff --git a/ext/standard/tests/file/parse_ini_file_variation5.phpt b/ext/standard/tests/file/parse_ini_file_variation5.phpt new file mode 100644 index 0000000000..eea7b7decc --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation5.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test parse_ini_file() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // 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 process_sections + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( parse_ini_file($filename, $value) ); +}; + +unlink($filename); +?> +===DONE=== +--EXPECTF-- +*** Testing parse_ini_file() : usage variation *** + +--int 0-- +array(1) { + ["a"]=> + string(4) "test" +} + +--int 1-- +array(1) { + ["a"]=> + string(4) "test" +} + +--int 12345-- +array(1) { + ["a"]=> + string(4) "test" +} + +--int -12345-- +array(1) { + ["a"]=> + string(4) "test" +} + +--float 10.5-- +array(1) { + ["a"]=> + string(4) "test" +} + +--float -10.5-- +array(1) { + ["a"]=> + string(4) "test" +} + +--float 12.3456789000e10-- +array(1) { + ["a"]=> + string(4) "test" +} + +--float -12.3456789000e10-- +array(1) { + ["a"]=> + string(4) "test" +} + +--float .5-- +array(1) { + ["a"]=> + string(4) "test" +} + +--empty array-- +Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - parse_ini_file() expects parameter 2 to be boolean, array given, %s(%d) +bool(false) + +--uppercase NULL-- +array(1) { + ["a"]=> + string(4) "test" +} + +--lowercase null-- +array(1) { + ["a"]=> + string(4) "test" +} + +--empty string DQ-- +array(1) { + ["a"]=> + string(4) "test" +} + +--empty string SQ-- +array(1) { + ["a"]=> + string(4) "test" +} + +--string DQ-- +array(1) { + ["a"]=> + string(4) "test" +} + +--string SQ-- +array(1) { + ["a"]=> + string(4) "test" +} + +--mixed case string-- +array(1) { + ["a"]=> + string(4) "test" +} + +--heredoc-- +array(1) { + ["a"]=> + string(4) "test" +} + +--instance of classWithToString-- +Error: 2 - parse_ini_file() expects parameter 2 to be boolean, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - parse_ini_file() expects parameter 2 to be boolean, object given, %s(%d) +bool(false) + +--undefined var-- +array(1) { + ["a"]=> + string(4) "test" +} + +--unset var-- +array(1) { + ["a"]=> + string(4) "test" +} +===DONE=== + diff --git a/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt b/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt new file mode 100644 index 0000000000..6dfbee990a --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test parse_ini_file() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--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(%sparseIniFileVar6.dir\parseIniFileVar6Sub\..\\\parseIniFileVar6Sub\\..\\..\parseIniFileVar6Sub\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\BADDIR\ParseIniFileVar6.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\ParseIniFileVar6.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/parse_ini_file_variation6.phpt b/ext/standard/tests/file/parse_ini_file_variation6.phpt new file mode 100644 index 0000000000..e9844e905a --- /dev/null +++ b/ext/standard/tests/file/parse_ini_file_variation6.phpt @@ -0,0 +1,129 @@ +--TEST-- +Test parse_ini_file() function : variation - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--FILE-- + +--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(%sparseIniFileVar6.dir/parseIniFileVar6Sub/..///parseIniFileVar6Sub//..//../parseIniFileVar6Sub/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/BADDIR/ParseIniFileVar6.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/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/pathinfo_basic1-win32.phpt b/ext/standard/tests/file/pathinfo_basic1-win32.phpt new file mode 100644 index 0000000000..9e84b99790 --- /dev/null +++ b/ext/standard/tests/file/pathinfo_basic1-win32.phpt @@ -0,0 +1,609 @@ +--TEST-- +Test pathinfo() function: basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing basic functions of pathinfo() *** +-- Iteration 1 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +array(2) { + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 2 -- +string(1) "." +string(1) " " +string(0) "" +string(1) " " +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) " " + ["filename"]=> + string(1) " " +} +-- Iteration 3 -- +string(2) "c:" +string(2) "c:" +string(0) "" +string(2) "c:" +array(3) { + ["dirname"]=> + string(2) "c:" + ["basename"]=> + string(2) "c:" + ["filename"]=> + string(2) "c:" +} +-- Iteration 4 -- +string(3) "c:\" +string(2) "c:" +string(0) "" +string(2) "c:" +array(3) { + ["dirname"]=> + string(3) "c:\" + ["basename"]=> + string(2) "c:" + ["filename"]=> + string(2) "c:" +} +-- Iteration 5 -- +string(3) "c:\" +string(2) "c:" +string(0) "" +string(2) "c:" +array(3) { + ["dirname"]=> + string(3) "c:\" + ["basename"]=> + string(2) "c:" + ["filename"]=> + string(2) "c:" +} +-- Iteration 6 -- +string(1) "." +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 7 -- +string(7) "c:\test" +string(4) "adir" +string(0) "" +string(4) "adir" +array(3) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(4) "adir" + ["filename"]=> + string(4) "adir" +} +-- Iteration 8 -- +string(7) "c:\test" +string(4) "adir" +string(0) "" +string(4) "adir" +array(3) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(4) "adir" + ["filename"]=> + string(4) "adir" +} +-- Iteration 9 -- +string(12) "/usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(12) "/usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 10 -- +string(12) "/usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(12) "/usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 11 -- +string(11) "usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(11) "usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 12 -- +string(11) "usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(11) "usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 13 -- +string(7) "c:\test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 14 -- +string(7) "c:\test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 15 -- +string(8) "c://test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(8) "c://test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 16 -- +string(7) "c:\test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 17 -- +string(7) "c:\test" +string(8) "prog.exe" +string(3) "exe" +string(4) "prog" +array(4) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(8) "prog.exe" + ["extension"]=> + string(3) "exe" + ["filename"]=> + string(4) "prog" +} +-- Iteration 18 -- +string(7) "c:\test" +string(8) "prog.exe" +string(3) "exe" +string(4) "prog" +array(4) { + ["dirname"]=> + string(7) "c:\test" + ["basename"]=> + string(8) "prog.exe" + ["extension"]=> + string(3) "exe" + ["filename"]=> + string(4) "prog" +} +-- Iteration 19 -- +string(7) "c:/test" +string(8) "prog.exe" +string(3) "exe" +string(4) "prog" +array(4) { + ["dirname"]=> + string(7) "c:/test" + ["basename"]=> + string(8) "prog.exe" + ["extension"]=> + string(3) "exe" + ["filename"]=> + string(4) "prog" +} +-- Iteration 20 -- +string(17) "/usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 21 -- +string(19) "//usr/include//arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(19) "//usr/include//arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 22 -- +string(1) "\" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 23 -- +string(1) "\" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 24 -- +string(1) "\" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 25 -- +string(1) "\" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 26 -- +string(1) "\" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 27 -- +string(17) "/usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 28 -- +string(31) "c:\windows/system32\drivers/etc" +string(5) "hosts" +string(0) "" +string(5) "hosts" +array(3) { + ["dirname"]=> + string(31) "c:\windows/system32\drivers/etc" + ["basename"]=> + string(5) "hosts" + ["filename"]=> + string(5) "hosts" +} +-- Iteration 29 -- +string(17) "/usr\include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr\include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 30 -- +string(15) " c:\test\adir" +string(9) "afile.txt" +string(3) "txt" +string(5) "afile" +array(4) { + ["dirname"]=> + string(15) " c:\test\adir" + ["basename"]=> + string(9) "afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(5) "afile" +} +-- Iteration 31 -- +string(12) "c:\test\adir" +string(12) "afile.txt " +string(6) "txt " +string(5) "afile" +array(4) { + ["dirname"]=> + string(12) "c:\test\adir" + ["basename"]=> + string(12) "afile.txt " + ["extension"]=> + string(6) "txt " + ["filename"]=> + string(5) "afile" +} +-- Iteration 32 -- +string(15) " c:\test\adir" +string(12) "afile.txt " +string(6) "txt " +string(5) "afile" +array(4) { + ["dirname"]=> + string(15) " c:\test\adir" + ["basename"]=> + string(12) "afile.txt " + ["extension"]=> + string(6) "txt " + ["filename"]=> + string(5) "afile" +} +-- Iteration 33 -- +string(20) " /usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(20) " /usr/include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 34 -- +string(17) "/usr/include/arpa" +string(9) "inet.h " +string(4) "h " +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(9) "inet.h " + ["extension"]=> + string(4) "h " + ["filename"]=> + string(4) "inet" +} +-- Iteration 35 -- +string(20) " /usr/include/arpa" +string(9) "inet.h " +string(4) "h " +string(4) "inet" +array(4) { + ["dirname"]=> + string(20) " /usr/include/arpa" + ["basename"]=> + string(9) "inet.h " + ["extension"]=> + string(4) "h " + ["filename"]=> + string(4) "inet" +} +-- Iteration 36 -- +string(1) "." +string(3) " c:" +string(0) "" +string(3) " c:" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(3) " c:" + ["filename"]=> + string(3) " c:" +} +-- Iteration 37 -- +string(14) " c:\test\adir" +string(9) "afile.txt" +string(3) "txt" +string(5) "afile" +array(4) { + ["dirname"]=> + string(14) " c:\test\adir" + ["basename"]=> + string(9) "afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(5) "afile" +} +-- Iteration 38 -- +string(1) "\" +string(3) "usr" +string(0) "" +string(3) "usr" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(3) "usr" + ["filename"]=> + string(3) "usr" +} +-- Iteration 39 -- +string(1) "\" +string(3) "usr" +string(0) "" +string(3) "usr" +array(3) { + ["dirname"]=> + string(1) "\" + ["basename"]=> + string(3) "usr" + ["filename"]=> + string(3) "usr" +} +Done diff --git a/ext/standard/tests/file/pathinfo_basic1.phpt b/ext/standard/tests/file/pathinfo_basic1.phpt new file mode 100644 index 0000000000..61b183f870 --- /dev/null +++ b/ext/standard/tests/file/pathinfo_basic1.phpt @@ -0,0 +1,609 @@ +--TEST-- +Test pathinfo() function: basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing basic functions of pathinfo() *** +-- Iteration 1 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +array(2) { + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 2 -- +string(1) "." +string(1) " " +string(0) "" +string(1) " " +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) " " + ["filename"]=> + string(1) " " +} +-- Iteration 3 -- +string(1) "." +string(2) "c:" +string(0) "" +string(2) "c:" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(2) "c:" + ["filename"]=> + string(2) "c:" +} +-- Iteration 4 -- +string(1) "." +string(3) "c:\" +string(0) "" +string(3) "c:\" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(3) "c:\" + ["filename"]=> + string(3) "c:\" +} +-- Iteration 5 -- +string(1) "." +string(2) "c:" +string(0) "" +string(2) "c:" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(2) "c:" + ["filename"]=> + string(2) "c:" +} +-- Iteration 6 -- +string(1) "." +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 7 -- +string(1) "." +string(12) "c:\test\adir" +string(0) "" +string(12) "c:\test\adir" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(12) "c:\test\adir" + ["filename"]=> + string(12) "c:\test\adir" +} +-- Iteration 8 -- +string(1) "." +string(13) "c:\test\adir\" +string(0) "" +string(13) "c:\test\adir\" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(13) "c:\test\adir\" + ["filename"]=> + string(13) "c:\test\adir\" +} +-- Iteration 9 -- +string(12) "/usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(12) "/usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 10 -- +string(12) "/usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(12) "/usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 11 -- +string(11) "usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(11) "usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 12 -- +string(11) "usr/include" +string(4) "arpa" +string(0) "" +string(4) "arpa" +array(3) { + ["dirname"]=> + string(11) "usr/include" + ["basename"]=> + string(4) "arpa" + ["filename"]=> + string(4) "arpa" +} +-- Iteration 13 -- +string(1) "." +string(13) "c:\test\afile" +string(0) "" +string(13) "c:\test\afile" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(13) "c:\test\afile" + ["filename"]=> + string(13) "c:\test\afile" +} +-- Iteration 14 -- +string(1) "." +string(13) "c:\test\afile" +string(0) "" +string(13) "c:\test\afile" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(13) "c:\test\afile" + ["filename"]=> + string(13) "c:\test\afile" +} +-- Iteration 15 -- +string(8) "c://test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(8) "c://test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 16 -- +string(1) "." +string(14) "c:\test\afile\" +string(0) "" +string(14) "c:\test\afile\" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(14) "c:\test\afile\" + ["filename"]=> + string(14) "c:\test\afile\" +} +-- Iteration 17 -- +string(1) "." +string(16) "c:\test\prog.exe" +string(3) "exe" +string(12) "c:\test\prog" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(16) "c:\test\prog.exe" + ["extension"]=> + string(3) "exe" + ["filename"]=> + string(12) "c:\test\prog" +} +-- Iteration 18 -- +string(1) "." +string(16) "c:\test\prog.exe" +string(3) "exe" +string(12) "c:\test\prog" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(16) "c:\test\prog.exe" + ["extension"]=> + string(3) "exe" + ["filename"]=> + string(12) "c:\test\prog" +} +-- Iteration 19 -- +string(7) "c:/test" +string(8) "prog.exe" +string(3) "exe" +string(4) "prog" +array(4) { + ["dirname"]=> + string(7) "c:/test" + ["basename"]=> + string(8) "prog.exe" + ["extension"]=> + string(3) "exe" + ["filename"]=> + string(4) "prog" +} +-- Iteration 20 -- +string(17) "/usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 21 -- +string(19) "//usr/include//arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(19) "//usr/include//arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 22 -- +string(1) "." +string(1) "\" +string(0) "" +string(1) "\" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) "\" + ["filename"]=> + string(1) "\" +} +-- Iteration 23 -- +string(1) "." +string(2) "\\" +string(0) "" +string(2) "\\" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(2) "\\" + ["filename"]=> + string(2) "\\" +} +-- Iteration 24 -- +string(1) "/" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "/" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 25 -- +string(1) "/" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "/" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 26 -- +string(1) "/" +string(0) "" +string(0) "" +string(0) "" +array(3) { + ["dirname"]=> + string(1) "/" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 27 -- +string(17) "/usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 28 -- +string(27) "c:\windows/system32\drivers" +string(9) "etc\hosts" +string(0) "" +string(9) "etc\hosts" +array(3) { + ["dirname"]=> + string(27) "c:\windows/system32\drivers" + ["basename"]=> + string(9) "etc\hosts" + ["filename"]=> + string(9) "etc\hosts" +} +-- Iteration 29 -- +string(12) "/usr\include" +string(11) "arpa\inet.h" +string(1) "h" +string(9) "arpa\inet" +array(4) { + ["dirname"]=> + string(12) "/usr\include" + ["basename"]=> + string(11) "arpa\inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(9) "arpa\inet" +} +-- Iteration 30 -- +string(1) "." +string(25) " c:\test\adir\afile.txt" +string(3) "txt" +string(21) " c:\test\adir\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(25) " c:\test\adir\afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(21) " c:\test\adir\afile" +} +-- Iteration 31 -- +string(1) "." +string(25) "c:\test\adir\afile.txt " +string(6) "txt " +string(18) "c:\test\adir\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(25) "c:\test\adir\afile.txt " + ["extension"]=> + string(6) "txt " + ["filename"]=> + string(18) "c:\test\adir\afile" +} +-- Iteration 32 -- +string(1) "." +string(28) " c:\test\adir\afile.txt " +string(6) "txt " +string(21) " c:\test\adir\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(28) " c:\test\adir\afile.txt " + ["extension"]=> + string(6) "txt " + ["filename"]=> + string(21) " c:\test\adir\afile" +} +-- Iteration 33 -- +string(20) " /usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(20) " /usr/include/arpa" + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 34 -- +string(17) "/usr/include/arpa" +string(9) "inet.h " +string(4) "h " +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(9) "inet.h " + ["extension"]=> + string(4) "h " + ["filename"]=> + string(4) "inet" +} +-- Iteration 35 -- +string(20) " /usr/include/arpa" +string(9) "inet.h " +string(4) "h " +string(4) "inet" +array(4) { + ["dirname"]=> + string(20) " /usr/include/arpa" + ["basename"]=> + string(9) "inet.h " + ["extension"]=> + string(4) "h " + ["filename"]=> + string(4) "inet" +} +-- Iteration 36 -- +string(1) "." +string(3) " c:" +string(0) "" +string(3) " c:" +array(3) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(3) " c:" + ["filename"]=> + string(3) " c:" +} +-- Iteration 37 -- +string(1) "." +string(24) " c:\test\adir\afile.txt" +string(3) "txt" +string(20) " c:\test\adir\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(24) " c:\test\adir\afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(20) " c:\test\adir\afile" +} +-- Iteration 38 -- +string(1) "/" +string(3) "usr" +string(0) "" +string(3) "usr" +array(3) { + ["dirname"]=> + string(1) "/" + ["basename"]=> + string(3) "usr" + ["filename"]=> + string(3) "usr" +} +-- Iteration 39 -- +string(1) "/" +string(3) "usr" +string(0) "" +string(3) "usr" +array(3) { + ["dirname"]=> + string(1) "/" + ["basename"]=> + string(3) "usr" + ["filename"]=> + string(3) "usr" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/file/pathinfo_basic2-win32.phpt b/ext/standard/tests/file/pathinfo_basic2-win32.phpt new file mode 100644 index 0000000000..c88bc25ffc --- /dev/null +++ b/ext/standard/tests/file/pathinfo_basic2-win32.phpt @@ -0,0 +1,270 @@ +--TEST-- +Test pathinfo() function: basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing basic functions of pathinfo() *** +-- Iteration 1 -- +string(5) "c:\.." +string(4) "dir1" +string(0) "" +string(4) "dir1" +array(3) { + ["dirname"]=> + string(5) "c:\.." + ["basename"]=> + string(4) "dir1" + ["filename"]=> + string(4) "dir1" +} +-- Iteration 2 -- +string(23) "c:\test\..\test2\.\adir" +string(9) "afile.txt" +string(3) "txt" +string(5) "afile" +array(4) { + ["dirname"]=> + string(23) "c:\test\..\test2\.\adir" + ["basename"]=> + string(9) "afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(5) "afile" +} +-- Iteration 3 -- +string(22) "/usr/include/../arpa/." +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(22) "/usr/include/../arpa/." + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 4 -- +string(12) "c:\test\adir" +string(10) "afile..txt" +string(3) "txt" +string(6) "afile." +array(4) { + ["dirname"]=> + string(12) "c:\test\adir" + ["basename"]=> + string(10) "afile..txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(6) "afile." +} +-- Iteration 5 -- +string(17) "/usr/include/arpa" +string(7) "inet..h" +string(1) "h" +string(5) "inet." +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(7) "inet..h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(5) "inet." +} +-- Iteration 6 -- +string(12) "c:\test\adir" +string(6) "afile." +string(0) "" +string(5) "afile" +array(4) { + ["dirname"]=> + string(12) "c:\test\adir" + ["basename"]=> + string(6) "afile." + ["extension"]=> + string(0) "" + ["filename"]=> + string(5) "afile" +} +-- Iteration 7 -- +string(17) "/usr/include/arpa" +string(5) "inet." +string(0) "" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(5) "inet." + ["extension"]=> + string(0) "" + ["filename"]=> + string(4) "inet" +} +-- Iteration 8 -- +string(17) "/usr/include/arpa" +string(6) "inet,h" +string(0) "" +string(6) "inet,h" +array(3) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(6) "inet,h" + ["filename"]=> + string(6) "inet,h" +} +-- Iteration 9 -- +string(3) "c:." +string(11) "c:afile.txt" +string(3) "txt" +string(7) "c:afile" +array(4) { + ["dirname"]=> + string(3) "c:." + ["basename"]=> + string(11) "c:afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(7) "c:afile" +} +-- Iteration 10 -- +string(12) "..\.\..\test" +string(9) "afile.txt" +string(3) "txt" +string(5) "afile" +array(4) { + ["dirname"]=> + string(12) "..\.\..\test" + ["basename"]=> + string(9) "afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(5) "afile" +} +-- Iteration 11 -- +string(12) ".././../test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(12) ".././../test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 12 -- +string(1) "." +string(1) "." +string(0) "" +string(0) "" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 13 -- +string(1) "." +string(2) ".." +string(0) "" +string(1) "." +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(2) ".." + ["extension"]=> + string(0) "" + ["filename"]=> + string(1) "." +} +-- Iteration 14 -- +string(1) "." +string(3) "..." +string(0) "" +string(2) ".." +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(3) "..." + ["extension"]=> + string(0) "" + ["filename"]=> + string(2) ".." +} +-- Iteration 15 -- +string(12) "/usr/lib/..." +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(12) "/usr/lib/..." + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/file/pathinfo_basic2.phpt b/ext/standard/tests/file/pathinfo_basic2.phpt new file mode 100644 index 0000000000..7bddda039b --- /dev/null +++ b/ext/standard/tests/file/pathinfo_basic2.phpt @@ -0,0 +1,272 @@ +--TEST-- +Test pathinfo() function: basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing basic functions of pathinfo() *** +-- Iteration 1 -- +string(1) "." +string(10) "c:\..\dir1" +string(5) "\dir1" +string(4) "c:\." +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(10) "c:\..\dir1" + ["extension"]=> + string(5) "\dir1" + ["filename"]=> + string(4) "c:\." +} +-- Iteration 2 -- +string(1) "." +string(33) "c:\test\..\test2\.\adir\afile.txt" +string(3) "txt" +string(29) "c:\test\..\test2\.\adir\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(33) "c:\test\..\test2\.\adir\afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(29) "c:\test\..\test2\.\adir\afile" +} +-- Iteration 3 -- +string(22) "/usr/include/../arpa/." +string(6) "inet.h" +string(1) "h" +string(4) "inet" +array(4) { + ["dirname"]=> + string(22) "/usr/include/../arpa/." + ["basename"]=> + string(6) "inet.h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(4) "inet" +} +-- Iteration 4 -- +string(1) "." +string(23) "c:\test\adir\afile..txt" +string(3) "txt" +string(19) "c:\test\adir\afile." +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(23) "c:\test\adir\afile..txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(19) "c:\test\adir\afile." +} +-- Iteration 5 -- +string(17) "/usr/include/arpa" +string(7) "inet..h" +string(1) "h" +string(5) "inet." +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(7) "inet..h" + ["extension"]=> + string(1) "h" + ["filename"]=> + string(5) "inet." +} +-- Iteration 6 -- +string(1) "." +string(19) "c:\test\adir\afile." +string(0) "" +string(18) "c:\test\adir\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(19) "c:\test\adir\afile." + ["extension"]=> + string(0) "" + ["filename"]=> + string(18) "c:\test\adir\afile" +} +-- Iteration 7 -- +string(17) "/usr/include/arpa" +string(5) "inet." +string(0) "" +string(4) "inet" +array(4) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(5) "inet." + ["extension"]=> + string(0) "" + ["filename"]=> + string(4) "inet" +} +-- Iteration 8 -- +string(17) "/usr/include/arpa" +string(6) "inet,h" +string(0) "" +string(6) "inet,h" +array(3) { + ["dirname"]=> + string(17) "/usr/include/arpa" + ["basename"]=> + string(6) "inet,h" + ["filename"]=> + string(6) "inet,h" +} +-- Iteration 9 -- +string(1) "." +string(11) "c:afile.txt" +string(3) "txt" +string(7) "c:afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(11) "c:afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(7) "c:afile" +} +-- Iteration 10 -- +string(1) "." +string(22) "..\.\..\test\afile.txt" +string(3) "txt" +string(18) "..\.\..\test\afile" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(22) "..\.\..\test\afile.txt" + ["extension"]=> + string(3) "txt" + ["filename"]=> + string(18) "..\.\..\test\afile" +} +-- Iteration 11 -- +string(12) ".././../test" +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(12) ".././../test" + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +-- Iteration 12 -- +string(1) "." +string(1) "." +string(0) "" +string(0) "" +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +-- Iteration 13 -- +string(1) "." +string(2) ".." +string(0) "" +string(1) "." +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(2) ".." + ["extension"]=> + string(0) "" + ["filename"]=> + string(1) "." +} +-- Iteration 14 -- +string(1) "." +string(3) "..." +string(0) "" +string(2) ".." +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(3) "..." + ["extension"]=> + string(0) "" + ["filename"]=> + string(2) ".." +} +-- Iteration 15 -- +string(12) "/usr/lib/..." +string(5) "afile" +string(0) "" +string(5) "afile" +array(3) { + ["dirname"]=> + string(12) "/usr/lib/..." + ["basename"]=> + string(5) "afile" + ["filename"]=> + string(5) "afile" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/file/pathinfo_variation1.phpt b/ext/standard/tests/file/pathinfo_variation1.phpt new file mode 100644 index 0000000000..ff4c1eb818 --- /dev/null +++ b/ext/standard/tests/file/pathinfo_variation1.phpt @@ -0,0 +1,190 @@ +--TEST-- +Test pathinfo() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // 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 path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( pathinfo($value, $options) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing pathinfo() : usage variation *** + +--int 0-- +string(1) "." + +--int 1-- +string(1) "." + +--int 12345-- +string(1) "." + +--int -12345-- +string(1) "." + +--float 10.5-- +string(1) "." + +--float -10.5-- +string(1) "." + +--float 12.3456789000e10-- +string(1) "." + +--float -12.3456789000e10-- +string(1) "." + +--float .5-- +string(1) "." + +--empty array-- +Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - pathinfo() expects parameter 1 to be string, array given, %s(%d) +NULL + +--uppercase NULL-- +string(0) "" + +--lowercase null-- +string(0) "" + +--lowercase true-- +string(1) "." + +--lowercase false-- +string(0) "" + +--uppercase TRUE-- +string(1) "." + +--uppercase FALSE-- +string(0) "" + +--empty string DQ-- +string(0) "" + +--empty string SQ-- +string(0) "" + +--instance of classWithToString-- +string(1) "." + +--instance of classWithoutToString-- +Error: 2 - pathinfo() expects parameter 1 to be string, object given, %s(%d) +NULL + +--undefined var-- +string(0) "" + +--unset var-- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/file/pathinfo_variation2.phpt b/ext/standard/tests/file/pathinfo_variation2.phpt new file mode 100644 index 0000000000..9d18a4b79d --- /dev/null +++ b/ext/standard/tests/file/pathinfo_variation2.phpt @@ -0,0 +1,197 @@ +--TEST-- +Test pathinfo() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for options + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( pathinfo($path, $value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing pathinfo() : usage variation *** + +--float 10.5-- +string(6) "inet.h" + +--float -10.5-- +string(6) "inet.h" + +--float 12.3456789000e10-- +string(%d) %s + +--float -12.3456789000e10-- +string(%d) %s + +--float .5-- +string(%d) %s + +--empty array-- +Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d) +NULL + +--uppercase NULL-- +string(0) "" + +--lowercase null-- +string(0) "" + +--lowercase true-- +string(17) "/usr/include/arpa" + +--lowercase false-- +string(0) "" + +--uppercase TRUE-- +string(17) "/usr/include/arpa" + +--uppercase FALSE-- +string(0) "" + +--empty string DQ-- +Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - pathinfo() expects parameter 2 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - pathinfo() expects parameter 2 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - pathinfo() expects parameter 2 to be long, object given, %s(%d) +NULL + +--undefined var-- +string(0) "" + +--unset var-- +string(0) "" +===DONE=== diff --git a/ext/standard/tests/file/pathinfo_variation3.phpt b/ext/standard/tests/file/pathinfo_variation3.phpt new file mode 100644 index 0000000000..333aa56838 --- /dev/null +++ b/ext/standard/tests/file/pathinfo_variation3.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test pathinfo() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing pathinfo() : usage variation *** +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "%s" + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(10) ".cvsignore" + ["extension"]=> + string(9) "cvsignore" + ["filename"]=> + string(0) "" +} +string(6) "inet.h" +string(4) "inet" +string(1) "h" +string(17) "/usr/include/arpa" +string(17) "/usr/include/arpa" +string(6) "inet.h" +string(1) "h" +string(6) "inet.h" +string(17) "/usr/include/arpa" +string(6) "inet.h" +string(17) "/usr/include/arpa" +string(17) "/usr/include/arpa" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/pclose_variation1.phpt b/ext/standard/tests/file/pclose_variation1.phpt new file mode 100644 index 0000000000..07b5f3fbd4 --- /dev/null +++ b/ext/standard/tests/file/pclose_variation1.phpt @@ -0,0 +1,232 @@ +--TEST-- +Test pclose() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for fp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( pclose($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing pclose() : usage variation *** + +--int 0-- +Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d) +bool(false) + +--int 1-- +Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - pclose() expects parameter 1 to be resource, integer given, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d) +bool(false) + +--float .5-- +Error: 2 - pclose() expects parameter 1 to be resource, double given, %s(%d) +bool(false) + +--empty array-- +Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - pclose() expects parameter 1 to be resource, array given, %s(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - pclose() expects parameter 1 to be resource, boolean given, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) +bool(false) + +--string DQ-- +Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) +bool(false) + +--string SQ-- +Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) +bool(false) + +--mixed case string-- +Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) +bool(false) + +--heredoc-- +Error: 2 - pclose() expects parameter 1 to be resource, string given, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - pclose() expects parameter 1 to be resource, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - pclose() expects parameter 1 to be resource, object given, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) +bool(false) + +--unset var-- +Error: 2 - pclose() expects parameter 1 to be resource, null given, %s(%d) +bool(false) +===DONE=== + diff --git a/ext/standard/tests/file/popen_pclose_error-sunos.phpt b/ext/standard/tests/file/popen_pclose_error-sunos.phpt index 4c85c9e494..b63dbeb7ea 100644 --- a/ext/standard/tests/file/popen_pclose_error-sunos.phpt +++ b/ext/standard/tests/file/popen_pclose_error-sunos.phpt @@ -2,8 +2,8 @@ Test popen() and pclose function: error conditions --SKIPIF-- --FILE-- @@ -35,13 +35,13 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d +Warning: Wrong parameter count for popen() in %s on line %d NULL -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d +Warning: Wrong parameter count for popen() in %s on line %d NULL -resource(%d) of type (stream) sh: abc.txt: not found +resource(%d) of type (stream) Warning: Wrong parameter count for pclose() in %s on line %d NULL diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt new file mode 100644 index 0000000000..6fa905ac0b --- /dev/null +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test readfile() function : variation - various invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing readfile() : variation *** +-- testing '-1' -- + +Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d +-- testing '1' -- + +Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d +-- testing '' -- +-- testing '' -- +-- testing '' -- +-- testing ' ' -- + +Warning: readfile( ): failed to open stream: Permission denied in %s on line %d +-- testing '%s' -- +-- testing 'Array' -- + +Warning: readfile() expects parameter 1 to be string, array given in %s on line %d +-- testing '/no/such/file/dir' -- + +Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d +-- testing 'php/php' -- + +Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt new file mode 100644 index 0000000000..3ee1a906b7 --- /dev/null +++ b/ext/standard/tests/file/readfile_variation10.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test readfile() function : variation - various invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing readfile() : variation *** +-- testing '-1' -- + +Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d +-- testing '1' -- + +Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d +-- testing '' -- +-- testing '' -- +-- testing '' -- +-- testing ' ' -- + +Warning: readfile( ): failed to open stream: No such file or directory in %s on line %d +-- testing '%s' -- +-- testing 'Array' -- + +Warning: readfile() expects parameter 1 to be string, array given in %s on line %d +-- testing '/no/such/file/dir' -- + +Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d +-- testing 'php/php' -- + +Warning: readfile(php/php): failed to open stream: %s directory in %s on line %d + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/readfile_variation4.phpt b/ext/standard/tests/file/readfile_variation4.phpt new file mode 100644 index 0000000000..94b3326b56 --- /dev/null +++ b/ext/standard/tests/file/readfile_variation4.phpt @@ -0,0 +1,251 @@ +--TEST-- +Test readfile() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // file resource + 'file resource' => $fileRes, +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $h = readfile($filename, $use_include_path, $value); + if ($h == false) { + echo "file not read\n"; + } + else { + echo "\n"; + } +}; + +unlink($filename); +fclose($fileRes); + +?> +===DONE=== +--EXPECTF-- +*** Testing readfile() : usage variation *** + +--int 0-- +Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d) +file not read + +--int 1-- +Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d) +file not read + +--int 12345-- +Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d) +file not read + +--int -12345-- +Error: 2 - readfile() expects parameter 3 to be resource, integer given, %s(%d) +file not read + +--float 10.5-- +Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d) +file not read + +--float -10.5-- +Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d) +file not read + +--float 12.3456789000e10-- +Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d) +file not read + +--float -12.3456789000e10-- +Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d) +file not read + +--float .5-- +Error: 2 - readfile() expects parameter 3 to be resource, double given, %s(%d) +file not read + +--empty array-- +Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) +file not read + +--int indexed array-- +Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) +file not read + +--associative array-- +Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) +file not read + +--nested arrays-- +Error: 2 - readfile() expects parameter 3 to be resource, array given, %s(%d) +file not read + +--uppercase NULL-- +testing readfile + +--lowercase null-- +testing readfile + +--lowercase true-- +Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d) +file not read + +--lowercase false-- +Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d) +file not read + +--uppercase TRUE-- +Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d) +file not read + +--uppercase FALSE-- +Error: 2 - readfile() expects parameter 3 to be resource, boolean given, %s(%d) +file not read + +--empty string DQ-- +Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) +file not read + +--empty string SQ-- +Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) +file not read + +--string DQ-- +Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) +file not read + +--string SQ-- +Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) +file not read + +--mixed case string-- +Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) +file not read + +--heredoc-- +Error: 2 - readfile() expects parameter 3 to be resource, string given, %s(%d) +file not read + +--instance of classWithToString-- +Error: 2 - readfile() expects parameter 3 to be resource, object given, %s(%d) +file not read + +--instance of classWithoutToString-- +Error: 2 - readfile() expects parameter 3 to be resource, object given, %s(%d) +file not read + +--undefined var-- +testing readfile + +--unset var-- +testing readfile + +--file resource-- +Error: 2 - readfile(): supplied resource is not a valid Stream-Context resource, %s(%d) +testing readfile +===DONE=== diff --git a/ext/standard/tests/file/readfile_variation5.phpt b/ext/standard/tests/file/readfile_variation5.phpt new file mode 100644 index 0000000000..21856f8135 --- /dev/null +++ b/ext/standard/tests/file/readfile_variation5.phpt @@ -0,0 +1,221 @@ +--TEST-- +Test readfile() function : usage variation +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, +); + +// loop through each element of the array for use_include_path + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + $res = readfile($filename, $value); + if ($res == false) { + echo "File not read\n"; + } + else { + echo "\n"; + } +}; + +unlink($filename); + +?> +===DONE=== +--EXPECTF-- +*** Testing readfile() : usage variation *** + +--int 0-- +testing readfile + +--int 1-- +testing readfile + +--int 12345-- +testing readfile + +--int -12345-- +testing readfile + +--float 10.5-- +testing readfile + +--float -10.5-- +testing readfile + +--float 12.3456789000e10-- +testing readfile + +--float -12.3456789000e10-- +testing readfile + +--float .5-- +testing readfile + +--empty array-- +Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d) +File not read + +--int indexed array-- +Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d) +File not read + +--associative array-- +Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d) +File not read + +--nested arrays-- +Error: 2 - readfile() expects parameter 2 to be boolean, array given, %s(%d) +File not read + +--uppercase NULL-- +testing readfile + +--lowercase null-- +testing readfile + +--lowercase true-- +testing readfile + +--lowercase false-- +testing readfile + +--uppercase TRUE-- +testing readfile + +--uppercase FALSE-- +testing readfile + +--empty string DQ-- +testing readfile + +--empty string SQ-- +testing readfile + +--string DQ-- +testing readfile + +--string SQ-- +testing readfile + +--mixed case string-- +testing readfile + +--heredoc-- +testing readfile + +--instance of classWithToString-- +Error: 2 - readfile() expects parameter 2 to be boolean, object given, %s(%d) +File not read + +--instance of classWithoutToString-- +Error: 2 - readfile() expects parameter 2 to be boolean, object given, %s(%d) +File not read + +--undefined var-- +testing readfile + +--unset var-- +testing readfile +===DONE=== diff --git a/ext/standard/tests/file/readfile_variation6.phpt b/ext/standard/tests/file/readfile_variation6.phpt new file mode 100644 index 0000000000..02e708220c --- /dev/null +++ b/ext/standard/tests/file/readfile_variation6.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test readfile() function : variation - test include path +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing readfile() : variation *** +File in include path +===DONE=== diff --git a/ext/standard/tests/file/readfile_variation7.phpt b/ext/standard/tests/file/readfile_variation7.phpt new file mode 100644 index 0000000000..d26f52f492 --- /dev/null +++ b/ext/standard/tests/file/readfile_variation7.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test readfile() function : variation +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing readfile() : variation *** +File in script location +===DONE=== diff --git a/ext/standard/tests/file/readfile_variation8-win32.phpt b/ext/standard/tests/file/readfile_variation8-win32.phpt new file mode 100644 index 0000000000..a66af5d25b --- /dev/null +++ b/ext/standard/tests/file/readfile_variation8-win32.phpt @@ -0,0 +1,109 @@ +--TEST-- +Test readfile() function : variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing readfile() : variation *** + +-- %s\readfileVar8\readfileVar8Sub\ -- +The File Contents +-- %s\readfileVar8\readfileVar8Sub\..\readfileVar8Sub -- +The File Contents +-- %s\readfileVar8\readfileVar8Sub\\..\.\readfileVar8Sub -- +The File Contents +-- %s\readfileVar8\readfileVar8Sub\..\..\readfileVar8\.\readfileVar8Sub -- +The File Contents +-- %s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub -- + +Warning: readfile(%s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- %s\readfileVar8\readfileVar8Sub\BADDIR -- + +Warning: readfile(%s\readfileVar8\readfileVar8Sub\BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- readfileVar8\readfileVar8Sub -- +The File Contents +-- readfileVar8\\readfileVar8Sub -- +The File Contents +-- readfileVar8\\\readfileVar8Sub -- +The File Contents +-- .\readfileVar8\..\readfileVar8\readfileVar8Sub -- +The File Contents +-- BADDIR -- + +Warning: readfile(BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- /%s/readfileVar8/readfileVar8Sub -- +The File Contents +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/readfile_variation9.phpt b/ext/standard/tests/file/readfile_variation9.phpt new file mode 100644 index 0000000000..c802f4018a --- /dev/null +++ b/ext/standard/tests/file/readfile_variation9.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test readfile() function : variation - variable types of path +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing readfile() : variation *** + +-- Iteration 1 -- +The File Contents +-- Iteration 2 -- +The File Contents +-- Iteration 3 -- +The File Contents +-- Iteration 4 -- +The File Contents +-- Iteration 5 -- + +Warning: readfile(%sreadfileVar8Sub/..///readfileVar8Sub//..//../readfileVar8Sub/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- Iteration 6 -- + +Warning: readfile(%sreadfileVar8Sub/BADDIR/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +-- Iteration 7 -- +The File Contents +-- Iteration 8 -- +The File Contents +-- Iteration 9 -- +The File Contents +-- Iteration 10 -- +The File Contents +-- Iteration 11 -- + +Warning: readfile(BADDIR/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/readlink_realpath_basic1.phpt b/ext/standard/tests/file/readlink_realpath_basic1.phpt index e2a076c947..99195e2b24 100644 --- a/ext/standard/tests/file/readlink_realpath_basic1.phpt +++ b/ext/standard/tests/file/readlink_realpath_basic1.phpt @@ -39,9 +39,6 @@ $linknames = array ( "$file_path/readlink_realpath_basic1/home/test/readlink_realpath_basic1_link.tmp", "$file_path/readlink_realpath_basic1//home/test//../test/./readlink_realpath_basic1_link.tmp", - // checking for binary safe - b"$file_path/readlink_realpath_basic1/home/readlink_realpath_basic1_link.tmp", - /* linknames with invalid linkpath */ "$file_path///readlink_realpath_basic1/home//..//././test//readlink_realpath_basic1_link.tmp", "$file_path/readlink_realpath_basic1/home/../home/../test/../readlink_realpath_basic1_link.tmp", @@ -89,28 +86,24 @@ string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp" string(%d) "%s/readlink_realpath_basic1/home/test/readlink_realpath_basic1.tmp" -- Iteration 4 -- -string(%d) "%s/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp" -string(%d) "%s/readlink_realpath_basic1/home/readlink_realpath_basic1.tmp" - --- Iteration 5 -- Warning: readlink(): No such file or directory in %s on line %d bool(false) bool(false) --- Iteration 6 -- +-- Iteration 5 -- Warning: readlink(): No such file or directory in %s on line %d bool(false) bool(false) --- Iteration 7 -- +-- Iteration 6 -- Warning: readlink(): No such file or directory in %s on line %d bool(false) %s --- Iteration 8 -- +-- Iteration 7 -- Warning: readlink(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/readlink_realpath_basic2.phpt b/ext/standard/tests/file/readlink_realpath_basic2.phpt index 7a9e741ef0..91955cd4f5 100644 --- a/ext/standard/tests/file/readlink_realpath_basic2.phpt +++ b/ext/standard/tests/file/readlink_realpath_basic2.phpt @@ -34,9 +34,6 @@ $filenames = array ( "$file_path/readlink_realpath_basic2//home/test//../test/./readlink_realpath_basic2.tmp", "$file_path/readlink_realpath_basic2/home//../././readlink_realpath_basic2.tmp", - // checking for binary safe - b"$file_path/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp", - /* filenames with invalid path */ "$file_path///readlink_realpath_basic2/home//..//././test//readlink_realpath_basic2.tmp", "$file_path/readlink_realpath_basic2/home/../home/../test/../readlink_realpath_basic2.tmp", @@ -79,14 +76,11 @@ string(%d) "%s/readlink_realpath_basic2/home/test/readlink_realpath_basic2.tmp" string(%d) "%s/readlink_realpath_basic2/readlink_realpath_basic2.tmp" -- Iteration 5 -- -string(%d) "%s/readlink_realpath_basic2/home/readlink_realpath_basic2.tmp" +bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- -bool(false) - --- Iteration 8 -- %s Done diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt new file mode 100644 index 0000000000..49dc6a540b --- /dev/null +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test readlink() function: usage variations - invalid filenames +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +*** Testing Invalid file types *** + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +Warning: readlink(): No such file or directory in %s on line %d +bool(false) + +*** Done *** + diff --git a/ext/standard/tests/file/realpath_variation2.phpt b/ext/standard/tests/file/realpath_variation2.phpt new file mode 100644 index 0000000000..a5031aa7b5 --- /dev/null +++ b/ext/standard/tests/file/realpath_variation2.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test realpath() function : variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing realpath() : variation *** + +--c:\-- +bool(false) + +--c:-- +bool(false) + +--c-- +bool(false) + +--\-- +bool(false) + +--/-- +string(1) "/" + +--c:temp-- +bool(false) + +--c:\/-- +bool(false) + +--/tmp/-- +string(%d) %s/tmp" + +--/tmp/\-- +bool(false) + +--\tmp-- +bool(false) + +--\tmp\-- +bool(false) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/rename_variation10.phpt b/ext/standard/tests/file/rename_variation10.phpt new file mode 100644 index 0000000000..fbb109cd28 --- /dev/null +++ b/ext/standard/tests/file/rename_variation10.phpt @@ -0,0 +1,253 @@ +--TEST-- +Test rename() function : usage variation - different types for context +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // file resource + 'file resource' => $fileRes, +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + touch($old_name); + $res = rename($old_name, $new_name, $value); + var_dump($res); + if ($res == true) { + unlink($new_name); + } + else { + unlink($old_name); + } +}; + +fclose($fileRes); + +?> +===DONE=== +--EXPECTF-- +*** Testing rename() : usage variation *** + +--int 0-- +Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d) +bool(false) + +--int 1-- +Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - rename() expects parameter 3 to be resource, integer given, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d) +bool(false) + +--float .5-- +Error: 2 - rename() expects parameter 3 to be resource, double given, %s(%d) +bool(false) + +--empty array-- +Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - rename() expects parameter 3 to be resource, array given, %s(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - rename() expects parameter 3 to be resource, boolean given, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) +bool(false) + +--string DQ-- +Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) +bool(false) + +--string SQ-- +Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) +bool(false) + +--mixed case string-- +Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) +bool(false) + +--heredoc-- +Error: 2 - rename() expects parameter 3 to be resource, string given, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - rename() expects parameter 3 to be resource, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - rename() expects parameter 3 to be resource, object given, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d) +bool(false) + +--unset var-- +Error: 2 - rename() expects parameter 3 to be resource, null given, %s(%d) +bool(false) + +--file resource-- +Error: 2 - rename(): supplied resource is not a valid Stream-Context resource, %s(%d) +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/rename_variation11-win32.phpt b/ext/standard/tests/file/rename_variation11-win32.phpt new file mode 100644 index 0000000000..d17b0d283c --- /dev/null +++ b/ext/standard/tests/file/rename_variation11-win32.phpt @@ -0,0 +1,128 @@ +--TEST-- +Test rename() function : variation - various relative, absolute paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing rename() with absolute and relative paths *** + +-- Iteration 1 -- +bool(true) +bool(true) + +-- Iteration 2 -- +bool(true) +bool(true) + +-- Iteration 3 -- +bool(true) +bool(true) + +-- Iteration 4 -- +bool(true) +bool(true) + +-- Iteration 5 -- + +Warning: rename(%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\renameMe.tmp,%s\renameVar11\renameVar11Sub\..\\\renameVar11Sub\\..\\..\renameVar11Sub\IwasRenamed.tmp): No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: rename(%s\renameVar11\renameVar11Sub\BADDIR\renameMe.tmp,%s\renameVar11\renameVar11Sub\BADDIR\IwasRenamed.tmp): No such file or directory in %s on line %d +bool(false) + +-- Iteration 7 -- +bool(true) +bool(true) + +-- Iteration 8 -- +bool(true) +bool(true) + +-- Iteration 9 -- +bool(true) +bool(true) + +-- Iteration 10 -- +bool(true) +bool(true) + +-- Iteration 11 -- + +Warning: rename(BADDIR\renameMe.tmp,BADDIR\IwasRenamed.tmp): No such file or directory in %s on line %d +bool(false) + +-- Iteration 12 -- +bool(true) +bool(true) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/rename_variation12.phpt b/ext/standard/tests/file/rename_variation12.phpt new file mode 100644 index 0000000000..11274f03d2 --- /dev/null +++ b/ext/standard/tests/file/rename_variation12.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test rename() function : variation - various relative, absolute paths +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +*** Testing rename() with absolute and relative paths *** + +-- Iteration 1 -- +bool(true) +bool(true) + +-- Iteration 2 -- +bool(true) +bool(true) + +-- Iteration 3 -- +bool(true) +bool(true) + +-- Iteration 4 -- +bool(true) +bool(true) + +-- Iteration 5 -- + +Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): No such file or directory in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): No such file or directory in %s on line %d +bool(false) + +-- Iteration 7 -- +bool(true) +bool(true) + +-- Iteration 8 -- +bool(true) +bool(true) + +-- Iteration 9 -- +bool(true) +bool(true) + +-- Iteration 10 -- +bool(true) +bool(true) + +-- Iteration 11 -- + +Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): No such file or directory in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt new file mode 100644 index 0000000000..290095629e Binary files /dev/null and b/ext/standard/tests/file/rename_variation13-win32.phpt differ diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt new file mode 100644 index 0000000000..1237604326 --- /dev/null +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -0,0 +1,132 @@ +--TEST-- +Test rename() function : variation - various invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing rename() with obscure files *** +-- testing '-1' -- +bool(true) + +Warning: rename(-1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing '1' -- +bool(true) + +Warning: rename(1,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing '' -- + +Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +bool(false) + +Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing '' -- + +Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +bool(false) + +Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing '' -- + +Warning: rename(%s/renameVar13/afile.tmp,): No such file or directory in %s on line %d +bool(false) + +Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing ' ' -- +bool(true) + +Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing '%s' -- + +Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d +bool(false) + +Warning: rename(,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing 'Array' -- + +Warning: rename() expects parameter 2 to be string, array given in %s on line %d +bool(false) + +Warning: file_exists() expects parameter 1 to be string, array given in %s on line %d + +Warning: rename() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- testing '/no/such/file/dir' -- + +Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d +bool(false) + +Warning: rename(/no/such/file/dir,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d +bool(false) +-- testing 'php/php' -- + +Warning: rename(%s/renameVar13/afile.tmp,php/php): %s directory in %s on line %d +bool(false) + +Warning: rename(php/php,%s/renameVar13/afile.tmp): %s directory in %s on line %d +bool(false) + +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/rmdir_variation1-win32.phpt b/ext/standard/tests/file/rmdir_variation1-win32.phpt new file mode 100644 index 0000000000..0732821c54 --- /dev/null +++ b/ext/standard/tests/file/rmdir_variation1-win32.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test rmdir() function : usage variation - invalid filenames +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase false' =>false, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // other + // php outputs Permission Denied, p8 outputs no suck file or dir + 'single space' => ' ', +); + +// loop through each element of the array for dirname + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( rmdir($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing rmdir() : usage variation *** + +--uppercase NULL-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--unset var-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--single space-- +Error: 2 - rmdir( ): %s, %s(%d) +bool(false) +===DONE=== diff --git a/ext/standard/tests/file/rmdir_variation1.phpt b/ext/standard/tests/file/rmdir_variation1.phpt new file mode 100644 index 0000000000..d219e6cdf3 --- /dev/null +++ b/ext/standard/tests/file/rmdir_variation1.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test rmdir() function : usage variation - invalid file names +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase false' =>false, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // other + 'single space' => ' ', +); + +// loop through each element of the array for dirname + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( rmdir($value) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing rmdir() : usage variation *** + +--uppercase NULL-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--unset var-- +Error: 2 - rmdir(): No such file or directory, %s(%d) +bool(false) + +--single space-- +Error: 2 - rmdir( ): No such file or directory, %s(%d) +bool(false) +===DONE=== diff --git a/ext/standard/tests/file/rmdir_variation2.phpt b/ext/standard/tests/file/rmdir_variation2.phpt new file mode 100644 index 0000000000..2cee440837 --- /dev/null +++ b/ext/standard/tests/file/rmdir_variation2.phpt @@ -0,0 +1,244 @@ +--TEST-- +Test rmdir() function : usage variation - different types for context +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +$fileres = fopen(__FILE__, 'r'); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // non stream context resource + $fileres, +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + @mkdir($dirname); + var_dump( rmdir($dirname, $value) ); +}; + +@rmdir($dirname); +fclose($fileres); +?> +===DONE=== +--EXPECTF-- +*** Testing rmdir() : usage variation *** + +--int 0-- +Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--int 1-- +Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - rmdir() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float .5-- +Error: 2 - rmdir() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--empty array-- +Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - rmdir() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - rmdir() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--string DQ-- +Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--string SQ-- +Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--mixed case string-- +Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--heredoc-- +Error: 2 - rmdir() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - rmdir() expects parameter 2 to be resource, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - rmdir() expects parameter 2 to be resource, object given, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--unset var-- +Error: 2 - rmdir() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--0-- +Error: 2 - rmdir(): supplied resource is not a valid Stream-Context resource, %s(%d) +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/rmdir_variation3-win32.phpt b/ext/standard/tests/file/rmdir_variation3-win32.phpt new file mode 100644 index 0000000000..e6b3eaabb6 --- /dev/null +++ b/ext/standard/tests/file/rmdir_variation3-win32.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test rmdir() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing rmdir() : variation *** +-- removing rmdirVar3.tmp\aSubDir -- +Directory removed +-- removing .\rmdirVar3.tmp\aSubDir -- +Directory removed +-- removing rmdirVar3.tmp\..\rmdirVar3.tmp\aSubDir -- +Directory removed +-- removing rmdirVar3.tmp\..\BADDIR\aSubDir -- + +Warning: rmdir(rmdirVar3.tmp\..\BADDIR\aSubDir): No such file or directory in %s on line %d +-- removing BADDIR\aSubDir -- + +Warning: rmdir(BADDIR\aSubDir): No such file or directory in %s on line %d +-- removing %s\rmdirVar3.tmp\aSubDir -- +Directory removed +-- removing %s\.\rmdirVar3.tmp\aSubDir -- +Directory removed +-- removing %s\rmdirVar3.tmp\..\rmdirVar3.tmp\aSubDir -- +Directory removed +-- removing %s\BADDIR\aSubDir -- + +Warning: rmdir(%s\BADDIR\aSubDir): No such file or directory in %s on line %d +-- removing rmdirVar3.tmp\aSubDir\ -- +Directory removed +-- removing %s\rmdirVar3.tmp\aSubDir\ -- +Directory removed +-- removing rmdirVar3.tmp\\aSubDir -- +Directory removed +-- removing %s\\rmdirVar3.tmp\\aSubDir -- +Directory removed +-- removing /%s/rmdirVar3.tmp/aSubDir -- +Directory removed +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/rmdir_variation3.phpt b/ext/standard/tests/file/rmdir_variation3.phpt new file mode 100644 index 0000000000..5848007395 --- /dev/null +++ b/ext/standard/tests/file/rmdir_variation3.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test rmdir() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing rmdir() : variation *** +-- removing rmdirVar3.tmp/aSubDir -- +Directory removed +-- removing ./rmdirVar3.tmp/aSubDir -- +Directory removed +-- removing rmdirVar3.tmp/../rmdirVar3.tmp/aSubDir -- +Directory removed +-- removing rmdirVar3.tmp/../BADDIR/aSubDir -- + +Warning: rmdir(rmdirVar3.tmp/../BADDIR/aSubDir): No such file or directory in %s on line %d +-- removing BADDIR/aSubDir -- + +Warning: rmdir(BADDIR/aSubDir): No such file or directory in %s on line %d +-- removing %s/rmdirVar3.tmp/aSubDir -- +Directory removed +-- removing %s/./rmdirVar3.tmp/aSubDir -- +Directory removed +-- removing %s/rmdirVar3.tmp/../rmdirVar3.tmp/aSubDir -- +Directory removed +-- removing %s/BADDIR/aSubDir -- + +Warning: rmdir(%s/BADDIR/aSubDir): No such file or directory in %s on line %d +-- removing rmdirVar3.tmp/aSubDir/ -- +Directory removed +-- removing %s/rmdirVar3.tmp/aSubDir/ -- +Directory removed +-- removing rmdirVar3.tmp//aSubDir -- +Directory removed +-- removing %s//rmdirVar3.tmp//aSubDir -- +Directory removed +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index 3bee688d87..98ce6211da 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -5,7 +5,7 @@ Test symlink(), linkinfo(), link() and is_link() functions : error conditions - if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip no symlinks on Windows'); } -if (PHP_INT_SIZE != 4 ) { +if (PHP_INT_SIZE != 4) { die("skip this test is for 32bit platform only"); } ?> @@ -42,6 +42,7 @@ var_dump( link($filename, $linkname, false) ); //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename var_dump( link('', $linkname) ); // empty string as filename +var_dump( link(' ', $linkname) ); // space as filename var_dump( link(false, $linkname) ); // boolean false as filename var_dump( link($filename, NULL) ); // NULL as linkname var_dump( link($filename, '') ); // '' as linkname @@ -57,6 +58,7 @@ var_dump( is_link($linkname, "/") ); //invalid arguments var_dump( is_link(NULL) ); // NULL as linkname var_dump( is_link('') ); // empty string as linkname +var_dump( is_link(' ') ); // space as linkname var_dump( is_link(false) ); // boolean false as linkname var_dump( is_link($filename) ); // file given to is_link @@ -75,22 +77,25 @@ NULL Warning: link() expects exactly 2 parameters, 3 given in %s on line %d NULL -Warning: link(): %s in %s on line %d +Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): %s in %s on line %d +Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): %s in %s on line %d +Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): %s in %s on line %d +Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): %s in %s on line %d +Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): %s in %s on line %d +Warning: link(): No such file or directory in %s on line %d +bool(false) + +Warning: link(): No such file or directory in %s on line %d bool(false) *** Testing is_link() for error conditions *** @@ -104,4 +109,6 @@ bool(false) bool(false) bool(false) bool(false) +bool(false) Done + diff --git a/ext/standard/tests/file/tempnam_variation1-win32.phpt b/ext/standard/tests/file/tempnam_variation1-win32.phpt index 9075950330..a3dd7e9d62 100644 --- a/ext/standard/tests/file/tempnam_variation1-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation1-win32.phpt @@ -3,7 +3,7 @@ Test tempnam() function: usage variations - creating files --SKIPIF-- --FILE-- "; + $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 -"); @@ -39,39 +53,51 @@ for($i=1; $i<=10; $i++) { 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 +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 4 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 5 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 6 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 7 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 8 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 9 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified -- Iteration 10 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => directory specified *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation1.phpt b/ext/standard/tests/file/tempnam_variation1.phpt index c94a65ba21..0745f5397c 100644 --- a/ext/standard/tests/file/tempnam_variation1.phpt +++ b/ext/standard/tests/file/tempnam_variation1.phpt @@ -13,7 +13,8 @@ if(substr(PHP_OS, 0, 3) == "WIN") /* Creating number of unique files by passing a file name as prefix */ -$file_path = dirname(__FILE__); +$file_path = dirname(__FILE__)."/tempnamVar1"; +mkdir($file_path); echo "*** Testing tempnam() in creation of unique files ***\n"; for($i=1; $i<=10; $i++) { @@ -34,6 +35,19 @@ for($i=1; $i<=10; $i++) { echo "File inode is => "; print_r( fileinode($files[$i]) ); //checking inodes echo "\n"; + + echo "File created in => "; + $file_dir = dirname($files[$i]); + + if ($file_dir == sys_get_temp_dir()) { + echo "temp dir\n"; + } + else if ($file_dir == $file_path) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } clearstatcache(); } else { @@ -44,48 +58,59 @@ 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 +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 4 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 5 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 6 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 7 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 8 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 9 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified -- Iteration 10 -- -File name is => %s +File name is => %s%etempnam_variation1.tmp%s File permissions are => 100600 File inode is => %d +File created in => directory specified *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation2-win32.phpt b/ext/standard/tests/file/tempnam_variation2-win32.phpt index a9fe4fd2d6..4224966daf 100644 --- a/ext/standard/tests/file/tempnam_variation2-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation2-win32.phpt @@ -1,9 +1,9 @@ --TEST-- -Test tempnam() function: usage variations - relative paths +Test tempnam() function: usage variations - various absolute and relative paths --SKIPIF-- --FILE-- "; printf("%o", fileperms($file_name) ); echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + $dir_req = $dir_paths[$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($dir_req) || realpath($file_dir."\\") == realpath($dir_req)) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + + } - else + else { echo "-- File is not created --"; - unlink($file_name); + } + + unlink($file_name); } chdir($old_dir_path); @@ -60,38 +88,76 @@ rmdir($dir_name); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with relative paths *** +*** Testing tempnam() with absolute and relative paths *** -- Iteration 1 -- -File name is => %s +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s File permissions are => 100666 +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s File permissions are => 100666 +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s\tempnam_variation2\t%s File permissions are => 100666 +File created in => directory specified -- Iteration 4 -- -File name is => %s +File name is => %s\tempnam_variation2\t%s File permissions are => 100666 +File created in => directory specified -- Iteration 5 -- -File name is => %s +File name is => %s\tempnam_variation2\t%s File permissions are => 100666 +File created in => directory specified -- Iteration 6 -- -File name is => %s +File name is => %s\tempnam_variation2\t%s File permissions are => 100666 +File created in => directory specified -- Iteration 7 -- -File name is => %s +File name is => %s\t%s File permissions are => 100666 +File created in => temp dir -- Iteration 8 -- -File name is => %s +File name is => %s\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 9 -- +File name is => %s\t%s +File permissions are => 100666 +File created in => temp dir + +-- Iteration 10 -- +File name is => %s\t%s +File permissions are => 100666 +File created in => temp dir + +-- Iteration 11 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 12 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 13 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 14 -- +File name is => %s\t%s File permissions are => 100666 +File created in => temp dir -*** Done *** +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/tempnam_variation2.phpt b/ext/standard/tests/file/tempnam_variation2.phpt index 6d85e25628..b7e5cdc058 100644 --- a/ext/standard/tests/file/tempnam_variation2.phpt +++ b/ext/standard/tests/file/tempnam_variation2.phpt @@ -1,5 +1,5 @@ --TEST-- -Test tempnam() function: usage variations - relative paths +Test tempnam() function: usage variations - various absolute and relative paths --SKIPIF-- "; printf("%o", fileperms($file_name) ); echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + $dir_req = $dir_paths[$i]; + + if (realpath($file_dir) == realpath(sys_get_temp_dir())) { + echo "temp dir\n"; + } + else if ($file_dir == realpath($dir_req)) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + + } - else + else { echo "-- File is not created --"; - unlink($file_name); + } + + unlink($file_name); } chdir($old_dir_path); @@ -60,38 +88,76 @@ rmdir($dir_name); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with relative paths *** +*** Testing tempnam() with absolute and relative paths *** -- Iteration 1 -- -File name is => %s +File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => directory specified -- Iteration 4 -- -File name is => %s +File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => directory specified -- Iteration 5 -- -File name is => %s +File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => directory specified -- Iteration 6 -- -File name is => %s +File name is => %s/tempnam_variation2/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => directory specified -- Iteration 7 -- -File name is => %s +File name is => %s/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 8 -- -File name is => %s +File name is => %s/tempnam_variation2.tmp%s +File permissions are => 100600 +File created in => directory specified + +-- Iteration 9 -- +File name is => %s/tempnam_variation2.tmp%s +File permissions are => 100600 +File created in => temp dir + +-- Iteration 10 -- +File name is => %s/tempnam_variation2.tmp%s +File permissions are => 100600 +File created in => temp dir + +-- Iteration 11 -- +File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s +File permissions are => 100600 +File created in => directory specified + +-- Iteration 12 -- +File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s +File permissions are => 100600 +File created in => directory specified + +-- Iteration 13 -- +File name is => %s/tempnam_variation2/tempnam_variation2_sub/tempnam_variation2.tmp%s +File permissions are => 100600 +File created in => directory specified + +-- Iteration 14 -- +File name is => %s/tempnam_variation2.tmp%s File permissions are => 100600 +File created in => temp dir -*** Done *** +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 4e9eb76b5c..ec7718f970 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -1,9 +1,9 @@ --TEST-- -Test tempnam() function: usage variations - invalid/non-existing file +Test tempnam() function: usage variations - obscure prefixes --SKIPIF-- --FILE-- "; printf("%o", fileperms($file_name) ); echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + 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"; + } } - else + else { echo "-- File is not created --\n"; + } unlink($file_name); } +rmdir($file_path); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with invalid/non-existing file names *** +*** Testing tempnam() with obscure prefixes *** +-- Iteration 0 -- +File name is => %s\%s +File permissions are => 100666 +File created in => directory specified -- Iteration 1 -- -File name is => %s +File name is => %s\%s File permissions are => 100666 +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s\%s File permissions are => 100666 +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s\%s File permissions are => 100666 +File created in => directory specified -- Iteration 4 -- -File name is => %s +File name is => %s\%s File permissions are => 100666 +File created in => directory specified -- Iteration 5 -- -File name is => %s +File name is => %s\%s File permissions are => 100666 +File created in => directory specified -- Iteration 6 -- -File name is => %s +File name is => %s\%s File permissions are => 100666 +File created in => directory specified -- Iteration 7 -- Warning: tempnam() expects parameter 2 to be string, array given in %s on line %d -- File is not created -- -Warning: unlink(): %s in %s on line %d +Warning: unlink(): No such file or directory in %s on line %d -- Iteration 8 -- -File name is => %s +File name is => %s\di%s File permissions are => 100666 +File created in => directory specified -- Iteration 9 -- -File name is => %s +File name is => %s\ph%s File permissions are => 100666 +File created in => directory specified *** Done *** + diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index cbc8e85239..a0b9511b63 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test tempnam() function: usage variations - invalid/non-existing file +Test tempnam() function: usage variations - obscure prefixes --SKIPIF-- "; printf("%o", fileperms($file_name) ); echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + + if ($file_dir == sys_get_temp_dir()) { + echo "temp dir\n"; + } + else if ($file_dir == $file_path) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + } - else + else { echo "-- File is not created --\n"; + } unlink($file_name); } +rmdir($file_path); echo "\n*** Done ***\n"; ?> --EXPECTF-- -*** Testing tempnam() with invalid/non-existing file names *** +*** Testing tempnam() with obscure prefixes *** +-- Iteration 0 -- +File name is => %s/%s +File permissions are => 100600 +File created in => directory specified -- Iteration 1 -- -File name is => %s +File name is => %s/%s File permissions are => 100600 +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s/%s File permissions are => 100600 +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s/%s File permissions are => 100600 +File created in => directory specified -- Iteration 4 -- -File name is => %s +File name is => %s/%s File permissions are => 100600 +File created in => directory specified -- Iteration 5 -- -File name is => %s +File name is => %s/%s File permissions are => 100600 +File created in => directory specified -- Iteration 6 -- -File name is => %s +File name is => %s/%s File permissions are => 100600 +File created in => directory specified -- Iteration 7 -- Warning: tempnam() expects parameter 2 to be string, array given in %s on line %d -- File is not created -- -Warning: unlink(): %s in %s on line %d +Warning: unlink(): No such file or directory in %s on line %d -- Iteration 8 -- -File name is => %s +File name is => %s/dir%s File permissions are => 100600 +File created in => directory specified -- Iteration 9 -- -File name is => %s +File name is => %s/php%s File permissions are => 100600 +File created in => directory specified *** Done *** + diff --git a/ext/standard/tests/file/tempnam_variation4.phpt b/ext/standard/tests/file/tempnam_variation4.phpt index 491eae7343..8fec4019fc 100644 --- a/ext/standard/tests/file/tempnam_variation4.phpt +++ b/ext/standard/tests/file/tempnam_variation4.phpt @@ -20,22 +20,34 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing tempnam() with dir of permissions from 0000 to 0777 ***\n"; $file_path = dirname(__FILE__); $dir_name = $file_path."/tempnam_variation4"; +$prefix = "tempnamVar4."; + mkdir($dir_name); -for($mode = 0000; $mode<=0777; $mode++) { +for($mode = 0000; $mode <= 0777; $mode++) { echo "-- dir perms "; printf("%o", $mode); echo " --\n"; chmod($dir_name, $mode); - $file_name = tempnam($dir_name, "tempnam_variation4.tmp"); + $file_name = tempnam($dir_name, $prefix); if(file_exists($file_name) ) { - print($file_name); - echo "\n"; + if (realpath(dirname($file_name)) == realpath(sys_get_temp_dir())) { + $msg = " created in temp directory"; + } + else if (dirname($file_name) == $dir_name) { + $msg = " created in requested directory"; + } + else { + $msg = " created in unexpected directory"; + } + + echo basename($file_name).$msg."\n"; + unlink($file_name); + } + else { + print("FAILED: File is not created\n"); } - else - print("-- File is not created --"); - unlink($file_name); } rmdir($dir_name); @@ -45,1027 +57,1027 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing tempnam() with dir of permissions from 0000 to 0777 *** -- dir perms 0 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 1 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 2 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 3 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 4 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 5 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 6 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 7 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 10 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 11 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 12 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 13 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 14 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 15 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 16 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 17 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 20 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 21 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 22 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 23 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 24 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 25 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 26 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 27 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 30 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 31 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 32 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 33 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 34 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 35 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 36 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 37 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 40 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 41 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 42 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 43 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 44 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 45 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 46 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 47 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 50 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 51 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 52 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 53 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 54 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 55 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 56 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 57 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 60 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 61 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 62 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 63 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 64 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 65 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 66 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 67 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 70 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 71 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 72 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 73 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 74 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 75 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 76 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 77 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 100 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 101 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 102 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 103 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 104 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 105 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 106 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 107 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 110 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 111 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 112 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 113 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 114 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 115 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 116 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 117 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 120 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 121 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 122 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 123 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 124 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 125 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 126 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 127 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 130 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 131 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 132 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 133 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 134 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 135 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 136 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 137 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 140 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 141 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 142 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 143 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 144 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 145 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 146 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 147 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 150 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 151 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 152 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 153 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 154 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 155 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 156 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 157 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 160 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 161 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 162 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 163 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 164 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 165 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 166 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 167 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 170 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 171 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 172 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 173 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 174 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 175 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 176 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 177 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 200 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 201 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 202 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 203 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 204 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 205 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 206 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 207 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 210 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 211 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 212 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 213 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 214 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 215 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 216 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 217 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 220 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 221 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 222 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 223 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 224 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 225 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 226 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 227 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 230 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 231 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 232 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 233 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 234 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 235 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 236 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 237 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 240 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 241 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 242 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 243 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 244 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 245 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 246 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 247 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 250 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 251 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 252 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 253 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 254 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 255 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 256 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 257 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 260 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 261 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 262 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 263 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 264 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 265 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 266 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 267 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 270 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 271 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 272 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 273 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 274 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 275 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 276 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 277 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 300 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 301 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 302 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 303 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 304 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 305 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 306 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 307 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 310 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 311 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 312 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 313 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 314 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 315 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 316 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 317 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 320 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 321 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 322 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 323 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 324 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 325 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 326 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 327 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 330 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 331 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 332 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 333 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 334 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 335 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 336 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 337 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 340 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 341 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 342 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 343 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 344 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 345 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 346 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 347 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 350 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 351 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 352 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 353 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 354 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 355 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 356 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 357 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 360 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 361 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 362 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 363 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 364 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 365 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 366 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 367 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 370 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 371 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 372 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 373 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 374 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 375 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 376 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 377 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 400 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 401 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 402 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 403 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 404 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 405 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 406 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 407 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 410 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 411 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 412 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 413 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 414 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 415 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 416 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 417 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 420 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 421 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 422 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 423 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 424 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 425 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 426 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 427 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 430 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 431 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 432 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 433 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 434 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 435 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 436 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 437 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 440 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 441 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 442 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 443 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 444 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 445 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 446 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 447 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 450 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 451 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 452 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 453 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 454 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 455 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 456 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 457 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 460 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 461 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 462 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 463 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 464 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 465 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 466 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 467 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 470 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 471 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 472 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 473 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 474 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 475 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 476 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 477 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 500 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 501 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 502 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 503 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 504 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 505 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 506 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 507 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 510 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 511 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 512 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 513 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 514 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 515 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 516 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 517 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 520 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 521 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 522 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 523 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 524 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 525 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 526 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 527 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 530 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 531 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 532 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 533 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 534 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 535 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 536 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 537 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 540 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 541 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 542 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 543 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 544 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 545 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 546 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 547 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 550 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 551 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 552 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 553 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 554 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 555 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 556 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 557 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 560 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 561 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 562 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 563 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 564 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 565 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 566 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 567 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 570 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 571 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 572 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 573 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 574 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 575 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 576 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 577 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 600 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 601 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 602 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 603 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 604 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 605 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 606 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 607 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 610 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 611 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 612 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 613 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 614 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 615 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 616 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 617 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 620 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 621 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 622 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 623 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 624 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 625 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 626 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 627 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 630 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 631 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 632 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 633 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 634 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 635 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 636 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 637 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 640 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 641 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 642 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 643 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 644 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 645 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 646 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 647 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 650 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 651 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 652 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 653 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 654 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 655 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 656 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 657 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 660 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 661 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 662 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 663 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 664 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 665 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 666 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 667 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 670 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 671 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 672 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 673 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 674 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 675 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 676 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 677 -- -%s +tempnamVar4.%s created in temp directory -- dir perms 700 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 701 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 702 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 703 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 704 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 705 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 706 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 707 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 710 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 711 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 712 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 713 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 714 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 715 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 716 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 717 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 720 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 721 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 722 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 723 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 724 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 725 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 726 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 727 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 730 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 731 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 732 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 733 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 734 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 735 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 736 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 737 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 740 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 741 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 742 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 743 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 744 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 745 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 746 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 747 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 750 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 751 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 752 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 753 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 754 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 755 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 756 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 757 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 760 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 761 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 762 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 763 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 764 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 765 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 766 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 767 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 770 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 771 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 772 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 773 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 774 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 775 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 776 -- -%s +tempnamVar4.%s created in requested directory -- dir perms 777 -- -%s -*** Done *** +tempnamVar4.%s created in requested directory +*** Done *** \ No newline at end of file diff --git a/ext/standard/tests/file/tempnam_variation5-win32.phpt b/ext/standard/tests/file/tempnam_variation5-win32.phpt new file mode 100644 index 0000000000..3e39352fe1 --- /dev/null +++ b/ext/standard/tests/file/tempnam_variation5-win32.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test tempnam() function: usage variations - existing file +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + print($created_file); + echo "\n"; + } + else + print("File is not created"); + + unlink($created_file); +} +fclose($h); +unlink($dir_name."/tempnam_variation6.tmp"); +rmdir($dir_name); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Test tempnam() function: by passing an existing filename as prefix *** +-- Iteration 1 -- +File name is => %stempnam_variation6%et%s +-- Iteration 2 -- +File name is => %stempnam_variation6%et%s +-- Iteration 3 -- +File name is => %stempnam_variation6%et%s + +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation5.phpt b/ext/standard/tests/file/tempnam_variation5.phpt index 2d5f53dcd3..26c3f91f1f 100644 --- a/ext/standard/tests/file/tempnam_variation5.phpt +++ b/ext/standard/tests/file/tempnam_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- Test tempnam() function: usage variations - existing file +--SKIPIF-- + --FILE-- %s +File name is => %stempnam_variation6%etempnam_variation6.tmp%s -- Iteration 2 -- -File name is => %s +File name is => %stempnam_variation6%etempnam_variation6.tmp%s -- Iteration 3 -- -File name is => %s +File name is => %stempnam_variation6%etempnam_variation6.tmp%s *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation6-win32.phpt b/ext/standard/tests/file/tempnam_variation6-win32.phpt new file mode 100644 index 0000000000..efe7e86e85 --- /dev/null +++ b/ext/standard/tests/file/tempnam_variation6-win32.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test tempnam() function: usage variations - Using previous unique filename +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + print($file_name); + echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + + if ($file_dir == sys_get_temp_dir()) { + echo "temp dir\n"; + } + else if ($file_dir == $file_path) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + } + + unlink($file_name); +} + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Test tempnam(): by passing previously created filenames *** +-- Iteration 1 -- +File name is => %s%et%s +File created in => directory specified +-- Iteration 2 -- +File name is => %s%et%s +File created in => directory specified +-- Iteration 3 -- +File name is => %s%et%s +File created in => directory specified + +*** Done *** diff --git a/ext/standard/tests/file/tempnam_variation6.phpt b/ext/standard/tests/file/tempnam_variation6.phpt index 51ecde9a73..5eb6e6fc86 100644 --- a/ext/standard/tests/file/tempnam_variation6.phpt +++ b/ext/standard/tests/file/tempnam_variation6.phpt @@ -1,5 +1,10 @@ --TEST-- -Test tempnam() function: usage variations - Using previous unique filename +Test tempnam() function: usage variations - Using previous unique filename +--SKIPIF-- + --FILE-- "; print($file_name); echo "\n"; - } + + echo "File created in => "; + $file_dir = dirname($file_name); + + if ($file_dir == sys_get_temp_dir()) { + echo "temp dir\n"; + } + else if ($file_dir == $file_path) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + } unlink($file_name); } @@ -30,10 +48,13 @@ echo "\n*** Done ***\n"; --EXPECTF-- *** Test tempnam(): by passing previously created filenames *** -- Iteration 1 -- -File name is => %s +File name is => %s%etempnam_variation6.tmp%s +File created in => directory specified -- Iteration 2 -- -File name is => %s +File name is => %s%etempnam_variation6.tmp%s +File created in => directory specified -- Iteration 3 -- -File name is => %s +File name is => %s%etempnam_variation6.tmp%s +File created in => directory specified *** Done *** diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 486240146f..5096934e03 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -3,7 +3,7 @@ Test tempnam() function: usage variations - invalid/non-existing dir --SKIPIF-- --FILE-- "; printf("%o", fileperms($file_name) ); echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) { + echo "temp dir\n"; + } + else { + echo "unknown location\n"; + } } - else + else { echo "-- File is not created --\n"; + } unlink($file_name); } @@ -59,24 +67,34 @@ echo "\n*** Done ***\n"; ?> --EXPECTF-- *** Testing tempnam() with invalid/non-existing directory names *** +-- Iteration 0 -- +File name is => %s%et%s +File permissions are => 100666 +File created in => temp dir -- Iteration 1 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 2 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 3 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 4 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 5 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 6 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 7 -- Warning: tempnam() expects parameter 1 to be string, array given in %s on line %d @@ -84,10 +102,13 @@ Warning: tempnam() expects parameter 1 to be string, array given in %s on line % Warning: unlink(): No such file or directory in %s on line %d -- Iteration 8 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir -- Iteration 9 -- -File name is => %s +File name is => %s%et%s File permissions are => 100666 +File created in => temp dir *** Done *** + diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index ebecd1601f..0e314dabe3 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -3,7 +3,7 @@ Test tempnam() function: usage variations - invalid/non-existing dir --SKIPIF-- --FILE-- "; printf("%o", fileperms($file_name) ); echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + + if (realpath($file_dir) == realpath(sys_get_temp_dir())) { + echo "temp dir\n"; + } + else { + echo "unknown location\n"; + } + } - else + else { echo "-- File is not created --\n"; + } unlink($file_name); } @@ -59,24 +69,34 @@ echo "\n*** Done ***\n"; ?> --EXPECTF-- *** Testing tempnam() with invalid/non-existing directory names *** +-- Iteration 0 -- +File name is => %s%etempnam_variation3.tmp%s +File permissions are => 100600 +File created in => temp dir -- Iteration 1 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 2 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 3 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 4 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 5 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 6 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 7 -- Warning: tempnam() expects parameter 1 to be string, array given in %s on line %d @@ -84,10 +104,13 @@ Warning: tempnam() expects parameter 1 to be string, array given in %s on line % Warning: unlink(): No such file or directory in %s on line %d -- Iteration 8 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir -- Iteration 9 -- -File name is => %s +File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 +File created in => temp dir *** Done *** + diff --git a/ext/standard/tests/file/tempnam_variation8-win32.phpt b/ext/standard/tests/file/tempnam_variation8-win32.phpt new file mode 100644 index 0000000000..8df67b609e --- /dev/null +++ b/ext/standard/tests/file/tempnam_variation8-win32.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test tempnam() function: usage variations - various absolute and relative paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + "; + print(realpath($file_name)); + echo "\n"; + + echo "File permissions are => "; + printf("%o", fileperms($file_name) ); + echo "\n"; + + echo "File created in => "; + $file_dir = dirname($file_name); + $dir_req = $dir_paths[$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($dir_req) || realpath($file_dir."\\") == realpath($dir_req)) { + echo "directory specified\n"; + } + else { + echo "unknown location\n"; + } + + + } + else { + echo "-- File is not created --"; + } + + unlink($file_name); +} + +chdir($old_dir_path); +rmdir($dir_path); +rmdir($dir_name); + +echo "\n*** Done ***\n"; +?> +--EXPECTF-- +*** Testing tempnam() with absolute and relative paths *** + +-- Iteration 1 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 2 -- +File name is => %s\tempnam_variation2\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 3 -- +File name is => %s\tempnam_variation2\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 4 -- +File name is => %s\tempnam_variation2\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 5 -- +File name is => %s\tempnam_variation2\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 6 -- +File name is => %s\t%s +File permissions are => 100666 +File created in => temp dir + +-- Iteration 7 -- +File name is => %s\t%s +File permissions are => 100666 +File created in => temp dir + +-- Iteration 8 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 9 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 10 -- +File name is => %s\tempnam_variation2\tempnam_variation2_sub\t%s +File permissions are => 100666 +File created in => directory specified + +-- Iteration 11 -- +File name is => %s\t%s +File permissions are => 100666 +File created in => temp dir + +*** Done *** diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt index aea68b0d44..c6c270d065 100644 --- a/ext/standard/tests/file/touch.phpt +++ b/ext/standard/tests/file/touch.phpt @@ -1,8 +1,16 @@ --TEST-- touch() tests +--SKIPIF-- + --FILE-- +--XFAIL-- +--SKIPIF-- + +--FILE-- + +--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_basic.phpt b/ext/standard/tests/file/touch_basic.phpt new file mode 100644 index 0000000000..fb042df674 --- /dev/null +++ b/ext/standard/tests/file/touch_basic.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test touch() function : basic functionality +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--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 +stat data differs at ctime + + --- testing touch using all parameters --- +bool(true) +ctime=%d +mtime=10000 +atime=20470 +Done diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt new file mode 100644 index 0000000000..ec58fee511 --- /dev/null +++ b/ext/standard/tests/file/touch_error.phpt @@ -0,0 +1,22 @@ +--TEST-- +touch() error tests +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECTF-- +Warning: touch() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: touch() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d +bool(false) + diff --git a/ext/standard/tests/file/touch_variation1.phpt b/ext/standard/tests/file/touch_variation1.phpt new file mode 100644 index 0000000000..dba41a6077 --- /dev/null +++ b/ext/standard/tests/file/touch_variation1.phpt @@ -0,0 +1,39 @@ +--TEST-- +touch() with times +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +int(101) +int(101) +bool(true) +int(100) +int(102) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/touch_variation2.phpt b/ext/standard/tests/file/touch_variation2.phpt new file mode 100644 index 0000000000..9ccb90c751 --- /dev/null +++ b/ext/standard/tests/file/touch_variation2.phpt @@ -0,0 +1,24 @@ +--TEST-- +touch() - ensure touch does not delete existing file. +--CREDITS-- +Dave Kelsey +--FILE-- + +--EXPECT-- +bool(true) +string(6) "mydata" +Done diff --git a/ext/standard/tests/file/touch_variation3-win32.phpt b/ext/standard/tests/file/touch_variation3-win32.phpt new file mode 100644 index 0000000000..43556b8106 --- /dev/null +++ b/ext/standard/tests/file/touch_variation3-win32.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test touch() function : usage variation - different types for time +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 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 long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - touch() expects parameter 2 to be long, 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 long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - touch() expects parameter 2 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - touch() expects parameter 2 to be long, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/touch_variation3.phpt b/ext/standard/tests/file/touch_variation3.phpt new file mode 100644 index 0000000000..810cd71ef6 --- /dev/null +++ b/ext/standard/tests/file/touch_variation3.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test touch() function : usage variation - different types for time +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 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 long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - touch() expects parameter 2 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - touch() expects parameter 2 to be long, 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 long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - touch() expects parameter 2 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - touch() expects parameter 2 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - touch() expects parameter 2 to be long, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/touch_variation4-win32.phpt b/ext/standard/tests/file/touch_variation4-win32.phpt new file mode 100644 index 0000000000..ee2639a477 --- /dev/null +++ b/ext/standard/tests/file/touch_variation4-win32.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test touch() function : usage variation - different types for atime +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 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 atime + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( touch($filename, $time, $value) ); +}; + +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 3 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - touch() expects parameter 3 to be long, 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 3 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/touch_variation4.phpt b/ext/standard/tests/file/touch_variation4.phpt new file mode 100644 index 0000000000..b0238b1759 --- /dev/null +++ b/ext/standard/tests/file/touch_variation4.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test touch() function : usage variation - different types for atime +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 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 atime + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( touch($filename, $time, $value) ); +}; + +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 3 to be long, array given, %s(%d) +NULL + +--int indexed array-- +Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d) +NULL + +--associative array-- +Error: 2 - touch() expects parameter 3 to be long, array given, %s(%d) +NULL + +--nested arrays-- +Error: 2 - touch() expects parameter 3 to be long, 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 3 to be long, string given, %s(%d) +NULL + +--empty string SQ-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--string DQ-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--string SQ-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--mixed case string-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--heredoc-- +Error: 2 - touch() expects parameter 3 to be long, string given, %s(%d) +NULL + +--instance of classWithToString-- +Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d) +NULL + +--instance of classWithoutToString-- +Error: 2 - touch() expects parameter 3 to be long, object given, %s(%d) +NULL + +--undefined var-- +bool(true) + +--unset var-- +bool(true) +===DONE=== + diff --git a/ext/standard/tests/file/touch_variation5-win32.phpt b/ext/standard/tests/file/touch_variation5-win32.phpt new file mode 100644 index 0000000000..6b7bde4c4a --- /dev/null +++ b/ext/standard/tests/file/touch_variation5-win32.phpt @@ -0,0 +1,249 @@ +--TEST-- +Test touch() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +===DONE=== +--EXPECTF-- +*** Testing touch() : variation *** + +*** testing nonexisting paths *** +--- testing touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/aSubDirOrFile - created +--- testing ./touchVar5.tmp/aSubDirOrFile --- +PASSED: ./touchVar5.tmp/aSubDirOrFile - created +--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created +--- testing touchVar5.tmp/../BADDIR/aSubDirOrFile --- + +Warning: touch(): Unable to create file touchVar5.tmp/../BADDIR/aSubDirOrFile because %s in %s on line %d +--- testing BADDIR/aSubDirOrFile --- + +Warning: touch(): Unable to create file BADDIR/aSubDirOrFile because %s in %s on line %d +--- testing %s/touchVar5.tmp/aSubDirOrFile --- +PASSED: %s/touchVar5.tmp/aSubDirOrFile - created +--- testing %s/./touchVar5.tmp/aSubDirOrFile --- +PASSED: %s/./touchVar5.tmp/aSubDirOrFile - created +--- testing %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created +--- testing %s/BADDIR/aSubDirOrFile --- + +Warning: touch(): Unable to create file %s/BADDIR/aSubDirOrFile because %s in %s on line %d +--- testing touchVar5.tmp/aSubDirOrFile/ --- + +Warning: touch(): Unable to create file touchVar5.tmp/aSubDirOrFile/ because Invalid argument in %s on line %d +--- testing %s/touchVar5.tmp/aSubDirOrFile/ --- + +Warning: touch(): Unable to create file %s/touchVar5.tmp/aSubDirOrFile/ because Invalid argument in %s on line %d +--- testing touchVar5.tmp//aSubDirOrFile --- +PASSED: touchVar5.tmp//aSubDirOrFile - created +--- testing %s//touchVar5.tmp//aSubDirOrFile --- +PASSED: %s//touchVar5.tmp//aSubDirOrFile - created + +*** testing existing files *** +--- testing touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/aSubDirOrFile - touched +--- testing ./touchVar5.tmp/aSubDirOrFile --- +PASSED: ./touchVar5.tmp/aSubDirOrFile - touched +--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched +--- testing %s/touchVar5.tmp/aSubDirOrFile --- +PASSED: %s/touchVar5.tmp/aSubDirOrFile - touched +--- testing %s/./touchVar5.tmp/aSubDirOrFile --- +PASSED: %s/./touchVar5.tmp/aSubDirOrFile - touched +--- testing %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched +--- testing touchVar5.tmp//aSubDirOrFile --- +PASSED: touchVar5.tmp//aSubDirOrFile - touched +--- testing %s//touchVar5.tmp//aSubDirOrFile --- +PASSED: %s//touchVar5.tmp//aSubDirOrFile - touched + +*** testing existing directories *** +--- testing touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp/aSubDirOrFile - access time not changed +--- testing ./touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: ./touchVar5.tmp/aSubDirOrFile - access time not changed +--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - access time not changed +--- testing %s/touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s/touchVar5.tmp/aSubDirOrFile - access time not changed +--- testing %s/./touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s/./touchVar5.tmp/aSubDirOrFile - access time not changed +--- testing %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - access time not changed +--- testing touchVar5.tmp/aSubDirOrFile/ --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp/aSubDirOrFile/ - access time not changed +--- testing %s/touchVar5.tmp/aSubDirOrFile/ --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s/touchVar5.tmp/aSubDirOrFile/ - access time not changed +--- testing touchVar5.tmp//aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp//aSubDirOrFile - access time not changed +--- testing %s//touchVar5.tmp//aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s//touchVar5.tmp//aSubDirOrFile - access time not changed +===DONE=== + diff --git a/ext/standard/tests/file/touch_variation5.phpt b/ext/standard/tests/file/touch_variation5.phpt new file mode 100644 index 0000000000..f0e1f78691 --- /dev/null +++ b/ext/standard/tests/file/touch_variation5.phpt @@ -0,0 +1,230 @@ +--TEST-- +Test touch() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing touch() : variation *** + +*** testing nonexisting paths *** +--- testing touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/aSubDirOrFile - created +--- testing ./touchVar5.tmp/aSubDirOrFile --- +PASSED: ./touchVar5.tmp/aSubDirOrFile - created +--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created +--- testing touchVar5.tmp/../BADDIR/aSubDirOrFile --- + +Warning: touch(): Unable to create file touchVar5.tmp/../BADDIR/aSubDirOrFile because %s in %s on line %d +--- testing BADDIR/aSubDirOrFile --- + +Warning: touch(): Unable to create file BADDIR/aSubDirOrFile because %s in %s on line %d +--- testing /%s/touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/aSubDirOrFile - created +--- testing /%s/./touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/./touchVar5.tmp/aSubDirOrFile - created +--- testing /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created +--- testing /%s/BADDIR/aSubDirOrFile --- + +Warning: touch(): Unable to create file /%s/BADDIR/aSubDirOrFile because %s in %s on line %d +--- testing touchVar5.tmp/aSubDirOrFile/ --- + +Warning: touch(): Unable to create file touchVar5.tmp/aSubDirOrFile/ because Is a directory in %s on line %d +--- testing /%s/touchVar5.tmp/aSubDirOrFile/ --- + +Warning: touch(): Unable to create file /%s/touchVar5.tmp/aSubDirOrFile/ because Is a directory in %s on line %d +--- testing touchVar5.tmp//aSubDirOrFile --- +PASSED: touchVar5.tmp//aSubDirOrFile - created +--- testing /%s//touchVar5.tmp//aSubDirOrFile --- +PASSED: /%s//touchVar5.tmp//aSubDirOrFile - created + +*** testing existing files *** +--- testing touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/aSubDirOrFile - touched +--- testing ./touchVar5.tmp/aSubDirOrFile --- +PASSED: ./touchVar5.tmp/aSubDirOrFile - touched +--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched +--- testing /%s/touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched +--- testing /%s/./touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/./touchVar5.tmp/aSubDirOrFile - touched +--- testing /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched +--- testing touchVar5.tmp//aSubDirOrFile --- +PASSED: touchVar5.tmp//aSubDirOrFile - touched +--- testing /%s//touchVar5.tmp//aSubDirOrFile --- +PASSED: /%s//touchVar5.tmp//aSubDirOrFile - touched + +*** testing existing directories *** +--- testing touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/aSubDirOrFile - touched +--- testing ./touchVar5.tmp/aSubDirOrFile --- +PASSED: ./touchVar5.tmp/aSubDirOrFile - touched +--- testing touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched +--- testing /%s/touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched +--- testing /%s/./touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/./touchVar5.tmp/aSubDirOrFile - touched +--- testing /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - touched +--- testing touchVar5.tmp/aSubDirOrFile/ --- +PASSED: touchVar5.tmp/aSubDirOrFile/ - touched +--- testing /%s/touchVar5.tmp/aSubDirOrFile/ --- +PASSED: /%s/touchVar5.tmp/aSubDirOrFile/ - touched +--- testing touchVar5.tmp//aSubDirOrFile --- +PASSED: touchVar5.tmp//aSubDirOrFile - touched +--- testing /%s//touchVar5.tmp//aSubDirOrFile --- +PASSED: /%s//touchVar5.tmp//aSubDirOrFile - touched +===DONE=== + diff --git a/ext/standard/tests/file/touch_variation6-win32.phpt b/ext/standard/tests/file/touch_variation6-win32.phpt new file mode 100644 index 0000000000..8c87d49048 --- /dev/null +++ b/ext/standard/tests/file/touch_variation6-win32.phpt @@ -0,0 +1,263 @@ +--TEST-- +Test touch() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing touch() : variation *** + +*** testing nonexisting paths *** +--- testing touchVar5.tmp\aSubDirOrFile --- +PASSED: touchVar5.tmp\aSubDirOrFile - created +--- testing .\touchVar5.tmp\aSubDirOrFile --- +PASSED: .\touchVar5.tmp\aSubDirOrFile - created +--- testing touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile --- +PASSED: touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - created +--- testing touchVar5.tmp\..\BADDIR\aSubDirOrFile --- + +Warning: touch(): Unable to create file touchVar5.tmp\..\BADDIR\aSubDirOrFile because %s in %s on line %d +--- testing BADDIR\aSubDirOrFile --- + +Warning: touch(): Unable to create file BADDIR\aSubDirOrFile because %s in %s on line %d +--- testing %s\touchVar5.tmp\aSubDirOrFile --- +PASSED: %s\touchVar5.tmp\aSubDirOrFile - created +--- testing %s\.\touchVar5.tmp\aSubDirOrFile --- +PASSED: %s\.\touchVar5.tmp\aSubDirOrFile - created +--- testing %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile --- +PASSED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - created +--- testing %s\BADDIR\aSubDirOrFile --- + +Warning: touch(): Unable to create file %s\BADDIR\aSubDirOrFile because %s in %s on line %d +--- testing touchVar5.tmp\aSubDirOrFile\ --- + +Warning: touch(): Unable to create file touchVar5.tmp\aSubDirOrFile\ because Invalid argument in %s on line %d +--- testing %s\touchVar5.tmp\aSubDirOrFile\ --- + +Warning: touch(): Unable to create file %s\touchVar5.tmp\aSubDirOrFile\ because Invalid argument in %s on line %d +--- testing touchVar5.tmp\\aSubDirOrFile --- +PASSED: touchVar5.tmp\\aSubDirOrFile - created +--- testing %s\\touchVar5.tmp\\aSubDirOrFile --- +PASSED: %s\\touchVar5.tmp\\aSubDirOrFile - created +--- testing /%s/touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/aSubDirOrFile - created + +*** testing existing files *** +--- testing touchVar5.tmp\aSubDirOrFile --- +PASSED: touchVar5.tmp\aSubDirOrFile - touched +--- testing .\touchVar5.tmp\aSubDirOrFile --- +PASSED: .\touchVar5.tmp\aSubDirOrFile - touched +--- testing touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile --- +PASSED: touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - touched +--- testing %s\touchVar5.tmp\aSubDirOrFile --- +PASSED: %s\touchVar5.tmp\aSubDirOrFile - touched +--- testing %s\.\touchVar5.tmp\aSubDirOrFile --- +PASSED: %s\.\touchVar5.tmp\aSubDirOrFile - touched +--- testing %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile --- +PASSED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - touched +--- testing touchVar5.tmp\\aSubDirOrFile --- +PASSED: touchVar5.tmp\\aSubDirOrFile - touched +--- testing %s\\touchVar5.tmp\\aSubDirOrFile --- +PASSED: %s\\touchVar5.tmp\\aSubDirOrFile - touched +--- testing /%s/touchVar5.tmp/aSubDirOrFile --- +PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched + +*** testing existing directories *** +--- testing touchVar5.tmp\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp\aSubDirOrFile - access time not changed +--- testing .\touchVar5.tmp\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: .\touchVar5.tmp\aSubDirOrFile - access time not changed +--- testing touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - access time not changed +--- testing %s\touchVar5.tmp\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s\touchVar5.tmp\aSubDirOrFile - access time not changed +--- testing %s\.\touchVar5.tmp\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s\.\touchVar5.tmp\aSubDirOrFile - access time not changed +--- testing %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - access time not changed +--- testing touchVar5.tmp\aSubDirOrFile\ --- + +Warning: touch(): Utime failed: No such file or directory in %s on line %d +FAILED: touchVar5.tmp\aSubDirOrFile\ - access time not changed +--- testing %s\touchVar5.tmp\aSubDirOrFile\ --- + +Warning: touch(): Utime failed: No such file or directory in %s on line %d +FAILED: %s\touchVar5.tmp\aSubDirOrFile\ - access time not changed +--- testing touchVar5.tmp\\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: touchVar5.tmp\\aSubDirOrFile - access time not changed +--- testing %s\\touchVar5.tmp\\aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: %s\\touchVar5.tmp\\aSubDirOrFile - access time not changed +--- testing /%s/touchVar5.tmp/aSubDirOrFile --- + +Warning: touch(): Utime failed: Permission denied in %s on line %d +FAILED: /%s/touchVar5.tmp/aSubDirOrFile - access time not changed +===DONE=== + diff --git a/ext/standard/tests/file/umask_variation3.phpt b/ext/standard/tests/file/umask_variation3.phpt new file mode 100644 index 0000000000..1483dc430e --- /dev/null +++ b/ext/standard/tests/file/umask_variation3.phpt @@ -0,0 +1,237 @@ +--TEST-- +Test umask() function : usage variation +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + //out of boundary integers + 'int -100' => -100, + 'int 99999' => 99999, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + //'float -12.3456789000e10' => -12.3456789000e10, different in p8 + '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 mask + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + umask(0); + var_dump(umask($value)); + var_dump( umask()); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing umask() : usage variation *** + +--int -100-- +int(0) +int(412) + +--int 99999-- +int(0) +int(159) + +--float 10.5-- +int(0) +int(10) + +--float -10.5-- +int(0) +int(502) + +--float 12.3456789000e10-- +int(0) +int(%d) + +--float .5-- +int(0) +int(0) + +--empty array-- +Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d) +bool(false) +int(63) + +--int indexed array-- +Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d) +bool(false) +int(63) + +--associative array-- +Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d) +bool(false) +int(63) + +--nested arrays-- +Error: 2 - umask() expects parameter 1 to be long, array given, %s(%d) +bool(false) +int(63) + +--uppercase NULL-- +int(0) +int(0) + +--lowercase null-- +int(0) +int(0) + +--lowercase true-- +int(0) +int(1) + +--lowercase false-- +int(0) +int(0) + +--uppercase TRUE-- +int(0) +int(1) + +--uppercase FALSE-- +int(0) +int(0) + +--empty string DQ-- +Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d) +bool(false) +int(63) + +--empty string SQ-- +Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d) +bool(false) +int(63) + +--string DQ-- +Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d) +bool(false) +int(63) + +--string SQ-- +Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d) +bool(false) +int(63) + +--mixed case string-- +Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d) +bool(false) +int(63) + +--heredoc-- +Error: 2 - umask() expects parameter 1 to be long, string given, %s(%d) +bool(false) +int(63) + +--instance of classWithToString-- +Error: 2 - umask() expects parameter 1 to be long, object given, %s(%d) +bool(false) +int(63) + +--instance of classWithoutToString-- +Error: 2 - umask() expects parameter 1 to be long, object given, %s(%d) +bool(false) +int(63) + +--undefined var-- +int(0) +int(0) + +--unset var-- +int(0) +int(0) +===DONE=== + diff --git a/ext/standard/tests/file/unlink_variation10.phpt b/ext/standard/tests/file/unlink_variation10.phpt new file mode 100644 index 0000000000..e0c92caeba --- /dev/null +++ b/ext/standard/tests/file/unlink_variation10.phpt @@ -0,0 +1,106 @@ +--TEST-- +Test unlink() function : variation: unlinking directories +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unlink() : variation *** +-- unlinking soft link unlinkVar8.tmp/subDir.tmp -- +directory unlinked +-- unlinking soft link ./unlinkVar8.tmp/subDir.tmp -- +directory unlinked +-- unlinking soft link unlinkVar8.tmp/../unlinkVar8.tmp/subDir.tmp -- +directory unlinked +-- unlinking soft link /%s/unlinkVar8.tmp/subDir.tmp -- +directory unlinked +-- unlinking soft link /%s/./unlinkVar8.tmp/subDir.tmp -- +directory unlinked +-- unlinking soft link /%s/unlinkVar8.tmp/../unlinkVar8.tmp/subDir.tmp -- +directory unlinked +-- unlinking soft link unlinkVar8.tmp//subDir.tmp -- +directory unlinked +-- unlinking soft link /%s//unlinkVar8.tmp//subDir.tmp -- +directory unlinked + +--- try to unlink a directory --- + +Warning: unlink(unlinkVar8.tmp/linkme.tmp): %s in %s on line %d +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/unlink_variation6.phpt b/ext/standard/tests/file/unlink_variation6.phpt new file mode 100644 index 0000000000..ede9ada092 --- /dev/null +++ b/ext/standard/tests/file/unlink_variation6.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test unlink() function : variation +--CREDITS-- +Dave Kelsey +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unlink() : variation: contexts and relative files *** +subdir/testfile.txt exists +bool(true) +subdir/testfile.txt doesn't exist +===DONE=== diff --git a/ext/standard/tests/file/unlink_variation7.phpt b/ext/standard/tests/file/unlink_variation7.phpt new file mode 100644 index 0000000000..4c63e11c85 --- /dev/null +++ b/ext/standard/tests/file/unlink_variation7.phpt @@ -0,0 +1,246 @@ +--TEST-- +Test unlink() function : usage variation different types for context +--CREDITS-- +Dave Kelsey +--FILE-- + 1, 'two' => 2); + +//array of values to iterate over +$inputs = array( + + // int data + 'int 0' => 0, + 'int 1' => 1, + 'int 12345' => 12345, + 'int -12345' => -2345, + + // float data + 'float 10.5' => 10.5, + 'float -10.5' => -10.5, + 'float 12.3456789000e10' => 12.3456789000e10, + 'float -12.3456789000e10' => -12.3456789000e10, + 'float .5' => .5, + + // array data + 'empty array' => array(), + 'int indexed array' => $index_array, + 'associative array' => $assoc_array, + 'nested arrays' => array('foo', $index_array, $assoc_array), + + // null data + 'uppercase NULL' => NULL, + 'lowercase null' => null, + + // boolean data + 'lowercase true' => true, + 'lowercase false' =>false, + 'uppercase TRUE' =>TRUE, + 'uppercase FALSE' =>FALSE, + + // empty data + 'empty string DQ' => "", + 'empty string SQ' => '', + + // string data + 'string DQ' => "string", + 'string SQ' => 'string', + 'mixed case string' => "sTrInG", + 'heredoc' => $heredoc, + + // object data + 'instance of classWithToString' => new classWithToString(), + 'instance of classWithoutToString' => new classWithoutToString(), + + // undefined data + 'undefined var' => @$undefined_var, + + // unset data + 'unset var' => @$unset_var, + + // file resource + 'file resource' => $fileRes +); + +// loop through each element of the array for context + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + touch($filename); // create if it doesn't exist + var_dump( unlink($filename, $value) ); +}; + +if (file_exists($filename)) { + unlink($filename); +} +fclose($fileRes); + +?> +===DONE=== +--EXPECTF-- +*** Testing unlink() : usage variation different types for context *** + +--int 0-- +Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--int 1-- +Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--int 12345-- +Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--int -12345-- +Error: 2 - unlink() expects parameter 2 to be resource, integer given, %s(%d) +bool(false) + +--float 10.5-- +Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float -10.5-- +Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float 12.3456789000e10-- +Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float -12.3456789000e10-- +Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--float .5-- +Error: 2 - unlink() expects parameter 2 to be resource, double given, %s(%d) +bool(false) + +--empty array-- +Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--int indexed array-- +Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--associative array-- +Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--nested arrays-- +Error: 2 - unlink() expects parameter 2 to be resource, array given, %s(%d) +bool(false) + +--uppercase NULL-- +Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--lowercase null-- +Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--lowercase true-- +Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--lowercase false-- +Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase TRUE-- +Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--uppercase FALSE-- +Error: 2 - unlink() expects parameter 2 to be resource, boolean given, %s(%d) +bool(false) + +--empty string DQ-- +Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--empty string SQ-- +Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--string DQ-- +Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--string SQ-- +Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--mixed case string-- +Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--heredoc-- +Error: 2 - unlink() expects parameter 2 to be resource, string given, %s(%d) +bool(false) + +--instance of classWithToString-- +Error: 2 - unlink() expects parameter 2 to be resource, object given, %s(%d) +bool(false) + +--instance of classWithoutToString-- +Error: 2 - unlink() expects parameter 2 to be resource, object given, %s(%d) +bool(false) + +--undefined var-- +Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--unset var-- +Error: 2 - unlink() expects parameter 2 to be resource, null given, %s(%d) +bool(false) + +--file resource-- +Error: 2 - unlink(): supplied resource is not a valid Stream-Context resource, %s(%d) +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/unlink_variation8-win32.phpt b/ext/standard/tests/file/unlink_variation8-win32.phpt new file mode 100644 index 0000000000..5348676e40 --- /dev/null +++ b/ext/standard/tests/file/unlink_variation8-win32.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test unlink() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unlink() : variation *** +-- removing unlinkVar8.tmp/file.tmp -- +file removed +-- removing ./unlinkVar8.tmp/file.tmp -- +file removed +-- removing unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file removed +-- removing unlinkVar8.tmp/../BADDIR/file.tmp -- + +Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d +-- removing BADDIR/file.tmp -- + +Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d +-- removing %s/unlinkVar8.tmp/file.tmp -- +file removed +-- removing %s/./unlinkVar8.tmp/file.tmp -- +file removed +-- removing %s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file removed +-- removing %s/BADDIR/file.tmp -- + +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 +-- removing %s/unlinkVar8.tmp/file.tmp/ -- + +Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): Invalid argument in %s on line %d +-- removing unlinkVar8.tmp//file.tmp -- +file removed +-- removing %s//unlinkVar8.tmp//file.tmp -- +file removed +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/unlink_variation8.phpt b/ext/standard/tests/file/unlink_variation8.phpt new file mode 100644 index 0000000000..e87a584f5b --- /dev/null +++ b/ext/standard/tests/file/unlink_variation8.phpt @@ -0,0 +1,206 @@ +--TEST-- +Test unlink() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unlink() : variation *** +-- removing unlinkVar8.tmp/file.tmp -- +file removed +-- unlinking soft link unlinkVar8.tmp/file.tmp -- +file unlinked +-- unlinking hard link unlinkVar8.tmp/file.tmp -- +file unlinked +-- removing ./unlinkVar8.tmp/file.tmp -- +file removed +-- unlinking soft link ./unlinkVar8.tmp/file.tmp -- +file unlinked +-- unlinking hard link ./unlinkVar8.tmp/file.tmp -- +file unlinked +-- removing unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file removed +-- unlinking soft link unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file unlinked +-- unlinking hard link unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file unlinked +-- removing unlinkVar8.tmp/../BADDIR/file.tmp -- + +Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d +-- unlinking soft link unlinkVar8.tmp/../BADDIR/file.tmp -- + +Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d +-- unlinking hard link unlinkVar8.tmp/../BADDIR/file.tmp -- + +Warning: unlink(unlinkVar8.tmp/../BADDIR/file.tmp): No such file or directory in %s on line %d +-- removing BADDIR/file.tmp -- + +Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d +-- unlinking soft link BADDIR/file.tmp -- + +Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d +-- unlinking hard link BADDIR/file.tmp -- + +Warning: unlink(BADDIR/file.tmp): No such file or directory in %s on line %d +-- removing /%s/unlinkVar8.tmp/file.tmp -- +file removed +-- unlinking soft link /%s/unlinkVar8.tmp/file.tmp -- +file unlinked +-- unlinking hard link /%s/unlinkVar8.tmp/file.tmp -- +file unlinked +-- removing /%s/./unlinkVar8.tmp/file.tmp -- +file removed +-- unlinking soft link /%s/./unlinkVar8.tmp/file.tmp -- +file unlinked +-- unlinking hard link /%s/./unlinkVar8.tmp/file.tmp -- +file unlinked +-- removing /%s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file removed +-- unlinking soft link /%s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file unlinked +-- unlinking hard link /%s/unlinkVar8.tmp/../unlinkVar8.tmp/file.tmp -- +file unlinked +-- removing /%s/BADDIR/file.tmp -- + +Warning: unlink(/%s/BADDIR/file.tmp): No such file or directory in %s on line %d +-- unlinking soft link /%s/BADDIR/file.tmp -- + +Warning: unlink(/%s/BADDIR/file.tmp): No such file or directory in %s on line %d +-- unlinking hard link /%s/BADDIR/file.tmp -- + +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/): Not a directory in %s on line %d +-- unlinking soft link unlinkVar8.tmp/file.tmp/ -- + +Warning: unlink(unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d +-- unlinking hard link unlinkVar8.tmp/file.tmp/ -- + +Warning: unlink(unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d +-- removing /%s/unlinkVar8.tmp/file.tmp/ -- + +Warning: unlink(/%s/unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d +-- unlinking soft link /%s/unlinkVar8.tmp/file.tmp/ -- + +Warning: unlink(/%s/unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d +-- unlinking hard link /%s/unlinkVar8.tmp/file.tmp/ -- + +Warning: unlink(/%s/unlinkVar8.tmp/file.tmp/): Not a directory in %s on line %d +-- removing unlinkVar8.tmp//file.tmp -- +file removed +-- unlinking soft link unlinkVar8.tmp//file.tmp -- +file unlinked +-- unlinking hard link unlinkVar8.tmp//file.tmp -- +file unlinked +-- removing /%s//unlinkVar8.tmp//file.tmp -- +file removed +-- unlinking soft link /%s//unlinkVar8.tmp//file.tmp -- +file unlinked +-- unlinking hard link /%s//unlinkVar8.tmp//file.tmp -- +file unlinked +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/file/unlink_variation9-win32.phpt b/ext/standard/tests/file/unlink_variation9-win32.phpt new file mode 100644 index 0000000000..4f1a8bb8d3 --- /dev/null +++ b/ext/standard/tests/file/unlink_variation9-win32.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test unlink() function : variation: various valid and invalid paths +--CREDITS-- +Dave Kelsey +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unlink() : variation *** +-- removing unlinkVar9.tmp\file.tmp -- +file removed +-- removing .\unlinkVar9.tmp\file.tmp -- +file removed +-- removing unlinkVar9.tmp\..\unlinkVar9.tmp\file.tmp -- +file removed +-- removing unlinkVar9.tmp\..\BADDIR\file.tmp -- + +Warning: unlink(unlinkVar9.tmp\..\BADDIR\file.tmp): No such file or directory in %s on line %d +-- removing BADDIR\file.tmp -- + +Warning: unlink(BADDIR\file.tmp): No such file or directory in %s on line %d +-- removing %s\unlinkVar9.tmp\file.tmp -- +file removed +-- removing %s\.\unlinkVar9.tmp\file.tmp -- +file removed +-- removing %s\unlinkVar9.tmp\..\unlinkVar9.tmp\file.tmp -- +file removed +-- removing %s\BADDIR\file.tmp -- + +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 +-- removing %s\unlinkVar9.tmp\file.tmp\ -- + +Warning: unlink(%s\unlinkVar9.tmp\file.tmp\): Invalid argument in %s on line %d +-- removing unlinkVar9.tmp\\file.tmp -- +file removed +-- removing %s\\unlinkVar9.tmp\\file.tmp -- +file removed +-- removing /%s/unlinkVar9.tmp/file.tmp -- +file removed +===DONE=== \ No newline at end of file -- cgit v1.2.1