Skip to content

Commit

Permalink
Forcing bool return
Browse files Browse the repository at this point in the history
  • Loading branch information
phpnut committed Dec 14, 2015
1 parent 130e854 commit fac95ba
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Cache/Cache.php
Expand Up @@ -278,7 +278,7 @@ public static function set($settings = array(), $value = null, $config = 'defaul
* @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);
} }


/** /**
Expand Down Expand Up @@ -452,7 +452,7 @@ public static function delete($key, $config = 'default') {


$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;
} }


/** /**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/CakeSession.php
Expand Up @@ -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'));
} }


Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Session/CacheSession.php
Expand Up @@ -83,7 +83,7 @@ public function destroy($id) {
* @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);
} }


} }
8 changes: 4 additions & 4 deletions lib/Cake/Model/Datasource/Session/DatabaseSession.php
Expand Up @@ -123,9 +123,9 @@ public function write($id, $data) {
'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);
} }
} }


Expand All @@ -136,7 +136,7 @@ public function write($id, $data) {
* @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);
} }


/** /**
Expand All @@ -151,7 +151,7 @@ public function gc($expires = null) {
} 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);
} }


} }
Expand Up @@ -12,6 +12,7 @@ public function open() {
} }


public function close() { public function close() {
return true;
} }


public function read($id) { public function read($id) {
Expand All @@ -21,9 +22,12 @@ public function write($id, $data) {
} }


public function destroy($id) { public function destroy($id) {
return true;
} }


public function gc($expires = null) { public function gc($expires = null) {
return true;
} }



} }
Expand Up @@ -12,6 +12,7 @@ public function open() {
} }


public function close() { public function close() {
return true;
} }


public function read($id) { public function read($id) {
Expand All @@ -21,9 +22,11 @@ public function write($id, $data) {
} }


public function destroy($id) { public function destroy($id) {
return true;
} }


public function gc($expires = null) { public function gc($expires = null) {
return true;
} }


} }

0 comments on commit fac95ba

Please sign in to comment.