|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30383 function reports: c:/ exists; c:/new not exists; c:/new/new exists;
Submitted: 2004-10-10 19:11 UTC Modified: 2015-06-21 04:22 UTC
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: federico at santulli dot it Assigned: cmb (profile)
Status: No Feedback Package: *General Issues
PHP Version: 4.3.9 OS: Windows Server 2003
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-10-10 19:11 UTC] federico at santulli dot it
using server 2003 with iis6
a file_exists used on a tree of directory reports:

file_exists("c:") = true
file_exists("c:/new") = false
file_exists("c:/new/new") = true

second call is wrong.

it happens with all first directories on a drive root

Reproduce code:
            $dir = "d:/new/new";
            $dir_parts = preg_split('!/+!', $dir, -1, PREG_SPLIT_NO_EMPTY);
            $new_dir = ($dir{0} == '/') ? '/' : '';
            foreach ($dir_parts as $dir_part) {
                $new_dir .= $dir_part;
                if(file_exists($new_dir)) {
                  echo "$new_dir exists\n";
                else {
                  echo "$new_dir doesn't exists\n";
                $new_dir .= '/';

Expected result:
d: exists
d:/new exists 
d:/new/new exists 

Actual result:
d: exists
d:/new doesn't exists
d:/new/new exists 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-07 23:24 UTC]
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: cmb
 [2015-06-07 23:24 UTC]
I can't reproduce this issue on Windows 7 with recent PHP
versions; not even with PHP 5.2.5.

Is that still an issue for others?
 [2015-06-21 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 13:01:29 2024 UTC