*/
public static function isReachableFilePath (SplFileInfo $fileInstance) {
// Is not reachable by default
+ //* NOISY-DEBUG: */ printf('[%s:%d]: fileInstance=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, get_class($fileInstance));
$isReachable = false;
// Get open_basedir parameter
$openBaseDir = trim(ini_get('open_basedir'));
// Is it set?
+ //* NOISY-DEBUG: */ printf('[%s:%d]: openBaseDir=%s' . PHP_EOL, __METHOD__, __LINE__, $openBaseDir);
if (!empty($openBaseDir)) {
// Check all entries
foreach (explode(PATH_SEPARATOR, $openBaseDir) as $dir) {
// Check on existence
+ //* NOISY-DEBUG: */ printf('[%s:%d]: dir=%s' . PHP_EOL, __METHOD__, __LINE__, $dir);
if (substr($fileInstance->getPathname(), 0, strlen($dir)) == $dir) {
// Is reachable
$isReachable = true;
// Abort lookup as it has been found in open_basedir
+ //* NOISY-DEBUG: */ printf('[%s:%d]: BREAK!' . PHP_EOL, __METHOD__, __LINE__);
break;
}
}
} else {
// If open_basedir is not set, all is allowed
+ //* NOISY-DEBUG: */ printf('[%s:%d]: All is allowed - BREAK!' . PHP_EOL, __METHOD__, __LINE__);
$isReachable = true;
}
// Return status
+ //* NOISY-DEBUG: */ printf('[%s:%d]: isReachable=%d - EXIT' . PHP_EOL, __METHOD__, __LINE__, intval($isReachable));
return $isReachable;
}