[ci skip] Proper error handling for Sessions on PHP 5

This was actually a PHP bug, see https://wiki.php.net/rfc/session.user.return-value

Also related: #4039
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index 97b8605..760239d 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -117,7 +117,7 @@
 		{
 			$this->_memcached = NULL;
 			log_message('error', 'Session: Invalid Memcached save path format: '.$this->_config['save_path']);
-			return FALSE;
+			return $this->_failure;
 		}
 
 		foreach ($matches as $match)
@@ -142,10 +142,10 @@
 		if (empty($server_list))
 		{
 			log_message('error', 'Session: Memcached server pool is empty.');
-			return FALSE;
+			return $this->_failure;
 		}
 
-		return TRUE;
+		return $this->_success;
 	}
 
 	// ------------------------------------------------------------------------
@@ -170,7 +170,7 @@
 			return $session_data;
 		}
 
-		return FALSE;
+		return $this->_failure;
 	}
 
 	// ------------------------------------------------------------------------
@@ -188,14 +188,14 @@
 	{
 		if ( ! isset($this->_memcached))
 		{
-			return FALSE;
+			return $this->_failure;
 		}
 		// Was the ID regenerated?
 		elseif ($session_id !== $this->_session_id)
 		{
 			if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id))
 			{
-				return FALSE;
+				return $this->_failure;
 			}
 
 			$this->_fingerprint = md5('');
@@ -210,16 +210,18 @@
 				if ($this->_memcached->set($this->_key_prefix.$session_id, $session_data, $this->_config['expiration']))
 				{
 					$this->_fingerprint = $fingerprint;
-					return TRUE;
+					return $this->_success;
 				}
 
-				return FALSE;
+				return $this->_failure;
 			}
 
-			return $this->_memcached->touch($this->_key_prefix.$session_id, $this->_config['expiration']);
+			return $this->_memcached->touch($this->_key_prefix.$session_id, $this->_config['expiration'])
+				? $this->_success
+				: $this->_failure;
 		}
 
-		return FALSE;
+		return $this->_failure;
 	}
 
 	// ------------------------------------------------------------------------
@@ -238,14 +240,14 @@
 			isset($this->_lock_key) && $this->_memcached->delete($this->_lock_key);
 			if ( ! $this->_memcached->quit())
 			{
-				return FALSE;
+				return $this->_failure;
 			}
 
 			$this->_memcached = NULL;
-			return TRUE;
+			return $this->_success;
 		}
 
-		return FALSE;
+		return $this->_failure;
 	}
 
 	// ------------------------------------------------------------------------
@@ -263,10 +265,11 @@
 		if (isset($this->_memcached, $this->_lock_key))
 		{
 			$this->_memcached->delete($this->_key_prefix.$session_id);
-			return $this->_cookie_destroy();
+			$this->_cookie_destroy();
+			return $this->_success;
 		}
 
-		return FALSE;
+		return $this->_failure;
 	}
 
 	// ------------------------------------------------------------------------
@@ -282,7 +285,7 @@
 	public function gc($maxlifetime)
 	{
 		// Not necessary, Memcached takes care of that.
-		return TRUE;
+		return $this->_success;
 	}
 
 	// ------------------------------------------------------------------------
@@ -299,7 +302,9 @@
 	{
 		if (isset($this->_lock_key))
 		{
-			return $this->_memcached->replace($this->_lock_key, time(), 300);
+			return ($this->_memcached->replace($this->_lock_key, time(), 300))
+				? $this->_success
+				: $this->_failure;
 		}
 
 		// 30 attempts to obtain a lock, in case another request already has it
@@ -316,7 +321,7 @@
 			if ( ! $this->_memcached->set($lock_key, time(), 300))
 			{
 				log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id);
-				return FALSE;
+				return $this->_failure;
 			}
 
 			$this->_lock_key = $lock_key;
@@ -327,11 +332,11 @@
 		if ($attempt === 30)
 		{
 			log_message('error', 'Session: Unable to obtain lock for '.$this->_key_prefix.$session_id.' after 30 attempts, aborting.');
-			return FALSE;
+			return $this->_failure;
 		}
 
 		$this->_lock = TRUE;
-		return TRUE;
+		return $this->_success;
 	}
 
 	// ------------------------------------------------------------------------