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}
8// Skip if being run by root
9$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
10$fp = fopen($filename, 'w');
11fclose($fp);
12if(fileowner($filename) == 0) {
13        unlink ($filename);
14        die('skip cannot be run as root');
15}
16unlink($filename);
17?>
18--FILE--
19<?php
20/* Prototype:  string tempnam ( string $dir, string $prefix );
21   Description: Create file with unique file name.
22*/
23
24/* Trying to create the file in a dir with permissions from 0351 to 0777,
25     Allowable permissions: files are expected to be created in the input dir
26     Non-allowable permissions: files are expected to be created in '/tmp' dir
27*/
28
29echo "*** Testing tempnam() with dir of permissions from 0351 to 0777 ***\n";
30$file_path = dirname(__FILE__);
31$dir_name = $file_path."/tempnam_variation4";
32$prefix = "tempnamVar4.";
33
34mkdir($dir_name);
35
36for($mode = 0351; $mode <= 0777; $mode++) {
37  chmod($dir_name, $mode);
38  $file_name = tempnam($dir_name, $prefix);
39
40  if(file_exists($file_name) ) {
41    if (dirname($file_name) != $dir_name) {
42      /* Either there's a notice or error */
43       printf("%o\n", $mode);
44
45      if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) {
46         echo " created in unexpected dir\n";
47      }
48    }
49    unlink($file_name);
50  }
51  else {
52    print("FAILED: File is not created\n");
53  }
54}
55
56rmdir($dir_name);
57
58echo "*** Done ***\n";
59?>
60--EXPECTF--
61*** Testing tempnam() with dir of permissions from 0351 to 0777 ***
62
63Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
64400
65
66Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
67401
68
69Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
70402
71
72Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
73403
74
75Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
76404
77
78Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
79405
80
81Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
82406
83
84Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
85407
86
87Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
88410
89
90Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
91411
92
93Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
94412
95
96Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
97413
98
99Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
100414
101
102Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
103415
104
105Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
106416
107
108Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
109417
110
111Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
112420
113
114Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
115421
116
117Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
118422
119
120Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
121423
122
123Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
124424
125
126Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
127425
128
129Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
130426
131
132Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
133427
134
135Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
136430
137
138Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
139431
140
141Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
142432
143
144Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
145433
146
147Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
148434
149
150Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
151435
152
153Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
154436
155
156Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
157437
158
159Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
160440
161
162Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
163441
164
165Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
166442
167
168Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
169443
170
171Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
172444
173
174Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
175445
176
177Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
178446
179
180Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
181447
182
183Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
184450
185
186Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
187451
188
189Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
190452
191
192Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
193453
194
195Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
196454
197
198Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
199455
200
201Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
202456
203
204Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
205457
206
207Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
208460
209
210Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
211461
212
213Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
214462
215
216Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
217463
218
219Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
220464
221
222Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
223465
224
225Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
226466
227
228Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
229467
230
231Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
232470
233
234Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
235471
236
237Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
238472
239
240Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
241473
242
243Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
244474
245
246Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
247475
248
249Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
250476
251
252Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
253477
254
255Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
256500
257
258Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
259501
260
261Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
262502
263
264Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
265503
266
267Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
268504
269
270Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
271505
272
273Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
274506
275
276Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
277507
278
279Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
280510
281
282Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
283511
284
285Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
286512
287
288Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
289513
290
291Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
292514
293
294Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
295515
296
297Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
298516
299
300Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
301517
302
303Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
304520
305
306Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
307521
308
309Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
310522
311
312Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
313523
314
315Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
316524
317
318Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
319525
320
321Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
322526
323
324Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
325527
326
327Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
328530
329
330Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
331531
332
333Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
334532
335
336Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
337533
338
339Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
340534
341
342Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
343535
344
345Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
346536
347
348Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
349537
350
351Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
352540
353
354Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
355541
356
357Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
358542
359
360Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
361543
362
363Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
364544
365
366Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
367545
368
369Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
370546
371
372Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
373547
374
375Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
376550
377
378Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
379551
380
381Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
382552
383
384Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
385553
386
387Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
388554
389
390Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
391555
392
393Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
394556
395
396Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
397557
398
399Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
400560
401
402Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
403561
404
405Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
406562
407
408Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
409563
410
411Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
412564
413
414Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
415565
416
417Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
418566
419
420Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
421567
422
423Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
424570
425
426Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
427571
428
429Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
430572
431
432Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
433573
434
435Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
436574
437
438Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
439575
440
441Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
442576
443
444Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
445577
446
447Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
448600
449
450Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
451601
452
453Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
454602
455
456Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
457603
458
459Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
460604
461
462Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
463605
464
465Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
466606
467
468Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
469607
470
471Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
472610
473
474Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
475611
476
477Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
478612
479
480Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
481613
482
483Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
484614
485
486Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
487615
488
489Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
490616
491
492Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
493617
494
495Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
496620
497
498Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
499621
500
501Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
502622
503
504Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
505623
506
507Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
508624
509
510Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
511625
512
513Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
514626
515
516Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
517627
518
519Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
520630
521
522Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
523631
524
525Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
526632
527
528Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
529633
530
531Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
532634
533
534Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
535635
536
537Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
538636
539
540Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
541637
542
543Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
544640
545
546Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
547641
548
549Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
550642
551
552Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
553643
554
555Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
556644
557
558Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
559645
560
561Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
562646
563
564Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
565647
566
567Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
568650
569
570Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
571651
572
573Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
574652
575
576Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
577653
578
579Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
580654
581
582Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
583655
584
585Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
586656
587
588Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
589657
590
591Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
592660
593
594Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
595661
596
597Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
598662
599
600Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
601663
602
603Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
604664
605
606Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
607665
608
609Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
610666
611
612Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
613667
614
615Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
616670
617
618Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
619671
620
621Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
622672
623
624Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
625673
626
627Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
628674
629
630Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
631675
632
633Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
634676
635
636Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-1.php on line 20
637677
638*** Done ***
639