php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14657 Sometimes mkdir("test1", "0777"); $d=dir("test1"); $d->close(); rmdir("test1");
Submitted: 2001-12-22 05:45 UTC Modified: 2002-07-29 09:17 UTC
From: adrozdov at mail dot ru Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 4.1.0 OS: Windows XP
Private report: No CVE-ID: None
 [2001-12-22 05:45 UTC] adrozdov at mail dot ru
Environment:
  Windows XP, FAT32, Apache (latest), MySQL (3.23.xx)

Origin:
  I've been installed php 4.1.0 and was writing a proc
  who removes a tree of directories. Trivial task. I've
  doing that many times on Unix machines. With no
  problems. But here're my WinXP home workbox. 
  I was surprised when I got a following error 
    Warning: RmDir failed (Permission denied)
  
Searching the solution:
  1) I've deleted 4.1.0 and installed 4.0.5. 
     "Effect" present.
  2) I've cut off all of stupid code. Only code like 
     in summary stayed. "Effect" present.
  3) I've deleted $d=dir(..); $d->close(); Wow! All is 
     working! What the f$ck?
  4) Here vooodo jumping around the fire during about 3 
     hrs. At least I suppose some bug in $d->close()
     relization and tried _to_add_one_more_$d->close()!!!
     And it worked as it should be so!!!

I've phpinfo() dumps for working and unworking variants. But I don't know who to send them.

Script:
<?php

function indir() {
  print "BEGIN<br>"; 
  mkdir("test1","0777"); 
  mkdir("test1/test2","0777"); 
  $d = dir("./test1/test2");
  
  // .. do something with $d.. here we'll do nothing ;)
   
  // !!!!!!!!!!!!!!!!!!!!! 
  $d->close(); // logically that's all! 
//  print "Second close on!<br>"; $d->close(); // but.. try to comment these one - you'll get an error! 
  // !!!!!!!!!!!!!!!!!!!!!
  
  rmdir("test1/test2"); 
  rmdir("test1"); 
  
  echo "END<br>";
};

indir();
print phpinfo();
 ?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-22 05:55 UTC] sander@php.net
Simplified: 

mkdir("c:/test",0777);
$d=dir("c:/test");
$d->close();
rmdir("c:/test");

Doesn't work. rmdir says Permission denied.
Only if you call $d->close() twice it will work.

Reproduced with 4.1.0 on Windows 2000.
 [2002-06-04 16:25 UTC] mfischer@php.net
Verified with CVS HEAD (on w2kpro), setting to critical (fix before 4.3)
 [2002-06-29 14:07 UTC] steph dot fox at btinternet dot com
It might be useful to know that there's no problem at all on either win98 or *nix ..
 [2002-07-29 09:17 UTC] sfox@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC