tempnam_variation4-0.phpt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. --TEST--
  2. Test tempnam() function: usage variations - permissions(0000 to 0350) of dir
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) == 'WIN') {
  6. die('skip Not valid for Windows');
  7. }
  8. require __DIR__ . '/../skipif_root.inc';
  9. ?>
  10. --FILE--
  11. <?php
  12. /* Trying to create the file in a dir with permissions from 0000 to 0350,
  13. Allowable permissions: files are expected to be created in the input dir
  14. Non-allowable permissions: files are expected to be created in '/tmp' dir
  15. */
  16. echo "*** Testing tempnam() with dir of permissions from 0000 to 0350 ***\n";
  17. $file_path = __DIR__;
  18. $dir_name = $file_path."/tempnam_variation4-0";
  19. $prefix = "tempnamVar4.";
  20. mkdir($dir_name);
  21. for($mode = 0000; $mode <= 0350; $mode++) {
  22. chmod($dir_name, $mode);
  23. $file_name = tempnam($dir_name, $prefix);
  24. if(file_exists($file_name) ) {
  25. if (dirname($file_name) != $dir_name) {
  26. /* Either there's a notice or error */
  27. printf("%o\n", $mode);
  28. if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) {
  29. echo " created in unexpected dir\n";
  30. }
  31. }
  32. unlink($file_name);
  33. }
  34. else {
  35. print("FAILED: File is not created\n");
  36. }
  37. }
  38. rmdir($dir_name);
  39. echo "*** Done ***\n";
  40. ?>
  41. --EXPECTF--
  42. *** Testing tempnam() with dir of permissions from 0000 to 0350 ***
  43. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  44. 0
  45. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  46. 1
  47. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  48. 2
  49. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  50. 3
  51. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  52. 4
  53. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  54. 5
  55. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  56. 6
  57. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  58. 7
  59. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  60. 10
  61. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  62. 11
  63. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  64. 12
  65. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  66. 13
  67. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  68. 14
  69. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  70. 15
  71. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  72. 16
  73. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  74. 17
  75. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  76. 20
  77. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  78. 21
  79. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  80. 22
  81. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  82. 23
  83. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  84. 24
  85. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  86. 25
  87. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  88. 26
  89. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  90. 27
  91. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  92. 30
  93. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  94. 31
  95. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  96. 32
  97. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  98. 33
  99. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  100. 34
  101. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  102. 35
  103. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  104. 36
  105. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  106. 37
  107. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  108. 40
  109. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  110. 41
  111. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  112. 42
  113. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  114. 43
  115. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  116. 44
  117. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  118. 45
  119. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  120. 46
  121. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  122. 47
  123. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  124. 50
  125. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  126. 51
  127. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  128. 52
  129. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  130. 53
  131. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  132. 54
  133. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  134. 55
  135. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  136. 56
  137. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  138. 57
  139. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  140. 60
  141. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  142. 61
  143. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  144. 62
  145. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  146. 63
  147. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  148. 64
  149. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  150. 65
  151. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  152. 66
  153. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  154. 67
  155. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  156. 70
  157. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  158. 71
  159. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  160. 72
  161. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  162. 73
  163. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  164. 74
  165. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  166. 75
  167. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  168. 76
  169. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  170. 77
  171. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  172. 100
  173. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  174. 101
  175. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  176. 102
  177. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  178. 103
  179. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  180. 104
  181. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  182. 105
  183. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  184. 106
  185. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  186. 107
  187. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  188. 110
  189. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  190. 111
  191. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  192. 112
  193. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  194. 113
  195. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  196. 114
  197. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  198. 115
  199. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  200. 116
  201. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  202. 117
  203. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  204. 120
  205. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  206. 121
  207. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  208. 122
  209. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  210. 123
  211. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  212. 124
  213. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  214. 125
  215. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  216. 126
  217. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  218. 127
  219. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  220. 130
  221. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  222. 131
  223. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  224. 132
  225. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  226. 133
  227. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  228. 134
  229. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  230. 135
  231. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  232. 136
  233. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  234. 137
  235. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  236. 140
  237. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  238. 141
  239. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  240. 142
  241. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  242. 143
  243. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  244. 144
  245. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  246. 145
  247. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  248. 146
  249. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  250. 147
  251. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  252. 150
  253. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  254. 151
  255. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  256. 152
  257. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  258. 153
  259. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  260. 154
  261. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  262. 155
  263. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  264. 156
  265. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  266. 157
  267. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  268. 160
  269. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  270. 161
  271. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  272. 162
  273. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  274. 163
  275. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  276. 164
  277. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  278. 165
  279. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  280. 166
  281. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  282. 167
  283. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  284. 170
  285. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  286. 171
  287. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  288. 172
  289. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  290. 173
  291. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  292. 174
  293. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  294. 175
  295. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  296. 176
  297. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  298. 177
  299. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  300. 200
  301. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  302. 201
  303. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  304. 202
  305. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  306. 203
  307. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  308. 204
  309. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  310. 205
  311. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  312. 206
  313. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  314. 207
  315. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  316. 210
  317. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  318. 211
  319. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  320. 212
  321. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  322. 213
  323. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  324. 214
  325. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  326. 215
  327. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  328. 216
  329. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  330. 217
  331. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  332. 220
  333. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  334. 221
  335. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  336. 222
  337. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  338. 223
  339. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  340. 224
  341. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  342. 225
  343. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  344. 226
  345. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  346. 227
  347. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  348. 230
  349. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  350. 231
  351. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  352. 232
  353. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  354. 233
  355. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  356. 234
  357. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  358. 235
  359. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  360. 236
  361. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  362. 237
  363. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  364. 240
  365. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  366. 241
  367. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  368. 242
  369. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  370. 243
  371. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  372. 244
  373. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  374. 245
  375. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  376. 246
  377. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  378. 247
  379. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  380. 250
  381. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  382. 251
  383. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  384. 252
  385. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  386. 253
  387. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  388. 254
  389. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  390. 255
  391. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  392. 256
  393. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  394. 257
  395. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  396. 260
  397. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  398. 261
  399. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  400. 262
  401. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  402. 263
  403. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  404. 264
  405. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  406. 265
  407. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  408. 266
  409. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  410. 267
  411. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  412. 270
  413. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  414. 271
  415. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  416. 272
  417. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  418. 273
  419. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  420. 274
  421. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  422. 275
  423. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  424. 276
  425. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  426. 277
  427. *** Done ***