Translator: Fix values handling when array keys are set

Fixes #820 (Password recovery not working)
main
Igor Scheller 4 years ago
parent d289d09147
commit 4ff44d141c

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

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

Loading…
Cancel
Save