Do not exclusively use is_file() on a file that may be a symbolic link, ...

...or in a directory that is a symbolic link:

/usr/share/roundcubemail/config -> /etc/roundcubemail

Additionally, do not use realpath() on such paths.