Skip to content

Commit 77006bd

Browse files
If cache dir is invalid, throw exception
1 parent d01aa16 commit 77006bd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

browscap/Browscap.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,14 @@ public function __construct($cache_dir)
192192
);
193193
}
194194

195-
$cache_dir = realpath($cache_dir);
195+
$old_cache_dir = $cache_dir;
196+
$cache_dir = realpath($cache_dir);
197+
198+
if (false === $cache_dir) {
199+
throw new Browscap_Exception(
200+
sprintf('The cache path %s is invalid. Are you sure that it exists and that you have permission to access it?', $old_cache_dir)
201+
);
202+
}
196203

197204
// Is the cache dir really the directory or is it directly the file?
198205
if (substr($cache_dir, -4) === '.php') {

0 commit comments

Comments
 (0)