Stricter string comparisons.

This commit is contained in:
euromark 2014-04-29 12:05:47 +02:00
parent 1d1a2f859c
commit bd074e7dc7
4 changed files with 7 additions and 7 deletions

View file

@ -722,7 +722,7 @@ class AuthComponent extends Component {
$redir = $this->Session->read('Auth.redirect'); $redir = $this->Session->read('Auth.redirect');
$this->Session->delete('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; $redir = $this->loginRedirect;
} }
} elseif ($this->loginRedirect) { } elseif ($this->loginRedirect) {

View file

@ -392,7 +392,7 @@ class PaginatorComponent extends Component {
if (strpos($key, '.') !== false) { if (strpos($key, '.') !== false) {
list($alias, $field) = explode('.', $key); list($alias, $field) = explode('.', $key);
} }
$correctAlias = ($object->alias == $alias); $correctAlias = ($object->alias === $alias);
if ($correctAlias && $object->hasField($field)) { if ($correctAlias && $object->hasField($field)) {
$order[$object->alias . '.' . $field] = $value; $order[$object->alias . '.' . $field] = $value;

View file

@ -525,7 +525,7 @@ class RequestHandlerComponent extends Component {
return $this->mapType($contentType); return $this->mapType($contentType);
} }
if (is_string($type)) { if (is_string($type)) {
return ($type == $this->mapType($contentType)); return ($type === $this->mapType($contentType));
} }
} }

View file

@ -230,7 +230,7 @@ class SecurityComponent extends Component {
$controller->request->params['requested'] != 1 $controller->request->params['requested'] != 1
); );
if ($this->_action == $this->blackHoleCallback) { if ($this->_action === $this->blackHoleCallback) {
return $this->blackHole($controller, 'auth'); return $this->blackHole($controller, 'auth');
} }
@ -362,7 +362,7 @@ class SecurityComponent extends Component {
$property = 'require' . $method; $property = 'require' . $method;
if (is_array($this->$property) && !empty($this->$property)) { if (is_array($this->$property) && !empty($this->$property)) {
$require = $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->request->is($method)) {
if (!$this->blackHole($controller, $method)) { if (!$this->blackHole($controller, $method)) {
return null; return null;
@ -384,7 +384,7 @@ class SecurityComponent extends Component {
if (is_array($this->requireSecure) && !empty($this->requireSecure)) { if (is_array($this->requireSecure) && !empty($this->requireSecure)) {
$requireSecure = $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->request->is('ssl')) {
if (!$this->blackHole($controller, 'secure')) { if (!$this->blackHole($controller, 'secure')) {
return null; return null;
@ -405,7 +405,7 @@ class SecurityComponent extends Component {
if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) { if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) {
$requireAuth = $this->requireAuth; $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 (!isset($controller->request->data['_Token'])) {
if (!$this->blackHole($controller, 'auth')) { if (!$this->blackHole($controller, 'auth')) {
return null; return null;