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/* 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
17echo "*** Testing tempnam() with dir of permissions from 0351 to 0777 ***\n";
18$file_path = __DIR__;
19$dir_name = $file_path."/tempnam_variation4-1";
20$prefix = "tempnamVar4.";
21
22mkdir($dir_name);
23
24for($mode = 0351; $mode <= 0777; $mode++) {
25  chmod($dir_name, $mode);
26  $file_name = tempnam($dir_name, $prefix);
27
28  if(file_exists($file_name) ) {
29    if (dirname($file_name) != $dir_name) {
30      /* Either there's a notice or error */
31       printf("%o\n", $mode);
32
33      if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) {
34         echo " created in unexpected dir\n";
35      }
36    }
37    unlink($file_name);
38  }
39  else {
40    print("FAILED: File is not created\n");
41  }
42}
43
44rmdir($dir_name);
45
46echo "*** Done ***\n";
47?>
48--EXPECTF--
49*** Testing tempnam() with dir of permissions from 0351 to 0777 ***
50
51Notice: tempnam(): file created in the system's temporary directory in %s on line %d
52400
53
54Notice: tempnam(): file created in the system's temporary directory in %s on line %d
55401
56
57Notice: tempnam(): file created in the system's temporary directory in %s on line %d
58402
59
60Notice: tempnam(): file created in the system's temporary directory in %s on line %d
61403
62
63Notice: tempnam(): file created in the system's temporary directory in %s on line %d
64404
65
66Notice: tempnam(): file created in the system's temporary directory in %s on line %d
67405
68
69Notice: tempnam(): file created in the system's temporary directory in %s on line %d
70406
71
72Notice: tempnam(): file created in the system's temporary directory in %s on line %d
73407
74
75Notice: tempnam(): file created in the system's temporary directory in %s on line %d
76410
77
78Notice: tempnam(): file created in the system's temporary directory in %s on line %d
79411
80
81Notice: tempnam(): file created in the system's temporary directory in %s on line %d
82412
83
84Notice: tempnam(): file created in the system's temporary directory in %s on line %d
85413
86
87Notice: tempnam(): file created in the system's temporary directory in %s on line %d
88414
89
90Notice: tempnam(): file created in the system's temporary directory in %s on line %d
91415
92
93Notice: tempnam(): file created in the system's temporary directory in %s on line %d
94416
95
96Notice: tempnam(): file created in the system's temporary directory in %s on line %d
97417
98
99Notice: tempnam(): file created in the system's temporary directory in %s on line %d
100420
101
102Notice: tempnam(): file created in the system's temporary directory in %s on line %d
103421
104
105Notice: tempnam(): file created in the system's temporary directory in %s on line %d
106422
107
108Notice: tempnam(): file created in the system's temporary directory in %s on line %d
109423
110
111Notice: tempnam(): file created in the system's temporary directory in %s on line %d
112424
113
114Notice: tempnam(): file created in the system's temporary directory in %s on line %d
115425
116
117Notice: tempnam(): file created in the system's temporary directory in %s on line %d
118426
119
120Notice: tempnam(): file created in the system's temporary directory in %s on line %d
121427
122
123Notice: tempnam(): file created in the system's temporary directory in %s on line %d
124430
125
126Notice: tempnam(): file created in the system's temporary directory in %s on line %d
127431
128
129Notice: tempnam(): file created in the system's temporary directory in %s on line %d
130432
131
132Notice: tempnam(): file created in the system's temporary directory in %s on line %d
133433
134
135Notice: tempnam(): file created in the system's temporary directory in %s on line %d
136434
137
138Notice: tempnam(): file created in the system's temporary directory in %s on line %d
139435
140
141Notice: tempnam(): file created in the system's temporary directory in %s on line %d
142436
143
144Notice: tempnam(): file created in the system's temporary directory in %s on line %d
145437
146
147Notice: tempnam(): file created in the system's temporary directory in %s on line %d
148440
149
150Notice: tempnam(): file created in the system's temporary directory in %s on line %d
151441
152
153Notice: tempnam(): file created in the system's temporary directory in %s on line %d
154442
155
156Notice: tempnam(): file created in the system's temporary directory in %s on line %d
157443
158
159Notice: tempnam(): file created in the system's temporary directory in %s on line %d
160444
161
162Notice: tempnam(): file created in the system's temporary directory in %s on line %d
163445
164
165Notice: tempnam(): file created in the system's temporary directory in %s on line %d
166446
167
168Notice: tempnam(): file created in the system's temporary directory in %s on line %d
169447
170
171Notice: tempnam(): file created in the system's temporary directory in %s on line %d
172450
173
174Notice: tempnam(): file created in the system's temporary directory in %s on line %d
175451
176
177Notice: tempnam(): file created in the system's temporary directory in %s on line %d
178452
179
180Notice: tempnam(): file created in the system's temporary directory in %s on line %d
181453
182
183Notice: tempnam(): file created in the system's temporary directory in %s on line %d
184454
185
186Notice: tempnam(): file created in the system's temporary directory in %s on line %d
187455
188
189Notice: tempnam(): file created in the system's temporary directory in %s on line %d
190456
191
192Notice: tempnam(): file created in the system's temporary directory in %s on line %d
193457
194
195Notice: tempnam(): file created in the system's temporary directory in %s on line %d
196460
197
198Notice: tempnam(): file created in the system's temporary directory in %s on line %d
199461
200
201Notice: tempnam(): file created in the system's temporary directory in %s on line %d
202462
203
204Notice: tempnam(): file created in the system's temporary directory in %s on line %d
205463
206
207Notice: tempnam(): file created in the system's temporary directory in %s on line %d
208464
209
210Notice: tempnam(): file created in the system's temporary directory in %s on line %d
211465
212
213Notice: tempnam(): file created in the system's temporary directory in %s on line %d
214466
215
216Notice: tempnam(): file created in the system's temporary directory in %s on line %d
217467
218
219Notice: tempnam(): file created in the system's temporary directory in %s on line %d
220470
221
222Notice: tempnam(): file created in the system's temporary directory in %s on line %d
223471
224
225Notice: tempnam(): file created in the system's temporary directory in %s on line %d
226472
227
228Notice: tempnam(): file created in the system's temporary directory in %s on line %d
229473
230
231Notice: tempnam(): file created in the system's temporary directory in %s on line %d
232474
233
234Notice: tempnam(): file created in the system's temporary directory in %s on line %d
235475
236
237Notice: tempnam(): file created in the system's temporary directory in %s on line %d
238476
239
240Notice: tempnam(): file created in the system's temporary directory in %s on line %d
241477
242
243Notice: tempnam(): file created in the system's temporary directory in %s on line %d
244500
245
246Notice: tempnam(): file created in the system's temporary directory in %s on line %d
247501
248
249Notice: tempnam(): file created in the system's temporary directory in %s on line %d
250502
251
252Notice: tempnam(): file created in the system's temporary directory in %s on line %d
253503
254
255Notice: tempnam(): file created in the system's temporary directory in %s on line %d
256504
257
258Notice: tempnam(): file created in the system's temporary directory in %s on line %d
259505
260
261Notice: tempnam(): file created in the system's temporary directory in %s on line %d
262506
263
264Notice: tempnam(): file created in the system's temporary directory in %s on line %d
265507
266
267Notice: tempnam(): file created in the system's temporary directory in %s on line %d
268510
269
270Notice: tempnam(): file created in the system's temporary directory in %s on line %d
271511
272
273Notice: tempnam(): file created in the system's temporary directory in %s on line %d
274512
275
276Notice: tempnam(): file created in the system's temporary directory in %s on line %d
277513
278
279Notice: tempnam(): file created in the system's temporary directory in %s on line %d
280514
281
282Notice: tempnam(): file created in the system's temporary directory in %s on line %d
283515
284
285Notice: tempnam(): file created in the system's temporary directory in %s on line %d
286516
287
288Notice: tempnam(): file created in the system's temporary directory in %s on line %d
289517
290
291Notice: tempnam(): file created in the system's temporary directory in %s on line %d
292520
293
294Notice: tempnam(): file created in the system's temporary directory in %s on line %d
295521
296
297Notice: tempnam(): file created in the system's temporary directory in %s on line %d
298522
299
300Notice: tempnam(): file created in the system's temporary directory in %s on line %d
301523
302
303Notice: tempnam(): file created in the system's temporary directory in %s on line %d
304524
305
306Notice: tempnam(): file created in the system's temporary directory in %s on line %d
307525
308
309Notice: tempnam(): file created in the system's temporary directory in %s on line %d
310526
311
312Notice: tempnam(): file created in the system's temporary directory in %s on line %d
313527
314
315Notice: tempnam(): file created in the system's temporary directory in %s on line %d
316530
317
318Notice: tempnam(): file created in the system's temporary directory in %s on line %d
319531
320
321Notice: tempnam(): file created in the system's temporary directory in %s on line %d
322532
323
324Notice: tempnam(): file created in the system's temporary directory in %s on line %d
325533
326
327Notice: tempnam(): file created in the system's temporary directory in %s on line %d
328534
329
330Notice: tempnam(): file created in the system's temporary directory in %s on line %d
331535
332
333Notice: tempnam(): file created in the system's temporary directory in %s on line %d
334536
335
336Notice: tempnam(): file created in the system's temporary directory in %s on line %d
337537
338
339Notice: tempnam(): file created in the system's temporary directory in %s on line %d
340540
341
342Notice: tempnam(): file created in the system's temporary directory in %s on line %d
343541
344
345Notice: tempnam(): file created in the system's temporary directory in %s on line %d
346542
347
348Notice: tempnam(): file created in the system's temporary directory in %s on line %d
349543
350
351Notice: tempnam(): file created in the system's temporary directory in %s on line %d
352544
353
354Notice: tempnam(): file created in the system's temporary directory in %s on line %d
355545
356
357Notice: tempnam(): file created in the system's temporary directory in %s on line %d
358546
359
360Notice: tempnam(): file created in the system's temporary directory in %s on line %d
361547
362
363Notice: tempnam(): file created in the system's temporary directory in %s on line %d
364550
365
366Notice: tempnam(): file created in the system's temporary directory in %s on line %d
367551
368
369Notice: tempnam(): file created in the system's temporary directory in %s on line %d
370552
371
372Notice: tempnam(): file created in the system's temporary directory in %s on line %d
373553
374
375Notice: tempnam(): file created in the system's temporary directory in %s on line %d
376554
377
378Notice: tempnam(): file created in the system's temporary directory in %s on line %d
379555
380
381Notice: tempnam(): file created in the system's temporary directory in %s on line %d
382556
383
384Notice: tempnam(): file created in the system's temporary directory in %s on line %d
385557
386
387Notice: tempnam(): file created in the system's temporary directory in %s on line %d
388560
389
390Notice: tempnam(): file created in the system's temporary directory in %s on line %d
391561
392
393Notice: tempnam(): file created in the system's temporary directory in %s on line %d
394562
395
396Notice: tempnam(): file created in the system's temporary directory in %s on line %d
397563
398
399Notice: tempnam(): file created in the system's temporary directory in %s on line %d
400564
401
402Notice: tempnam(): file created in the system's temporary directory in %s on line %d
403565
404
405Notice: tempnam(): file created in the system's temporary directory in %s on line %d
406566
407
408Notice: tempnam(): file created in the system's temporary directory in %s on line %d
409567
410
411Notice: tempnam(): file created in the system's temporary directory in %s on line %d
412570
413
414Notice: tempnam(): file created in the system's temporary directory in %s on line %d
415571
416
417Notice: tempnam(): file created in the system's temporary directory in %s on line %d
418572
419
420Notice: tempnam(): file created in the system's temporary directory in %s on line %d
421573
422
423Notice: tempnam(): file created in the system's temporary directory in %s on line %d
424574
425
426Notice: tempnam(): file created in the system's temporary directory in %s on line %d
427575
428
429Notice: tempnam(): file created in the system's temporary directory in %s on line %d
430576
431
432Notice: tempnam(): file created in the system's temporary directory in %s on line %d
433577
434
435Notice: tempnam(): file created in the system's temporary directory in %s on line %d
436600
437
438Notice: tempnam(): file created in the system's temporary directory in %s on line %d
439601
440
441Notice: tempnam(): file created in the system's temporary directory in %s on line %d
442602
443
444Notice: tempnam(): file created in the system's temporary directory in %s on line %d
445603
446
447Notice: tempnam(): file created in the system's temporary directory in %s on line %d
448604
449
450Notice: tempnam(): file created in the system's temporary directory in %s on line %d
451605
452
453Notice: tempnam(): file created in the system's temporary directory in %s on line %d
454606
455
456Notice: tempnam(): file created in the system's temporary directory in %s on line %d
457607
458
459Notice: tempnam(): file created in the system's temporary directory in %s on line %d
460610
461
462Notice: tempnam(): file created in the system's temporary directory in %s on line %d
463611
464
465Notice: tempnam(): file created in the system's temporary directory in %s on line %d
466612
467
468Notice: tempnam(): file created in the system's temporary directory in %s on line %d
469613
470
471Notice: tempnam(): file created in the system's temporary directory in %s on line %d
472614
473
474Notice: tempnam(): file created in the system's temporary directory in %s on line %d
475615
476
477Notice: tempnam(): file created in the system's temporary directory in %s on line %d
478616
479
480Notice: tempnam(): file created in the system's temporary directory in %s on line %d
481617
482
483Notice: tempnam(): file created in the system's temporary directory in %s on line %d
484620
485
486Notice: tempnam(): file created in the system's temporary directory in %s on line %d
487621
488
489Notice: tempnam(): file created in the system's temporary directory in %s on line %d
490622
491
492Notice: tempnam(): file created in the system's temporary directory in %s on line %d
493623
494
495Notice: tempnam(): file created in the system's temporary directory in %s on line %d
496624
497
498Notice: tempnam(): file created in the system's temporary directory in %s on line %d
499625
500
501Notice: tempnam(): file created in the system's temporary directory in %s on line %d
502626
503
504Notice: tempnam(): file created in the system's temporary directory in %s on line %d
505627
506
507Notice: tempnam(): file created in the system's temporary directory in %s on line %d
508630
509
510Notice: tempnam(): file created in the system's temporary directory in %s on line %d
511631
512
513Notice: tempnam(): file created in the system's temporary directory in %s on line %d
514632
515
516Notice: tempnam(): file created in the system's temporary directory in %s on line %d
517633
518
519Notice: tempnam(): file created in the system's temporary directory in %s on line %d
520634
521
522Notice: tempnam(): file created in the system's temporary directory in %s on line %d
523635
524
525Notice: tempnam(): file created in the system's temporary directory in %s on line %d
526636
527
528Notice: tempnam(): file created in the system's temporary directory in %s on line %d
529637
530
531Notice: tempnam(): file created in the system's temporary directory in %s on line %d
532640
533
534Notice: tempnam(): file created in the system's temporary directory in %s on line %d
535641
536
537Notice: tempnam(): file created in the system's temporary directory in %s on line %d
538642
539
540Notice: tempnam(): file created in the system's temporary directory in %s on line %d
541643
542
543Notice: tempnam(): file created in the system's temporary directory in %s on line %d
544644
545
546Notice: tempnam(): file created in the system's temporary directory in %s on line %d
547645
548
549Notice: tempnam(): file created in the system's temporary directory in %s on line %d
550646
551
552Notice: tempnam(): file created in the system's temporary directory in %s on line %d
553647
554
555Notice: tempnam(): file created in the system's temporary directory in %s on line %d
556650
557
558Notice: tempnam(): file created in the system's temporary directory in %s on line %d
559651
560
561Notice: tempnam(): file created in the system's temporary directory in %s on line %d
562652
563
564Notice: tempnam(): file created in the system's temporary directory in %s on line %d
565653
566
567Notice: tempnam(): file created in the system's temporary directory in %s on line %d
568654
569
570Notice: tempnam(): file created in the system's temporary directory in %s on line %d
571655
572
573Notice: tempnam(): file created in the system's temporary directory in %s on line %d
574656
575
576Notice: tempnam(): file created in the system's temporary directory in %s on line %d
577657
578
579Notice: tempnam(): file created in the system's temporary directory in %s on line %d
580660
581
582Notice: tempnam(): file created in the system's temporary directory in %s on line %d
583661
584
585Notice: tempnam(): file created in the system's temporary directory in %s on line %d
586662
587
588Notice: tempnam(): file created in the system's temporary directory in %s on line %d
589663
590
591Notice: tempnam(): file created in the system's temporary directory in %s on line %d
592664
593
594Notice: tempnam(): file created in the system's temporary directory in %s on line %d
595665
596
597Notice: tempnam(): file created in the system's temporary directory in %s on line %d
598666
599
600Notice: tempnam(): file created in the system's temporary directory in %s on line %d
601667
602
603Notice: tempnam(): file created in the system's temporary directory in %s on line %d
604670
605
606Notice: tempnam(): file created in the system's temporary directory in %s on line %d
607671
608
609Notice: tempnam(): file created in the system's temporary directory in %s on line %d
610672
611
612Notice: tempnam(): file created in the system's temporary directory in %s on line %d
613673
614
615Notice: tempnam(): file created in the system's temporary directory in %s on line %d
616674
617
618Notice: tempnam(): file created in the system's temporary directory in %s on line %d
619675
620
621Notice: tempnam(): file created in the system's temporary directory in %s on line %d
622676
623
624Notice: tempnam(): file created in the system's temporary directory in %s on line %d
625677
626*** Done ***
627