diff --git a/src/Core/Injector/InjectionCreator.php b/src/Core/Injector/InjectionCreator.php index 3dc7448ab..44fe99a21 100644 --- a/src/Core/Injector/InjectionCreator.php +++ b/src/Core/Injector/InjectionCreator.php @@ -20,6 +20,8 @@ class InjectionCreator implements Factory } if (count($params)) { + // Remove named keys to ensure that PHP7 and PHP8 interpret these the same way + $params = array_values($params); return $reflector->newInstanceArgs($params); } diff --git a/src/Security/PasswordEncryptor.php b/src/Security/PasswordEncryptor.php index 6b2b0e695..8a94ddebd 100644 --- a/src/Security/PasswordEncryptor.php +++ b/src/Security/PasswordEncryptor.php @@ -56,7 +56,8 @@ abstract class PasswordEncryptor return new $class; } - $arguments = $encryptors[$algorithm]; + // Don't treat array keys as argument names - keeps PHP 7 and PHP 8 operating similarly + $arguments = array_values($encryptors[$algorithm]); return($refClass->newInstanceArgs($arguments)); }