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} 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 0000 to 0350, 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 0000 to 0350 ***\n"; 30$file_path = dirname(__FILE__); 31$dir_name = $file_path."/tempnam_variation4"; 32$prefix = "tempnamVar4."; 33 34mkdir($dir_name); 35 36for($mode = 0000; $mode <= 0350; $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 0000 to 0350 *** 62 63Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 640 65 66Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 671 68 69Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 702 71 72Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 733 74 75Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 764 77 78Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 795 80 81Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 826 83 84Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 857 86 87Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 8810 89 90Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 9111 92 93Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 9412 95 96Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 9713 98 99Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 10014 101 102Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 10315 104 105Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 10616 107 108Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 10917 110 111Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 11220 113 114Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 11521 116 117Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 11822 119 120Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 12123 122 123Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 12424 125 126Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 12725 128 129Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 13026 131 132Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 13327 134 135Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 13630 137 138Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 13931 140 141Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 14232 143 144Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 14533 146 147Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 14834 149 150Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 15135 152 153Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 15436 155 156Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 15737 158 159Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 16040 161 162Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 16341 164 165Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 16642 167 168Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 16943 170 171Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 17244 173 174Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 17545 176 177Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 17846 179 180Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 18147 182 183Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 18450 185 186Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 18751 188 189Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 19052 191 192Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 19353 194 195Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 19654 197 198Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 19955 200 201Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 20256 203 204Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 20557 206 207Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 20860 209 210Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 21161 212 213Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 21462 215 216Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 21763 218 219Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 22064 221 222Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 22365 224 225Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 22666 227 228Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 22967 230 231Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 23270 233 234Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 23571 236 237Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 23872 239 240Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 24173 242 243Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 24474 245 246Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 24775 248 249Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 25076 251 252Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 25377 254 255Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 256100 257 258Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 259101 260 261Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 262102 263 264Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 265103 266 267Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 268104 269 270Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 271105 272 273Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 274106 275 276Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 277107 278 279Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 280110 281 282Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 283111 284 285Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 286112 287 288Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 289113 290 291Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 292114 293 294Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 295115 296 297Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 298116 299 300Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 301117 302 303Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 304120 305 306Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 307121 308 309Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 310122 311 312Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 313123 314 315Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 316124 317 318Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 319125 320 321Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 322126 323 324Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 325127 326 327Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 328130 329 330Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 331131 332 333Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 334132 335 336Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 337133 338 339Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 340134 341 342Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 343135 344 345Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 346136 347 348Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 349137 350 351Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 352140 353 354Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 355141 356 357Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 358142 359 360Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 361143 362 363Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 364144 365 366Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 367145 368 369Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 370146 371 372Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 373147 374 375Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 376150 377 378Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 379151 380 381Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 382152 383 384Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 385153 386 387Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 388154 389 390Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 391155 392 393Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 394156 395 396Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 397157 398 399Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 400160 401 402Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 403161 404 405Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 406162 407 408Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 409163 410 411Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 412164 413 414Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 415165 416 417Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 418166 419 420Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 421167 422 423Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 424170 425 426Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 427171 428 429Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 430172 431 432Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 433173 434 435Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 436174 437 438Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 439175 440 441Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 442176 443 444Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 445177 446 447Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 448200 449 450Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 451201 452 453Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 454202 455 456Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 457203 458 459Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 460204 461 462Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 463205 464 465Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 466206 467 468Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 469207 470 471Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 472210 473 474Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 475211 476 477Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 478212 479 480Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 481213 482 483Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 484214 485 486Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 487215 488 489Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 490216 491 492Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 493217 494 495Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 496220 497 498Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 499221 500 501Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 502222 503 504Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 505223 506 507Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 508224 509 510Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 511225 512 513Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 514226 515 516Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 517227 518 519Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 520230 521 522Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 523231 524 525Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 526232 527 528Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 529233 530 531Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 532234 533 534Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 535235 536 537Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 538236 539 540Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 541237 542 543Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 544240 545 546Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 547241 548 549Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 550242 551 552Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 553243 554 555Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 556244 557 558Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 559245 560 561Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 562246 563 564Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 565247 566 567Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 568250 569 570Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 571251 572 573Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 574252 575 576Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 577253 578 579Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 580254 581 582Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 583255 584 585Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 586256 587 588Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 589257 590 591Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 592260 593 594Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 595261 596 597Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 598262 599 600Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 601263 602 603Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 604264 605 606Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 607265 608 609Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 610266 611 612Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 613267 614 615Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 616270 617 618Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 619271 620 621Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 622272 623 624Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 625273 626 627Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 628274 629 630Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 631275 632 633Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 634276 635 636Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation4-0.php on line 20 637277 638*** Done *** 639