1--TEST--
2Test tempnam() function: usage variations - permissions(0351 to 0777) of dir
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip Not valid for Windows');
7}
8require __DIR__ . '/../skipif_root.inc';
9?>
10--FILE--
11<?php
12/* Prototype:  string tempnam ( string $dir, string $prefix );
13   Description: Create file with unique file name.
14*/
15
16/* Trying to create the file in a dir with permissions from 0351 to 0777,
17     Allowable permissions: files are expected to be created in the input dir
18     Non-allowable permissions: files are expected to be created in '/tmp' dir
19*/
20
21echo "*** Testing tempnam() with dir of permissions from 0351 to 0777 ***\n";
22$file_path = __DIR__;
23$dir_name = $file_path."/tempnam_variation4-1";
24$prefix = "tempnamVar4.";
25
26mkdir($dir_name);
27
28for($mode = 0351; $mode <= 0777; $mode++) {
29  chmod($dir_name, $mode);
30  $file_name = tempnam($dir_name, $prefix);
31
32  if(file_exists($file_name) ) {
33    if (dirname($file_name) != $dir_name) {
34      /* Either there's a notice or error */
35       printf("%o\n", $mode);
36
37      if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) {
38         echo " created in unexpected dir\n";
39      }
40    }
41    unlink($file_name);
42  }
43  else {
44    print("FAILED: File is not created\n");
45  }
46}
47
48rmdir($dir_name);
49
50echo "*** Done ***\n";
51?>
52--EXPECTF--
53*** Testing tempnam() with dir of permissions from 0351 to 0777 ***
54
55Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
56400
57
58Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
59401
60
61Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
62402
63
64Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
65403
66
67Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
68404
69
70Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
71405
72
73Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
74406
75
76Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
77407
78
79Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
80410
81
82Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
83411
84
85Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
86412
87
88Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
89413
90
91Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
92414
93
94Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
95415
96
97Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
98416
99
100Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
101417
102
103Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
104420
105
106Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
107421
108
109Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
110422
111
112Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
113423
114
115Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
116424
117
118Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
119425
120
121Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
122426
123
124Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
125427
126
127Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
128430
129
130Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
131431
132
133Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
134432
135
136Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
137433
138
139Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
140434
141
142Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
143435
144
145Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
146436
147
148Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
149437
150
151Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
152440
153
154Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
155441
156
157Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
158442
159
160Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
161443
162
163Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
164444
165
166Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
167445
168
169Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
170446
171
172Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
173447
174
175Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
176450
177
178Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
179451
180
181Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
182452
183
184Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
185453
186
187Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
188454
189
190Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
191455
192
193Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
194456
195
196Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
197457
198
199Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
200460
201
202Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
203461
204
205Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
206462
207
208Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
209463
210
211Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
212464
213
214Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
215465
216
217Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
218466
219
220Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
221467
222
223Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
224470
225
226Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
227471
228
229Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
230472
231
232Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
233473
234
235Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
236474
237
238Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
239475
240
241Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
242476
243
244Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
245477
246
247Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
248500
249
250Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
251501
252
253Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
254502
255
256Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
257503
258
259Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
260504
261
262Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
263505
264
265Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
266506
267
268Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
269507
270
271Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
272510
273
274Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
275511
276
277Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
278512
279
280Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
281513
282
283Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
284514
285
286Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
287515
288
289Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
290516
291
292Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
293517
294
295Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
296520
297
298Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
299521
300
301Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
302522
303
304Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
305523
306
307Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
308524
309
310Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
311525
312
313Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
314526
315
316Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
317527
318
319Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
320530
321
322Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
323531
324
325Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
326532
327
328Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
329533
330
331Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
332534
333
334Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
335535
336
337Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
338536
339
340Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
341537
342
343Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
344540
345
346Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
347541
348
349Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
350542
351
352Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
353543
354
355Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
356544
357
358Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
359545
360
361Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
362546
363
364Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
365547
366
367Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
368550
369
370Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
371551
372
373Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
374552
375
376Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
377553
378
379Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
380554
381
382Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
383555
384
385Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
386556
387
388Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
389557
390
391Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
392560
393
394Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
395561
396
397Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
398562
399
400Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
401563
402
403Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
404564
405
406Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
407565
408
409Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
410566
411
412Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
413567
414
415Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
416570
417
418Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
419571
420
421Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
422572
423
424Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
425573
426
427Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
428574
429
430Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
431575
432
433Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
434576
435
436Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
437577
438
439Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
440600
441
442Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
443601
444
445Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
446602
447
448Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
449603
450
451Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
452604
453
454Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
455605
456
457Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
458606
459
460Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
461607
462
463Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
464610
465
466Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
467611
468
469Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
470612
471
472Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
473613
474
475Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
476614
477
478Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
479615
480
481Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
482616
483
484Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
485617
486
487Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
488620
489
490Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
491621
492
493Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
494622
495
496Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
497623
498
499Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
500624
501
502Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
503625
504
505Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
506626
507
508Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
509627
510
511Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
512630
513
514Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
515631
516
517Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
518632
519
520Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
521633
522
523Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
524634
525
526Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
527635
528
529Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
530636
531
532Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
533637
534
535Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
536640
537
538Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
539641
540
541Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
542642
543
544Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
545643
546
547Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
548644
549
550Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
551645
552
553Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
554646
555
556Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
557647
558
559Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
560650
561
562Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
563651
564
565Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
566652
567
568Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
569653
570
571Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
572654
573
574Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
575655
576
577Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
578656
579
580Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
581657
582
583Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
584660
585
586Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
587661
588
589Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
590662
591
592Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
593663
594
595Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
596664
597
598Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
599665
600
601Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
602666
603
604Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
605667
606
607Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
608670
609
610Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
611671
612
613Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
614672
615
616Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
617673
618
619Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
620674
621
622Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
623675
624
625Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
626676
627
628Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
629677
630*** Done ***
631