FIX: Drop parameter names in Injector instantiation to preserve behaviour in PHP 8

Fixes #9667
This commit is contained in:
Sam Minnee 2020-08-30 11:54:39 +12:00 committed by Garion Herman
parent e0f3797489
commit 622cf8b914
2 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,8 @@ class InjectionCreator implements Factory
} }
if (count($params)) { 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); return $reflector->newInstanceArgs($params);
} }

View File

@ -56,7 +56,8 @@ abstract class PasswordEncryptor
return new $class; 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)); return($refClass->newInstanceArgs($arguments));
} }