ID: 48746
User updated by: ddkees at illinois dot edu
Reported By: ddkees at illinois dot edu
Status: Open
Bug Type: *Directory/Filesystem functions
Operating System: Windows Server 2003
PHP Version: 5.3.0
New Comment:
It should be noted, that using 5.2.9-1 works exactly as expected.
Previous Comments:
------------------------------------------------------------------------
[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