]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #14049 (realpath() w/ZTS returns invalid results for non-existent
authorIlia Alshanetsky <iliaa@php.net>
Wed, 10 Sep 2003 00:22:20 +0000 (00:22 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 10 Sep 2003 00:22:20 +0000 (00:22 +0000)
paths)

NEWS
ext/standard/file.c

diff --git a/NEWS b/NEWS
index 781c87f88955078748cd8bcaa912c5af267962d8..4f71142677cedbc8aad9d0caaa2475a96d968e68 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,8 @@ PHP 4                                                                      NEWS
 - Fixed bug #23326 (ext/domxml: Attributes via append_child not supported).
   (Melvyn)
 - Fixed bug #21220 (Wrong Apache version shown in phpinfo() output). (Jani)
+- Fixed bug #14049 (realpath() w/ZTS returns invalid results for non-existent
+  paths). (Ilia)
 
 25 Aug 2003, Version 4.3.3
 - Upgraded the bundled Expat library to version 1.95.6. (Jani)
index ff45fe74b98433ba2a30d01a0c4f444651b23e49..8363666f79b210fd653db73e395f6cb0af2dbff0 100644 (file)
@@ -43,6 +43,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #ifdef PHP_WIN32
+#include <io.h>
 #include <windows.h>
 #include <winsock.h>
 #define O_RDONLY _O_RDONLY
@@ -2378,6 +2379,15 @@ PHP_FUNCTION(realpath)
        convert_to_string_ex(path);
 
        if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) {
+#if ZTS
+# if PHP_WIN32
+               if (_access(resolved_path_buff, 0))
+                       RETURN_FALSE;
+# else
+               if (access(resolved_path_buff, F_OK))
+                       RETURN_FALSE;
+# endif
+#endif
                RETURN_STRING(resolved_path_buff, 1);
        } else {
                RETURN_FALSE;