From: ddkees at illinois dot edu Operating system: Windows Server 2003 PHP version: 5.3.0 PHP Bug Type: *Directory/Filesystem functions Bug description: Unable to browse directories within Junction Points
Description: ------------ After updating this morning (June 30) to 5.3.0, our __autoload() function failed to identify any classes located in subfolders of the windows Junction Point which contains our class files. Our __autoload() function is recursive, descending into the filesystem looking for class files which match the one that we're trying to load. However, since the /includes/classes folder is a Junction Point, only other Junction Points return true when we use both is_dir() and DirectoryIterator::isDir() to try and identify folders from files. DirectoryIterator::isLink() also returns false. However, if we change our __autoloader() to include files from the source of the Junction Point, it works as expected, but this is only a solution for a sub-set of the sites that are available on our server. Reproduce code: --------------- function __autoload($class) { if(!function_exists("find_file")) { function find_file($directory, $target) { $dir = opendir($directory); while(($file = readdir($dir))!==false) { if($file == "_notes" || substr($file, 0, 1)==".") continue; if(is_dir($directory . "/" . $file)) find_file($directory . "/" . $file, $target); elseif(basename($file, ".php") == $target) { require_once($directory . "/" . $file); return; } } } } find_file($_SERVER['DOCUMENT_ROOT'] . "includes/classes", strtolower($class)); } Expected result: ---------------- The expected result is that starting from $_SERVER["DOCUMENT_ROOt"] . "/includes/classes" we identify folders and descend into them to look for a file named $class.php where $class is the parameter sent to __autoload(). When that file is found, it's included. Actual result: -------------- No folders are actually traversed, either when using the code above or when altering it to use the DirectoryIteratory SPL object. All non-Junction Points return false from is_dir() and, as a result, they are never traversed and the system will also attempt to include them as files if the elseif-conditional evaluates to true. -- Edit bug report at http://bugs.php.net/?id=48746&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48746&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48746&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48746&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48746&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48746&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48746&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48746&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48746&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48746&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48746&r=support Expected behavior: http://bugs.php.net/fix.php?id=48746&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48746&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48746&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48746&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48746&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48746&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48746&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48746&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48746&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48746&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48746&r=mysqlcfg