Commit db26e65c by Klimov Paul

Fixed `yii\console\controllers\MessageController` handles category name containing dot incorrectly

parent ec195360
......@@ -91,6 +91,7 @@ Yii Framework 2 Change Log
- Bug #4880: Return value of yii\web\Request::getPrefferedLanguage() was a normalized value instead of a valid language value from the input array (cebe)
- Bug #4905: ActiveForm::$validationDelay doesn't delay after keyrelease when $validateOnType=true (qiangxue)
- Bug #4920: `yii\filters\auth\CompositeAuth` should not trigger error as long as one of the methods succeeds (qiangxue)
- Bug #4926: Fixed `yii\console\controllers\MessageController` handles category name containing dot incorrectly (klimov-paul)
- Bug #4938: When `yii\db\ActiveQuery` is used to build sub-queries, its WHERE clause is not correctly generated (qiangxue)
- Bug #4954: MSSQL column comments are not retrieved correctly (SerjRamone)
- Bug #4970: `joinWith()` called by a relation was ignored by `yii\db\ActiveQuery` (stepanselyuk)
......
......@@ -260,13 +260,9 @@ class MessageController extends Controller
PREG_SET_ORDER
);
for ($i = 0; $i < $n; ++$i) {
if (($pos = strpos($matches[$i][1], '.')) !== false) {
$category = substr($matches[$i][1], $pos + 1, -1);
} else {
$category = substr($matches[$i][1], 1, -1);
}
$category = substr($matches[$i][1], 1, -1);
$message = $matches[$i][2];
$messages[$category][] = eval("return $message;"); // use eval to eliminate quote escape
$messages[$category][] = eval("return {$message};"); // use eval to eliminate quote escape
}
}
......
......@@ -139,7 +139,7 @@ abstract class BaseMessageControllerTest extends TestCase
public function testCreateTranslation()
{
$category = 'test_category1';
$category = 'test.category1';
$message = 'test message';
$sourceFileContent = "Yii::t('{$category}', '{$message}');";
$this->createSourceFile($sourceFileContent);
......@@ -200,7 +200,7 @@ abstract class BaseMessageControllerTest extends TestCase
/**
* @depends testMerge
*/
public function testMarkObosoleteMessages()
public function testMarkObsoleteMessages()
{
$category = 'category';
......@@ -223,7 +223,7 @@ abstract class BaseMessageControllerTest extends TestCase
/**
* @depends testMerge
*/
public function removeObosoleteMessages()
public function removeObsoleteMessages()
{
$category = 'category';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment