Browse Source

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

tags/2.0.0-rc
Klimov Paul 10 years ago
parent
commit
db26e65c62
  1. 1
      framework/CHANGELOG.md
  2. 8
      framework/console/controllers/MessageController.php
  3. 6
      tests/unit/framework/console/controllers/BaseMessageControllerTest.php

1
framework/CHANGELOG.md

@ -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)

8
framework/console/controllers/MessageController.php

@ -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
}
}

6
tests/unit/framework/console/controllers/BaseMessageControllerTest.php

@ -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';

Loading…
Cancel
Save