PHPのfile_exists
関数は、マニュアルによれば失敗したときにE_WARNING
を発生する。
具体的には、open_basedirによってアクセスが許可されていない領域のファイルに対して、file_exists
を実行した場合だ。次のコードで再現できる:
error_reporting(-1);
$file = '/tmp/hoge';
touch($file);
ini_set('open_basedir', '/var/www');
var_dump(file_exists($file)); //=> bool(false)
実行結果
Warning: file_exists(): open_basedir restriction in effect. File(/tmp/hoge) is not within the allowed path(s): (/var/www) in