function inOpenBasedir()

in src/Functions.php [27:52]


function inOpenBasedir($filename, $throwException = false)
{
    $open_basedir = ini_get('open_basedir');
    if (!$open_basedir) {
        return true;
    }

    $dirs = explode(PATH_SEPARATOR, $open_basedir);
    if (empty($dirs)) {
        return true;
    }

    if (inDir($filename, $dirs)) {
        return true;
    }

    if ($throwException === false) {
        return false;
    }

    throw new ClientException(
        'open_basedir restriction in effect. '
        . "File($filename) is not within the allowed path(s): ($open_basedir)",
        'SDK.InvalidPath'
    );
}