[ticket/14934] Do not rely on open basedir being properly set

PHPBB3-14934
This commit is contained in:
Marc Alexander 2016-12-25 22:19:03 +01:00
parent c6aa4a319d
commit 97b834c3ef
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -13,8 +13,6 @@
namespace phpbb\di;
use bantu\IniGetWrapper\IniGetWrapper;
use phpbb\filesystem\filesystem;
use ProxyManager\Configuration;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
@ -45,11 +43,8 @@ class proxy_instantiator implements InstantiatorInterface
// Prevent trying to write to system temp dir in case of open_basedir
// restrictions being in effect
$ini_wrapper = new IniGetWrapper();
$filesystem = new filesystem();
$tmp_dir = (function_exists('sys_get_temp_dir')) ? sys_get_temp_dir() : '';
if (empty($tmp_dir) || $ini_wrapper->getString('open_basedir') &&
(!@file_exists($tmp_dir) || !@is_writable($tmp_dir)))
if (empty($tmp_dir) || !@file_exists($tmp_dir) || !@is_writable($tmp_dir))
{
$config->setProxiesTargetDir($cache_dir);
}