Skip to content
Permalink
Browse files

Forcing bool return

  • Loading branch information...
phpnut committed Dec 14, 2015
1 parent 130e854 commit fac95baee7de3e40c241cca8ab8386607d547411
@@ -278,7 +278,7 @@ public static function set($settings = array(), $value = null, $config = 'defaul
* @return void
*/
public static function gc($config = 'default', $expires = null) {
static::$_engines[$config]->gc($expires);
return (bool)static::$_engines[$config]->gc($expires);
}
/**
@@ -452,7 +452,7 @@ public static function delete($key, $config = 'default') {
$success = static::$_engines[$config]->delete($settings['prefix'] . $key);
static::set(null, $config);
return $success;
return (bool)$success;
}
/**
@@ -143,7 +143,7 @@ class CakeSession {
public static function init($base = null) {
static::$time = time();
if (env('HTTP_USER_AGENT')) {
if (env('HTTP_USER_AGENT') && !static::$_userAgent) {
static::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
}
@@ -83,7 +83,7 @@ public function destroy($id) {
* @return bool Success
*/
public function gc($expires = null) {
return Cache::gc(Configure::read('Session.handler.config'), $expires);
return (bool)Cache::gc(Configure::read('Session.handler.config'), $expires);
}
}
@@ -123,9 +123,9 @@ public function write($id, $data) {
'counterCache' => false
);
try {
return $this->_model->save($record, $options);
return (bool)$this->_model->save($record, $options);
} catch (PDOException $e) {
return $this->_model->save($record, $options);
return (bool)$this->_model->save($record, $options);
}
}
@@ -136,7 +136,7 @@ public function write($id, $data) {
* @return bool True for successful delete, false otherwise.
*/
public function destroy($id) {
return $this->_model->delete($id);
return (bool)$this->_model->delete($id);
}
/**
@@ -151,7 +151,7 @@ public function gc($expires = null) {
} else {
$expires = time() - $expires;
}
return $this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false);
return (bool)$this->_model->deleteAll(array($this->_model->alias . ".expires <" => $expires), false, false);
}
}
@@ -12,6 +12,7 @@ public function open() {
}
public function close() {
return true;
}
public function read($id) {
@@ -21,9 +22,12 @@ public function write($id, $data) {
}
public function destroy($id) {
return true;
}
public function gc($expires = null) {
return true;
}
}
@@ -12,6 +12,7 @@ public function open() {
}
public function close() {
return true;
}
public function read($id) {
@@ -21,9 +22,11 @@ public function write($id, $data) {
}
public function destroy($id) {
return true;
}
public function gc($expires = null) {
return true;
}
}

0 comments on commit fac95ba

Please sign in to comment.
You can’t perform that action at this time.