From: Dmitry Stogov Date: Mon, 18 Aug 2008 10:28:00 +0000 (+0000) Subject: Fixed bug #45835 (include and symlinks) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~663 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6552f469e546269e14f618000b052c6f0e5258ae;p=php Fixed bug #45835 (include and symlinks) --- diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 5cf0d83ad7..804c94b9f5 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -587,6 +587,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i /* not a directory */ return -1; } else { + if (link_is_dir) { + *link_is_dir = bucket->is_dir; + } memcpy(path, bucket->realpath, bucket->realpath_len + 1); return bucket->realpath_len; } @@ -656,6 +659,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i return -1; } } + if (link_is_dir) { + *link_is_dir = directory; + } } else { if (save) { directory = S_ISDIR(st.st_mode); diff --git a/ext/standard/tests/file/realpath_basic4.phpt b/ext/standard/tests/file/realpath_basic4.phpt new file mode 100755 index 0000000000..d782b6d618 --- /dev/null +++ b/ext/standard/tests/file/realpath_basic4.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test realpath() with relative paths +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +1. %s%erealpath_basic%ehome +2. %s%erealpath_basic%ehome%etest