Re: tempnam() not working as expected...

From: Date: Fri, 13 Apr 2012 22:44:27 +0000
Subject: Re: tempnam() not working as expected...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-317551@lists.php.net to get a copy of this message
On Sat, Apr 14, 2012 at 12:05 AM, tamouse mailing lists <tamouse.lists@gmail.com> wrote: > Can someone explain the following to me: > > > <?php > $d=tempnam(".","dir");          /* create a temp named file */ > unlink($d);                     /* unlink it because we're going to make it a > directory */ > mkdir($d,777,true);             /* make the directory */ > echo "$d is ". (is_dir($d)?'':'NOT')." a directory\n"; > > > $f=tempnam($d,"file");          /* using the first directory, create a new > temp named file */ > unlink($f);                     /* unlink it as we're going to make it a > directory */ > mkdir($f,777,true);             /* make the directory */ > echo "$f is ". (is_dir($f)?'':'NOT')." a directory\n"; > ?> > > /Users/tamara/Sites/gallery/lib/common/t/dirGuWOLW is  a directory > /private/var/folders/pI/pIx-p0mhH5eEQ64yAiDQmE+++TI/-Tmp-/fileC7Rnzg > is  a directory > > Why isn't the second tempnam using the directory path I pass to it? > > The strange thing I notice is that if I pass in a directory path to > tempnam that was NOT created initially by tempnam, it works: > > miishka:t tamara$ mkdir a > miishka:t tamara$ php -r 'echo > tempnam("/Users/tamara/Sites/gallery/lib/common/t/a","file").PHP_EOL;' > /Users/tamara/Sites/gallery/lib/common/t/a/filepSwRzF > miishka:t tamara$ > Can you check what the permissions of $d are?

« previous php.general (#317551) next »