--- TSRM/tsrm_virtual_cwd.c.orig Sat Nov 4 00:56:05 2006 +++ TSRM/tsrm_virtual_cwd.c Sat Nov 4 00:58:03 2006 @@ -562,7 +562,11 @@ } if (use_realpath && CWDG(realpath_cache_size_limit)) { - realpath_cache_add(path, path_length, state->cwd, state->cwd_length, t TSRMLS_CC); + struct stat buf; + + if (lstat(path, &buf) == 0 && !S_ISLNK(buf.st_mode)) { + realpath_cache_add(path, path_length, state->cwd, state->cwd_length, t TSRMLS_CC); + } } if (verify_path && verify_path(state)) {