Translator: Fix values handling when array keys are set

Fixes #820 (Password recovery not working)
This commit is contained in:
Igor Scheller 2021-07-11 00:40:30 +02:00
parent d289d09147
commit 4ff44d141c
2 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ class Translator
return $key;
}
return call_user_func_array('sprintf', array_merge([$key], $replace));
return call_user_func_array('sprintf', array_merge([$key], array_values($replace)));
}
/**

View File

@ -128,8 +128,8 @@ class TranslatorTest extends ServiceProviderTest
// Fallback translation
$this->assertEquals('Lorem test2???', $translator->translate('foo.batz', ['test2']));
// Successful translation
$this->assertEquals('Lorem test3!', $translator->translatePlural('foo.barf', 'foo.bar2', 3, ['test3']));
// Successful translation, keys in replaces should be ignored
$this->assertEquals('Lorem test3!', $translator->translatePlural('foo.barf', 'foo.bar2', 3, ['x' => 'test3']));
}
/**