Skip to content

Commit

Permalink
Stricter treatment of end() returning false.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 25, 2016
1 parent 6673d00 commit bcfc7f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -361,6 +361,7 @@ protected function _isAllowed(Controller $controller)
* @param \Cake\Controller\Controller $controller A reference to the controller object.
* @return \Cake\Network\Response|null Null if current action is login action
* else response object returned by authenticate object or Controller::redirect().
* @throws \Cake\Core\Exception\Exception
*/
protected function _unauthenticated(Controller $controller)
{
Expand All @@ -369,6 +370,9 @@ protected function _unauthenticated(Controller $controller)
}
$response = $this->response;
$auth = end($this->_authenticateObjects);
if ($auth === false) {
throw new Exception('At least one authenticate object must be available.');
}
$result = $auth->unauthenticated($this->request, $response);
if ($result !== null) {
return $result;
Expand Down
2 changes: 1 addition & 1 deletion src/I18n/Formatter/IcuFormatter.php
Expand Up @@ -66,7 +66,7 @@ public function format($locale, $message, array $vars)
$count = isset($vars['_count']) ? $vars['_count'] : 0;
unset($vars['_count'], $vars['_singular']);
$form = PluralRules::calculate($locale, $count);
$message = isset($message[$form]) ? $message[$form] : end($message);
$message = isset($message[$form]) ? $message[$form] : (string)end($message);
}

return $this->_formatMessage($locale, $message, $vars);
Expand Down
2 changes: 1 addition & 1 deletion src/View/ViewBlock.php
Expand Up @@ -107,7 +107,7 @@ public function end()

return;
}
if (!empty($this->_active)) {
if ($this->_active) {
$mode = end($this->_active);
$active = key($this->_active);
$content = ob_get_clean();
Expand Down

0 comments on commit bcfc7f7

Please sign in to comment.