Forcing bool return

This commit is contained in:
Larry E. Masters 2015-12-13 19:19:11 -06:00
parent 130e854c30
commit fac95baee7
6 changed files with 15 additions and 8 deletions

View file

@ -278,7 +278,7 @@ class Cache {
* @return void * @return void
*/ */
public static function gc($config = 'default', $expires = null) { public static function gc($config = 'default', $expires = null) {
static::$_engines[$config]->gc($expires); return (bool)static::$_engines[$config]->gc($expires);
} }
/** /**
@ -452,7 +452,7 @@ class Cache {
$success = static::$_engines[$config]->delete($settings['prefix'] . $key); $success = static::$_engines[$config]->delete($settings['prefix'] . $key);
static::set(null, $config); static::set(null, $config);
return $success; return (bool)$success;
} }
/** /**

View file

@ -143,7 +143,7 @@ class CakeSession {
public static function init($base = null) { public static function init($base = null) {
static::$time = time(); 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')); static::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
} }

View file

@ -83,7 +83,7 @@ class CacheSession implements CakeSessionHandlerInterface {
* @return bool Success * @return bool Success
*/ */
public function gc($expires = null) { public function gc($expires = null) {
return Cache::gc(Configure::read('Session.handler.config'), $expires); return (bool)Cache::gc(Configure::read('Session.handler.config'), $expires);
} }
} }

View file

@ -123,9 +123,9 @@ class DatabaseSession implements CakeSessionHandlerInterface {
'counterCache' => false 'counterCache' => false
); );
try { try {
return $this->_model->save($record, $options); return (bool)$this->_model->save($record, $options);
} catch (PDOException $e) { } catch (PDOException $e) {
return $this->_model->save($record, $options); return (bool)$this->_model->save($record, $options);
} }
} }
@ -136,7 +136,7 @@ class DatabaseSession implements CakeSessionHandlerInterface {
* @return bool True for successful delete, false otherwise. * @return bool True for successful delete, false otherwise.
*/ */
public function destroy($id) { public function destroy($id) {
return $this->_model->delete($id); return (bool)$this->_model->delete($id);
} }
/** /**
@ -151,7 +151,7 @@ class DatabaseSession implements CakeSessionHandlerInterface {
} else { } else {
$expires = time() - $expires; $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);
} }
} }

View file

@ -12,6 +12,7 @@ class TestAppLibSession implements CakeSessionHandlerInterface {
} }
public function close() { public function close() {
return true;
} }
public function read($id) { public function read($id) {
@ -21,9 +22,12 @@ class TestAppLibSession implements CakeSessionHandlerInterface {
} }
public function destroy($id) { public function destroy($id) {
return true;
} }
public function gc($expires = null) { public function gc($expires = null) {
return true;
} }
} }

View file

@ -12,6 +12,7 @@ class TestPluginSession implements CakeSessionHandlerInterface {
} }
public function close() { public function close() {
return true;
} }
public function read($id) { public function read($id) {
@ -21,9 +22,11 @@ class TestPluginSession implements CakeSessionHandlerInterface {
} }
public function destroy($id) { public function destroy($id) {
return true;
} }
public function gc($expires = null) { public function gc($expires = null) {
return true;
} }
} }