[RCD] BUG: please use @file_exists() instead of file_exists()

Thomas Bruederli thomas at roundcube.net
Mon May 26 09:48:24 CEST 2014

On Sun, May 25, 2014 at 10:47 AM, Reindl Harald <h.reindl at thelounge.net> wrote:
> [25-May-2014 05:45:01 Europe/Vienna] PHP Warning:  file_exists(): open_basedir restriction in effect.
> File(vendor/autoload.php) is not within the allowed path(s):
> (/usr/share/roundcubemail:/var/log/roundcubemail:/etc/roundcubemail:/usr/share/pear:/var/www/uploadtemp) in
> /usr/share/roundcubemail/program/include/iniset.php on line 64
> GENERAL: please use @file_exists() everywhere to prevent such messages on production servers
> running witeh E_ALL fro good reasons and sending twice an hour anything from the php errorlog
> via email to the admin which normally is empty

I clearly object against that. Suppressing errors with @ (or with any
other means) should not become a GENERAL habit. Yes, we use @ within
the Roundcube codebase but very selectively and we should even try to
reduce its use. And if open_basedir moans about a prevented file
access attempt, that's clearly something that should catch your
attention in the logs.

Regarding this particular problem with the check for composer's
autoload file, we might want to seek for another solution. I actually
didn't expect any errors coming from a file_exists() check within the
Roundcube install directory but obviously I was wrong with that.

But after dropping support for PHP < 5.3, we could move on to
generally use Composer for managing and pulling 3rd party libs in
Roundcube and get rid of the copies on our git repository. Although
unrelated to your request for generally muting file_exists() errors,
it would solve this access to vendoer/autoload.php because that file
would always exists.


More information about the dev mailing list