ID: 48746
Comment by: phpstuff at cresstone dot com
Reported By: ddkees at illinois dot edu
Status: Feedback
Bug Type: Directory function related
Operating System: win32 only - Windows Server 2003
PHP Version: 5.3.0
Assigned To: pajoye
New Comment:
cgi executable does not seem to make a difference. This is a console
log of a test I just ran:
C:\mnt\test>type phptest.php
<?php
var_dump(file_exists('junction'));
var_dump(file_exists('directory'));
?>
C:\mnt\test>dir
Volume in drive C is coreI7_System
Volume Serial Number is 38E2-2B62
Directory of C:\mnt\test
2009.08.10 16.11 <DIR> .
2009.08.10 16.11 <DIR> ..
2009.08.10 16.10 <DIR> directory
2009.08.10 16.10 <JUNCTION> junction
[\??\Volume{e13ba66a-14db-11de-8e96-001fd0ae05ac}\]
2009.08.10 16.11 82 phptest.php
1 File(s) 82 bytes
4 Dir(s) 24,899,223,552 bytes free
C:\mnt\test>php.exe phptest.php
bool(false)
bool(true)
C:\mnt\test>php-cgi.exe phptest.php
X-Powered-By: PHP/5.3.0
Content-type: text/html
bool(false)
bool(true)
C:\mnt\test>
Previous Comments:
------------------------------------------------------------------------
[2009-08-10 15:40:17] [email protected]
@dr dot e dot sheppard at web dot de
Can you try using CLI/CGI please? As you can see below it works just
fine.
C:\Users\pierre\Documents\php-sdk\php53\vc9\x86>dir
..
10.08.2009 17:36 <JUNCTION> apps
[C:\Users\pierre\Documents\php-sdk\php53\vc9\x86\deps]
28.07.2009 00:59 <DIR> deps
...
php.exe -r "var_dump(file_exists('./apps'));"
bool(true)
------------------------------------------------------------------------
[2009-06-30 20:30:47] dr dot e dot sheppard at web dot de
This bug can easily be reproduced with the following scenario:
- change to a directory within your webserver's document root
- create a junction named "apps" pointing to the desired target within
the directory tree
- calling a php file (residing in parallel to the "apps" folder) with
the following code:
if(file_exists('./apps') === true){
echo 'yes!';
} else {
echo 'no!';
}
The result will be "no!".
------------------------------------------------------------------------
[2009-06-30 19:10:21] ddkees at illinois dot edu
The file structure looks like this. Junction points are followed by an
asterisk; that asterisk is _not_ a part of the folder's name within the
filesystem.
/
/includes
/includes/classes*
/includes/classes/.SwiftMailer
/includes/classes/course_websites
/includes/classes/directory
/includes/classes/faculty_awards*
/includes/classes/FirePHP
There are more folders than what's listed above, but that's enough to
give you the idea, I hope. If not, let me know.
As you can see from the code example above, we start the process in
/includes/classes and look for folders/files to identify class
definitions to include. Using this code and 5.3.0 this morning, we
found that, using the above list, only the faculty_awards junction point
would be identified as a directory when using is_dir() and when using
DirectoryIterator::isDir().
Here's a script to show what fails:
function find_directories($directory) {
$files = new DirectoryIterator($directory);
foreach($files as $file) {
if($file->isDot() || $file->getFilename()=="_notes") continue;
echo "Analyzing: $file<br>";
var_dump($file->isDir());
echo "Analysis Complete.<br><br>";
}
}
---
If we execute that function as follows:
find_directories($_SERVER["DOCUMENT_ROOT"] . "/includes/classes");
We would expect that all of the information listed above would result
in true. However, the actual results of that test were:
Analyzing: .SwiftMailer
bool(false) Analysis Complete
Analyzing: course_websites
bool(false) Analysis Complete
Analyzing: directories
bool(false) Analysis Complete
Analyzing: faculty_awards
bool(true) Analysis Complete
Analyzing: FirePHP
bool(false) Analysis Complete
------------------------------------------------------------------------
[2009-06-30 17:58:46] [email protected]
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)
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/48746
--
Edit this bug report at http://bugs.php.net/?id=48746&edit=1