Skip to content

Commit f86110c

Browse files
committed
use kernel resolution for use_realpath: CWD_REALPATH
1 parent 1a02d9e commit f86110c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Zend/zend_virtual_cwd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,8 @@ CWD_API int virtual_access(const char *pathname, int mode) /* {{{ */
13611361
int ret;
13621362

13631363
#ifndef ZEND_WIN32
1364-
if (virtual_path_is_direct(pathname)) {
1364+
if (pathname[0] == '/' &&
1365+
(CWDG(realpath_cache_size_limit) || virtual_path_is_direct(pathname))) {
13651366
return access(pathname, mode);
13661367
}
13671368
#endif
@@ -1582,7 +1583,8 @@ CWD_API int virtual_stat(const char *path, zend_stat_t *buf) /* {{{ */
15821583
int retval;
15831584

15841585
#ifndef ZEND_WIN32
1585-
if (virtual_path_is_direct(path)) {
1586+
if (path[0] == '/' &&
1587+
(CWDG(realpath_cache_size_limit) || virtual_path_is_direct(path))) {
15861588
return php_sys_stat(path, buf);
15871589
}
15881590
#endif
@@ -1606,6 +1608,9 @@ CWD_API int virtual_lstat(const char *path, zend_stat_t *buf) /* {{{ */
16061608
int retval;
16071609

16081610
#ifndef ZEND_WIN32
1611+
/* CWD_EXPAND strips '..' textually (save=0 -> no symlink lookups),
1612+
* but the kernel resolves it physically. Different file
1613+
* when a parent component is a symlink. */
16091614
if (virtual_path_is_direct(path)) {
16101615
return php_sys_lstat(path, buf);
16111616
}

0 commit comments

Comments
 (0)