Reputation: 7353
Is it possible to check this before failing ?
if (is_in_open_basedir($path)) {
}
Upvotes: 3
Views: 1203
Reputation: 35179
I know this does not answer the question exactly, but maybe the motivation behind it:
If you do not need to check before the call and just want to avoid warnings, on functions that access other dirs, another approach would be to use the @
operator and check error_get_last
error_clear_last();
$isDir = @is_dir('/');
if (error_get_last() !== null) {
$isDir = 'cannot-detect';
}
Upvotes: 0
Reputation: 1062
You can use ini_get to get the current value of open_basedir to check against the other value.
Upvotes: 0
Reputation: 73
This is not a php standard function. To handle exceptions you can use:
try {
}
catch( $e ) {
}
Check this: PHP Exceptions
Upvotes: -4