diff --git a/src/Auth/AclTrait.php b/src/Auth/AclTrait.php index 705d015a..f747f117 100644 --- a/src/Auth/AclTrait.php +++ b/src/Auth/AclTrait.php @@ -176,7 +176,7 @@ protected function _check(array $userRoles, array $params) { } $iniKey = $this->_constructIniKey($params); - if (empty($this->_acl[$iniKey])) { + if ($iniKey === null || empty($this->_acl[$iniKey])) { return false; } @@ -420,10 +420,13 @@ protected function _deconstructIniKey($key) { * Constructs an ACL INI section key from a given Request. * * @param array $params The request params - * @return string Hash with named keys for controller, plugin and prefix + * @return string|null Hash with named keys for controller, plugin and prefix */ - protected function _constructIniKey($params) { - $res = $params['controller']; + protected function _constructIniKey($params): ?string { + $res = $params['controller'] ?? null; + if ($res === null) { + return null; + } if (!empty($params['prefix'])) { $res = $params['prefix'] . "/$res"; }