Skip to content

Commit 82a84ad

Browse files
committed
Fixed highly critical security issue on cookie driver
1 parent 7ddf1bb commit 82a84ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/phpFastCache/Drivers/cookie.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function driver_set($keyword, $value = '', $time = 300, $option = array()
7272
{
7373
$this->connectServer();
7474
$keyword = 'phpFastCache_' . $keyword;
75-
$v = $this->encode($value);
75+
$v = json_encode($value);
7676
if(isset($this->config['limited_memory_each_object'])
7777
&& strlen($v) > $this->config['limited_memory_each_object']) {
7878
return false;
@@ -92,7 +92,7 @@ public function driver_get($keyword, $option = array())
9292
// return null if no caching
9393
// return value if in caching
9494
$keyword = 'phpFastCache_' . $keyword;
95-
$x = isset($_COOKIE[ $keyword ]) ? $this->decode($_COOKIE[ $keyword ]) : false;
95+
$x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ]) : false;
9696
if ($x == false) {
9797
return null;
9898
} else {

0 commit comments

Comments
 (0)