From c5e98652982d0d04b4687f7779d2a0e4f7c936c8 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 12 May 2012 20:14:48 +0200 Subject: Hide notice when getting key from memcache This looks horrible, but gets the job done... Signed-off-by: Florian Pritz --- application/libraries/MemcacheLibrary.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'application/libraries') diff --git a/application/libraries/MemcacheLibrary.php b/application/libraries/MemcacheLibrary.php index dcc08b942..dc993b7a5 100644 --- a/application/libraries/MemcacheLibrary.php +++ b/application/libraries/MemcacheLibrary.php @@ -90,7 +90,15 @@ class MemcacheLibrary { */ public function get($key) { $this->logDebugMessage(sprintf("%s key requested from memcache", $key)); - return $this->memcachedInstance->get($key); + + // hide notice if server is unreachable + $old_error_level = error_reporting(); + error_reporting($old_error_level & ~E_NOTICE); + + $ret = $this->memcachedInstance->get($key); + + error_reporting($old_error_level); + return $ret; } /** -- cgit v1.2.3-24-g4f1b