From 72e5f9d3952647633d60c82fad57f5bf13f18f30 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 10 Sep 2003 00:22:20 +0000 Subject: [PATCH] MFH: Fixed bug #14049 (realpath() w/ZTS returns invalid results for non-existent paths) --- NEWS | 2 ++ ext/standard/file.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 781c87f889..4f71142677 100644 --- 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) diff --git a/ext/standard/file.c b/ext/standard/file.c index ff45fe74b9..8363666f79 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -43,6 +43,7 @@ #include #include #ifdef PHP_WIN32 +#include #include #include #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; -- 2.50.1