aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/cache/driver
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-03-05 16:02:48 +0100
committerMarc Alexander <admin@m-a-styles.de>2015-03-05 16:02:48 +0100
commita33c99b3fdb87ddbab1911b0b45d022319cbf90d (patch)
tree52c4fe56a305fc056f2818684e4e93e5ac03f79b /phpBB/phpbb/cache/driver
parentf85d49aada4f3c6c8a56a555a45f46811a917dca (diff)
parentd0ab101c32c387a424544fae43d8955b8799d713 (diff)
downloadforums-a33c99b3fdb87ddbab1911b0b45d022319cbf90d.tar
forums-a33c99b3fdb87ddbab1911b0b45d022319cbf90d.tar.gz
forums-a33c99b3fdb87ddbab1911b0b45d022319cbf90d.tar.bz2
forums-a33c99b3fdb87ddbab1911b0b45d022319cbf90d.tar.xz
forums-a33c99b3fdb87ddbab1911b0b45d022319cbf90d.zip
Merge branch '3.1.x'
Diffstat (limited to 'phpBB/phpbb/cache/driver')
-rw-r--r--phpBB/phpbb/cache/driver/file.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php
index 9c63d0010c..32086458ee 100644
--- a/phpBB/phpbb/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
@@ -285,6 +285,7 @@ class file extends \phpbb\cache\driver\base
if ($var_name[0] == '_')
{
global $phpEx;
+ $var_name = $this->clean_varname($var_name);
return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
}
else
@@ -340,6 +341,7 @@ class file extends \phpbb\cache\driver\base
{
global $phpEx;
+ $filename = $this->clean_varname($filename);
$file = "{$this->cache_dir}$filename.$phpEx";
$type = substr($filename, 0, strpos($filename, '_'));
@@ -522,6 +524,7 @@ class file extends \phpbb\cache\driver\base
{
global $phpEx;
+ $filename = $this->clean_varname($filename);
$file = "{$this->cache_dir}$filename.$phpEx";
$lock = new \phpbb\lock\flock($file);
@@ -590,4 +593,15 @@ class file extends \phpbb\cache\driver\base
return $return_value;
}
+
+ /**
+ * Replace slashes in the file name
+ *
+ * @param string $varname name of a cache variable
+ * @return string $varname name that is safe to use as a filename
+ */
+ protected function clean_varname($varname)
+ {
+ return str_replace('/', '-', $varname);
+ }
}