1--TEST--
2Test tempnam() function: usage variations - permissions(0000 to 0350) 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 0000 to 0350,
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 0000 to 0350 ***\n";
22$file_path = __DIR__;
23$dir_name = $file_path."/tempnam_variation4-0";
24$prefix = "tempnamVar4.";
25
26mkdir($dir_name);
27
28for($mode = 0000; $mode <= 0350; $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 0000 to 0350 ***
54
55Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
560
57
58Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
591
60
61Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
622
63
64Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
653
66
67Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
684
69
70Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
715
72
73Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
746
75
76Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
777
78
79Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
8010
81
82Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
8311
84
85Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
8612
87
88Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
8913
90
91Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
9214
93
94Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
9515
96
97Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
9816
99
100Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
10117
102
103Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
10420
105
106Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
10721
108
109Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
11022
111
112Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
11323
114
115Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
11624
117
118Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
11925
120
121Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
12226
123
124Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
12527
126
127Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
12830
129
130Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
13131
132
133Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
13432
135
136Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
13733
138
139Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
14034
141
142Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
14335
144
145Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
14636
147
148Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
14937
150
151Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
15240
153
154Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
15541
156
157Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
15842
159
160Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
16143
162
163Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
16444
165
166Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
16745
168
169Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
17046
171
172Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
17347
174
175Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
17650
177
178Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
17951
180
181Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
18252
183
184Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
18553
186
187Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
18854
189
190Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
19155
192
193Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
19456
195
196Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
19757
198
199Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
20060
201
202Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
20361
204
205Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
20662
207
208Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
20963
210
211Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
21264
213
214Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
21565
216
217Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
21866
219
220Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
22167
222
223Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
22470
225
226Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
22771
228
229Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
23072
231
232Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
23373
234
235Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
23674
237
238Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
23975
240
241Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
24276
243
244Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
24577
246
247Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
248100
249
250Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
251101
252
253Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
254102
255
256Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
257103
258
259Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
260104
261
262Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
263105
264
265Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
266106
267
268Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
269107
270
271Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
272110
273
274Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
275111
276
277Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
278112
279
280Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
281113
282
283Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
284114
285
286Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
287115
288
289Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
290116
291
292Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
293117
294
295Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
296120
297
298Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
299121
300
301Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
302122
303
304Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
305123
306
307Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
308124
309
310Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
311125
312
313Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
314126
315
316Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
317127
318
319Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
320130
321
322Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
323131
324
325Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
326132
327
328Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
329133
330
331Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
332134
333
334Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
335135
336
337Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
338136
339
340Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
341137
342
343Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
344140
345
346Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
347141
348
349Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
350142
351
352Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
353143
354
355Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
356144
357
358Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
359145
360
361Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
362146
363
364Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
365147
366
367Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
368150
369
370Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
371151
372
373Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
374152
375
376Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
377153
378
379Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
380154
381
382Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
383155
384
385Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
386156
387
388Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
389157
390
391Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
392160
393
394Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
395161
396
397Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
398162
399
400Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
401163
402
403Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
404164
405
406Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
407165
408
409Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
410166
411
412Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
413167
414
415Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
416170
417
418Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
419171
420
421Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
422172
423
424Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
425173
426
427Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
428174
429
430Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
431175
432
433Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
434176
435
436Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
437177
438
439Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
440200
441
442Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
443201
444
445Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
446202
447
448Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
449203
450
451Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
452204
453
454Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
455205
456
457Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
458206
459
460Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
461207
462
463Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
464210
465
466Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
467211
468
469Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
470212
471
472Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
473213
474
475Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
476214
477
478Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
479215
480
481Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
482216
483
484Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
485217
486
487Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
488220
489
490Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
491221
492
493Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
494222
495
496Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
497223
498
499Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
500224
501
502Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
503225
504
505Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
506226
507
508Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
509227
510
511Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
512230
513
514Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
515231
516
517Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
518232
519
520Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
521233
522
523Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
524234
525
526Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
527235
528
529Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
530236
531
532Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
533237
534
535Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
536240
537
538Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
539241
540
541Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
542242
543
544Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
545243
546
547Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
548244
549
550Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
551245
552
553Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
554246
555
556Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
557247
558
559Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
560250
561
562Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
563251
564
565Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
566252
567
568Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
569253
570
571Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
572254
573
574Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
575255
576
577Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
578256
579
580Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
581257
582
583Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
584260
585
586Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
587261
588
589Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
590262
591
592Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
593263
594
595Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
596264
597
598Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
599265
600
601Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
602266
603
604Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
605267
606
607Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
608270
609
610Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
611271
612
613Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
614272
615
616Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
617273
618
619Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
620274
621
622Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
623275
624
625Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
626276
627
628Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20
629277
630*** Done ***
631