From 241f784ad0b7cd57240da7007ab249b6ee147d88 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 2 Sep 2015 12:12:31 +0200 Subject: [PATCH 1/2] Use "json_encode" and "json_decode" instead of unserialize --- apps/user_ldap/lib/connection.php | 4 ++-- apps/user_ldap/lib/proxy.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 608c9a620698..a558a3c69580 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -206,7 +206,7 @@ public function getFromCache($key) { } $key = $this->getCacheKey($key); - return unserialize(base64_decode($this->cache->get($key))); + return json_decode(base64_decode($this->cache->get($key))); } /** @@ -240,7 +240,7 @@ public function writeToCache($key, $value) { return null; } $key = $this->getCacheKey($key); - $value = base64_encode(serialize($value)); + $value = base64_encode(json_encode($value)); $this->cache->set($key, $value, $this->configuration->ldapCacheTTL); } diff --git a/apps/user_ldap/lib/proxy.php b/apps/user_ldap/lib/proxy.php index ef01213990c0..2a423cb0e4bc 100644 --- a/apps/user_ldap/lib/proxy.php +++ b/apps/user_ldap/lib/proxy.php @@ -161,7 +161,7 @@ public function getFromCache($key) { } $key = $this->getCacheKey($key); - return unserialize(base64_decode($this->cache->get($key))); + return json_decode(base64_decode($this->cache->get($key))); } /** @@ -185,7 +185,7 @@ public function writeToCache($key, $value) { return; } $key = $this->getCacheKey($key); - $value = base64_encode(serialize($value)); + $value = base64_encode(json_encode($value)); $this->cache->set($key, $value, '2592000'); } From a2338752c810dd0d82bff03ceed6d952e999f008 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 29 Jan 2016 07:51:16 +0100 Subject: [PATCH 2/2] [user_ldap] properly decode cached objects * fixes #21896 --- apps/user_ldap/lib/connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index a558a3c69580..4b6f7b01e6ae 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -206,7 +206,7 @@ public function getFromCache($key) { } $key = $this->getCacheKey($key); - return json_decode(base64_decode($this->cache->get($key))); + return json_decode(base64_decode($this->cache->get($key)), true); } /**