Justtechjobs.com Find a programming school near you






Online Campus Both


php-developer-list | 2001122

[PHP-DEV] Bug #14657: Sometimes mkdir("test1", "0777"); $d=dir("test1"); $d->close(); rmdir("test1"); From: adrozdov <email protected>
Date: 12/22/01

From: adrozdov <email protected>
Operating system: Windows XP
PHP version: 4.1.0
PHP Bug Type: *Directory/Filesystem functions
Bug description: Sometimes mkdir("test1", "0777"); $d=dir("test1"); $d->close(); rmdir("test1");

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();
 ?>

-- 
Edit bug report at: http://bugs.php.net/?id=14657&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>