From 57c807bcb678d7a1731e7d4eaba41ff4aa076a17 Mon Sep 17 00:00:00 2001 From: mscherer Date: Sat, 7 Feb 2026 09:49:52 +0100 Subject: [PATCH 1/2] Fix null array offset deprecation in PHP 8.5 Add early return when iniKey is null to avoid using null as array index. --- src/Auth/AclTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Auth/AclTrait.php b/src/Auth/AclTrait.php index 705d015a..403eff8e 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; } From 907d79787c0996450f52c7a1d0dae6e4e992e896 Mon Sep 17 00:00:00 2001 From: mscherer Date: Sat, 7 Feb 2026 09:55:57 +0100 Subject: [PATCH 2/2] Fix PHPStan error with nullable return type Update _constructIniKey to properly return null when controller is not set --- src/Auth/AclTrait.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Auth/AclTrait.php b/src/Auth/AclTrait.php index 403eff8e..f747f117 100644 --- a/src/Auth/AclTrait.php +++ b/src/Auth/AclTrait.php @@ -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"; }