tempnam_variation4-1.phpt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. --TEST--
  2. Test tempnam() function: usage variations - permissions(0351 to 0777) 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 0351 to 0777,
  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 0351 to 0777 ***\n";
  17. $file_path = __DIR__;
  18. $dir_name = $file_path."/tempnam_variation4-1";
  19. $prefix = "tempnamVar4.";
  20. mkdir($dir_name);
  21. for($mode = 0351; $mode <= 0777; $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 0351 to 0777 ***
  43. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  44. 400
  45. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  46. 401
  47. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  48. 402
  49. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  50. 403
  51. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  52. 404
  53. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  54. 405
  55. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  56. 406
  57. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  58. 407
  59. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  60. 410
  61. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  62. 411
  63. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  64. 412
  65. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  66. 413
  67. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  68. 414
  69. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  70. 415
  71. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  72. 416
  73. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  74. 417
  75. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  76. 420
  77. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  78. 421
  79. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  80. 422
  81. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  82. 423
  83. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  84. 424
  85. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  86. 425
  87. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  88. 426
  89. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  90. 427
  91. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  92. 430
  93. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  94. 431
  95. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  96. 432
  97. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  98. 433
  99. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  100. 434
  101. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  102. 435
  103. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  104. 436
  105. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  106. 437
  107. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  108. 440
  109. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  110. 441
  111. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  112. 442
  113. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  114. 443
  115. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  116. 444
  117. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  118. 445
  119. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  120. 446
  121. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  122. 447
  123. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  124. 450
  125. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  126. 451
  127. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  128. 452
  129. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  130. 453
  131. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  132. 454
  133. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  134. 455
  135. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  136. 456
  137. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  138. 457
  139. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  140. 460
  141. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  142. 461
  143. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  144. 462
  145. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  146. 463
  147. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  148. 464
  149. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  150. 465
  151. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  152. 466
  153. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  154. 467
  155. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  156. 470
  157. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  158. 471
  159. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  160. 472
  161. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  162. 473
  163. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  164. 474
  165. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  166. 475
  167. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  168. 476
  169. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  170. 477
  171. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  172. 500
  173. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  174. 501
  175. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  176. 502
  177. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  178. 503
  179. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  180. 504
  181. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  182. 505
  183. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  184. 506
  185. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  186. 507
  187. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  188. 510
  189. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  190. 511
  191. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  192. 512
  193. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  194. 513
  195. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  196. 514
  197. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  198. 515
  199. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  200. 516
  201. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  202. 517
  203. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  204. 520
  205. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  206. 521
  207. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  208. 522
  209. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  210. 523
  211. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  212. 524
  213. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  214. 525
  215. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  216. 526
  217. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  218. 527
  219. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  220. 530
  221. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  222. 531
  223. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  224. 532
  225. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  226. 533
  227. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  228. 534
  229. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  230. 535
  231. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  232. 536
  233. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  234. 537
  235. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  236. 540
  237. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  238. 541
  239. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  240. 542
  241. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  242. 543
  243. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  244. 544
  245. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  246. 545
  247. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  248. 546
  249. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  250. 547
  251. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  252. 550
  253. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  254. 551
  255. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  256. 552
  257. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  258. 553
  259. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  260. 554
  261. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  262. 555
  263. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  264. 556
  265. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  266. 557
  267. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  268. 560
  269. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  270. 561
  271. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  272. 562
  273. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  274. 563
  275. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  276. 564
  277. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  278. 565
  279. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  280. 566
  281. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  282. 567
  283. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  284. 570
  285. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  286. 571
  287. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  288. 572
  289. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  290. 573
  291. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  292. 574
  293. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  294. 575
  295. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  296. 576
  297. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  298. 577
  299. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  300. 600
  301. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  302. 601
  303. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  304. 602
  305. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  306. 603
  307. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  308. 604
  309. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  310. 605
  311. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  312. 606
  313. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  314. 607
  315. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  316. 610
  317. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  318. 611
  319. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  320. 612
  321. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  322. 613
  323. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  324. 614
  325. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  326. 615
  327. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  328. 616
  329. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  330. 617
  331. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  332. 620
  333. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  334. 621
  335. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  336. 622
  337. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  338. 623
  339. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  340. 624
  341. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  342. 625
  343. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  344. 626
  345. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  346. 627
  347. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  348. 630
  349. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  350. 631
  351. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  352. 632
  353. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  354. 633
  355. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  356. 634
  357. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  358. 635
  359. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  360. 636
  361. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  362. 637
  363. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  364. 640
  365. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  366. 641
  367. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  368. 642
  369. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  370. 643
  371. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  372. 644
  373. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  374. 645
  375. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  376. 646
  377. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  378. 647
  379. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  380. 650
  381. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  382. 651
  383. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  384. 652
  385. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  386. 653
  387. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  388. 654
  389. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  390. 655
  391. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  392. 656
  393. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  394. 657
  395. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  396. 660
  397. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  398. 661
  399. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  400. 662
  401. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  402. 663
  403. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  404. 664
  405. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  406. 665
  407. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  408. 666
  409. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  410. 667
  411. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  412. 670
  413. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  414. 671
  415. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  416. 672
  417. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  418. 673
  419. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  420. 674
  421. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  422. 675
  423. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  424. 676
  425. Notice: tempnam(): file created in the system's temporary directory in %s on line %d
  426. 677
  427. *** Done ***