Browse Source

Stricter string comparisons.

euromark 12 years ago
parent
commit
bd074e7dc7

+ 1 - 1
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) {

+ 1 - 1
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;

+ 1 - 1
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));
 		}
 	}
 

+ 4 - 4
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;