Home  |  Linux  | Mysql  | PHP  | XML
Date:Tue Jun 30 17:58:46 2009
Subject:#48746 [Opn->Fbk]: Unable to browse directories within Junction Points
ID: 48746
Updated by: pajoye@php.net
Reported By: ddkees at illinois dot edu
-Status: Open
+Status: Feedback
Bug Type: *Directory/Filesystem functions
Operating System: Windows Server 2003
PHP Version: 5.3.0
-Assigned To:
+Assigned To: pajoye
New Comment:

Please provide a simple example to show what exactly does not work,
which function or method exactly and using which path:

- describe the directory tree you use and which parts of it are
junction
- provide a simple script to show which function(s) fail(s)




Previous Comments:
------------------------------------------------------------------------

[2009-06-30 17:35:59] ddkees at illinois dot edu

It should be noted, that using 5.2.9-1 works exactly as expected.

------------------------------------------------------------------------

[2009-06-30 17:19:27] ddkees at illinois dot edu

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 this bug report at http://bugs.php.net/?id=48746&edit=1

Navigate in group php.bugs at sever news.php.net
Previous Next





  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.