1--TEST-- 2Test mkdir() function : variation: various valid and invalid paths 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--SKIPIF-- 6<?php 7if(substr(PHP_OS, 0, 3) == "WIN") 8 die("skip Not valid for Windows"); 9?> 10--FILE-- 11<?php 12echo "*** Testing mkdir() : variation ***\n"; 13 14$workDir = "mkdirVar5.tmp"; 15$subDir = "aSubDir"; 16mkdir($workDir); 17$cwd = getcwd(); 18 19$dirs = array( 20 // relative 21 $workDir.'/'.$subDir, 22 './'.$workDir.'/'.$subDir, 23 $workDir.'/../'.$workDir.'/'.$subDir, 24 25 // relative bad path 26 $workDir.'/../BADDIR/'.$subDir, 27 'BADDIR/'.$subDir, 28 29 //absolute 30 $cwd.'/'.$workDir.'/'.$subDir, 31 $cwd.'/./'.$workDir.'/'.$subDir, 32 $cwd.'/'.$workDir.'/../'.$workDir.'/'.$subDir, 33 34 //absolute bad path 35 $cwd.'/BADDIR/'.$subDir, 36 37 //trailing separators 38 $workDir.'/'.$subDir.'/', 39 $cwd.'/'.$workDir.'/'.$subDir.'/', 40 41 // multiple separators 42 $workDir.'//'.$subDir, 43 $cwd.'//'.$workDir.'//'.$subDir, 44 45 ); 46 47 48foreach($dirs as $dir) { 49 echo "-- creating $dir --\n"; 50 $res = mkdir($dir); 51 if ($res === true) { 52 echo "Directory created\n"; 53 rmdir($dir); 54 } 55} 56 57rmdir($workDir); 58 59?> 60--EXPECTF-- 61*** Testing mkdir() : variation *** 62-- creating mkdirVar5.tmp/aSubDir -- 63Directory created 64-- creating ./mkdirVar5.tmp/aSubDir -- 65Directory created 66-- creating mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir -- 67Directory created 68-- creating mkdirVar5.tmp/../BADDIR/aSubDir -- 69 70Warning: mkdir(): No such file or directory in %s on line %d 71-- creating BADDIR/aSubDir -- 72 73Warning: mkdir(): No such file or directory in %s on line %d 74-- creating %s/mkdirVar5.tmp/aSubDir -- 75Directory created 76-- creating %s/./mkdirVar5.tmp/aSubDir -- 77Directory created 78-- creating %s/mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir -- 79Directory created 80-- creating %s/BADDIR/aSubDir -- 81 82Warning: mkdir(): No such file or directory in %s on line %d 83-- creating mkdirVar5.tmp/aSubDir/ -- 84Directory created 85-- creating %s/mkdirVar5.tmp/aSubDir/ -- 86Directory created 87-- creating mkdirVar5.tmp//aSubDir -- 88Directory created 89-- creating %s//mkdirVar5.tmp//aSubDir -- 90Directory created 91