From bd074e7dc7cb0efb9f96220a6bb5540ca30a247e Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 29 Apr 2014 12:05:47 +0200 Subject: [PATCH] Stricter string comparisons. --- lib/Cake/Controller/Component/AuthComponent.php | 2 +- lib/Cake/Controller/Component/PaginatorComponent.php | 2 +- lib/Cake/Controller/Component/RequestHandlerComponent.php | 2 +- lib/Cake/Controller/Component/SecurityComponent.php | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 42bf84839..8f4fb279e 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -722,7 +722,7 @@ class AuthComponent extends Component { $redir = $this->Session->read('Auth.redirect'); $this->Session->delete('Auth.redirect'); - if (Router::normalize($redir) == Router::normalize($this->loginAction)) { + if (Router::normalize($redir) === Router::normalize($this->loginAction)) { $redir = $this->loginRedirect; } } elseif ($this->loginRedirect) { diff --git a/lib/Cake/Controller/Component/PaginatorComponent.php b/lib/Cake/Controller/Component/PaginatorComponent.php index 32107f413..d848977b1 100644 --- a/lib/Cake/Controller/Component/PaginatorComponent.php +++ b/lib/Cake/Controller/Component/PaginatorComponent.php @@ -392,7 +392,7 @@ class PaginatorComponent extends Component { if (strpos($key, '.') !== false) { list($alias, $field) = explode('.', $key); } - $correctAlias = ($object->alias == $alias); + $correctAlias = ($object->alias === $alias); if ($correctAlias && $object->hasField($field)) { $order[$object->alias . '.' . $field] = $value; diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 723606284..dfe5af6df 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -525,7 +525,7 @@ class RequestHandlerComponent extends Component { return $this->mapType($contentType); } if (is_string($type)) { - return ($type == $this->mapType($contentType)); + return ($type === $this->mapType($contentType)); } } diff --git a/lib/Cake/Controller/Component/SecurityComponent.php b/lib/Cake/Controller/Component/SecurityComponent.php index 6aeb77ef2..4bd42bd0c 100644 --- a/lib/Cake/Controller/Component/SecurityComponent.php +++ b/lib/Cake/Controller/Component/SecurityComponent.php @@ -230,7 +230,7 @@ class SecurityComponent extends Component { $controller->request->params['requested'] != 1 ); - if ($this->_action == $this->blackHoleCallback) { + if ($this->_action === $this->blackHoleCallback) { return $this->blackHole($controller, 'auth'); } @@ -362,7 +362,7 @@ class SecurityComponent extends Component { $property = 'require' . $method; if (is_array($this->$property) && !empty($this->$property)) { $require = $this->$property; - if (in_array($this->_action, $require) || $this->$property == array('*')) { + if (in_array($this->_action, $require) || $this->$property === array('*')) { if (!$this->request->is($method)) { if (!$this->blackHole($controller, $method)) { return null; @@ -384,7 +384,7 @@ class SecurityComponent extends Component { if (is_array($this->requireSecure) && !empty($this->requireSecure)) { $requireSecure = $this->requireSecure; - if (in_array($this->_action, $requireSecure) || $this->requireSecure == array('*')) { + if (in_array($this->_action, $requireSecure) || $this->requireSecure === array('*')) { if (!$this->request->is('ssl')) { if (!$this->blackHole($controller, 'secure')) { return null; @@ -405,7 +405,7 @@ class SecurityComponent extends Component { if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) { $requireAuth = $this->requireAuth; - if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth == array('*')) { + if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth === array('*')) { if (!isset($controller->request->data['_Token'])) { if (!$this->blackHole($controller, 'auth')) { return null;