tempnam accepts a directory as its first parameter, not a full path and filename.
tempnam falls back to creating a file in the system's temp directory. On systems with open_basedir restrictions, this may trigger an error message. By moving this below the checkTemporaryDirectory-loop, tempnam will only be tested if all alternatives fail and the error message is most likely avoided.
This commit is contained in:
parent
05f9b40419
commit
3a5087ccdf
|
@ -225,11 +225,6 @@ class TempManager implements ITempManager {
|
||||||
if ($temp = getenv('TMPDIR')) {
|
if ($temp = getenv('TMPDIR')) {
|
||||||
$directories[] = $temp;
|
$directories[] = $temp;
|
||||||
}
|
}
|
||||||
$temp = tempnam(__FILE__, '');
|
|
||||||
if (file_exists($temp)) {
|
|
||||||
unlink($temp);
|
|
||||||
$directories[] = dirname($temp);
|
|
||||||
}
|
|
||||||
if ($temp = sys_get_temp_dir()) {
|
if ($temp = sys_get_temp_dir()) {
|
||||||
$directories[] = $temp;
|
$directories[] = $temp;
|
||||||
}
|
}
|
||||||
|
@ -239,6 +234,12 @@ class TempManager implements ITempManager {
|
||||||
return $dir;
|
return $dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$temp = tempnam(dirname(__FILE__), '');
|
||||||
|
if (file_exists($temp)) {
|
||||||
|
unlink($temp);
|
||||||
|
return dirname($temp);
|
||||||
|
}
|
||||||
throw new \UnexpectedValueException('Unable to detect system temporary directory');
|
throw new \UnexpectedValueException('Unable to detect system temporary directory');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue