]> granicus.if.org Git - php/commitdiff
Fixed bug #40560 (DIR functions do not work on root UNC path)
authorDmitry Stogov <dmitry@php.net>
Wed, 21 Feb 2007 13:09:03 +0000 (13:09 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 21 Feb 2007 13:09:03 +0000 (13:09 +0000)
NEWS
TSRM/tsrm_virtual_cwd.c

diff --git a/NEWS b/NEWS
index 12e0cce8b0a487a7cee6c7d7b34fc7f04ae130db..21346e22c054562d879a98e6a6e595a52c3c223f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP                                                                        NEWS
 - Added --ri switch to CLI which allows to check extension information. (Marcus)
 - Added tidyNode::getParent() method (John, Nuno)
 - Fixed zend_llist_remove_tail (Michael Wallner, Dmitry)
+- Fixed bug #40560 (DIR functions do not work on root UNC path). (Dmitry)
 - Fixed bug #40548 (SplFileInfo::getOwner/getGroup give a warning on broken
   symlink). (Marcus)
 - Fixed bug #40546 (SplFileInfo::getPathInfo() throws an execption if directory
index 78db6c0be98af1fe8aff7b3e80d72aba300493cb..fd253309eeea4042e45dfc59e0eb0469fd643273 100644 (file)
@@ -550,13 +550,16 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
                char *ptr, *path_copy, *free_path;
                char *tok;
                int ptr_length;
-
+#ifdef TSRM_WIN32
+               int is_unc;
+#endif
 no_realpath:
 
                free_path = path_copy = tsrm_strndup(path, path_length);
                CWD_STATE_COPY(&old_state, state);
 
-#ifdef TSRM_WIN32              
+#ifdef TSRM_WIN32
+               is_unc = 0;
                if (path_length >= 2 && path[1] == ':') {                       
                        state->cwd = (char *) realloc(state->cwd, 2 + 1);
                        state->cwd[0] = toupper(path[0]);
@@ -570,6 +573,7 @@ no_realpath:
                        state->cwd[1] = '\0';
                        state->cwd_length = 1;
                        path_copy += 2;
+                       is_unc = 2;
                } else {
 #endif
                        state->cwd = (char *) realloc(state->cwd, 1);
@@ -651,7 +655,13 @@ no_realpath:
                                                FindClose(hFind);
                                                ret = 0;
                                        } else if (use_realpath == CWD_REALPATH) {
-                                               ret = 1;
+                                               if (is_unc) {
+                                                       /* skip share name */
+                                                       is_unc--;
+                                                       ret = 0;
+                                               } else {
+                                                       ret = 1;
+                                               }
                                        }
                                }
 #endif