[HttpFoundation][Sessions] Micro-optimization
This commit is contained in:
parent
9bf3cb4e97
commit
ff273af546
@ -39,14 +39,13 @@ class NativeFileSessionHandler extends NativeSessionHandler
|
|||||||
|
|
||||||
$baseDir = $savePath;
|
$baseDir = $savePath;
|
||||||
|
|
||||||
if (strpos($baseDir, ';') !== false) {
|
if ($count = substr_count($savePath, ';')) {
|
||||||
$parts = explode(';', $baseDir);
|
if ($count > 2) {
|
||||||
if (count($parts) > 3) {
|
|
||||||
throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
|
throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
// characters after last ';' is the path
|
// characters after last ';' are the path
|
||||||
$baseDir = substr($baseDir, strrpos($baseDir, ';')+1, strlen($baseDir));
|
$baseDir = ltrim(strrchr($savePath, ';'), ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($baseDir && !is_dir($baseDir)) {
|
if ($baseDir && !is_dir($baseDir)) {
|
||||||
|
Reference in New Issue
Block a user