Skip to content
Permalink
Browse files

Stricter treatment of end() returning false.

  • Loading branch information...
dereuromark committed Nov 25, 2016
1 parent 6673d00 commit bcfc7f75ffa1e49bae824be5be7d988d134d3538
Showing with 6 additions and 2 deletions.
  1. +4 −0 src/Controller/Component/AuthComponent.php
  2. +1 −1 src/I18n/Formatter/IcuFormatter.php
  3. +1 −1 src/View/ViewBlock.php
@@ -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)
{
@@ -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;
@@ -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);
@@ -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();

0 comments on commit bcfc7f7

Please sign in to comment.
You can’t perform that action at this time.