diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php index 9840102..00444a8 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php @@ -62,10 +62,13 @@ public function save($name, $code) { * * @param string $directory * The directory path. + * + * @param int $mode + * The mode, permissions, the directory should have. */ - protected function ensureDirectory($directory = NULL, $permission = 0777) { + protected function ensureDirectory($directory = NULL, $mode = 0777) { if (!file_exists($directory)) { - // mkdir() obeys umask() so we need to mkdir() and chhmod() manually. + // mkdir() obeys umask() so we need to mkdir() and chmod() manually. $parts = explode('/', $directory); $path = ''; $delimiter = ''; @@ -76,7 +79,7 @@ protected function ensureDirectory($directory = NULL, $permission = 0777) { // For absolute paths the first part will be empty. if ($part && !file_exists($path)) { mkdir($path); - chmod($path, $permission); + chmod($path, $mode); } } while ($parts); } diff --git a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php b/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php index 61fdf06..3b4e5c5 100644 --- a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php @@ -156,7 +156,7 @@ public function delete($name) { /** * {@inheritdoc} */ - protected function ensureDirectory($directory = NULL, $permission = 0777) { + protected function ensureDirectory($directory = NULL, $mode = 0777) { parent::ensureDirectory($this->directory); $htaccess_path = $this->directory . '/.htaccess'; if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, self::HTACCESS)) { @@ -242,7 +242,7 @@ protected function unlink($path, $delete_top = TRUE) { /** * Tries to invalidate a holder directory. * - * @param $path + * @param string $path * The path to the holder directory. * * @return bool @@ -262,7 +262,7 @@ protected function invalidate($path) { /** * Checks whether the directory is a valid holding directory. * - * @param $directory + * @param string $directory * A directory path. * * @return bool diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php index 5b9b9fb..5c19372 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php @@ -84,6 +84,7 @@ function testSecurity() { // a second of the initial save(). sleep(1); for ($i = 0; $i < 2; $i++) { + $storageFactory = new PhpStorageFactory(); $php = $this->storageFactory->get('simpletest'); $GLOBALS['hacked'] = FALSE; $untrusted_code = "