Skip to content

Commit 65cb1f7

Browse files
author
Igor Chepurnoy
committed
fixes #23
1 parent 7998158 commit 65cb1f7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

controllers/DefaultController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function actionCreate($entity)
4848
/* @var $module Module */
4949
$module = Yii::$app->getModule(Module::$name);
5050
$commentModelClass = $module->commentModelClass;
51-
$decryptEntity = Yii::$app->getSecurity()->decryptByKey($entity, $module::$name);
51+
$decryptEntity = Yii::$app->getSecurity()->decryptByKey(utf8_decode($entity), $module::$name);
5252
if ($decryptEntity !== false) {
5353
$entityData = Json::decode($decryptEntity);
5454
/* @var $model CommentModel */

tests/CommentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ private function generateEntity()
4040
{
4141
$post = PostModel::find()->one();
4242

43-
return Yii::$app->getSecurity()->encryptByKey(Json::encode([
43+
return utf8_encode(Yii::$app->getSecurity()->encryptByKey(Json::encode([
4444
'entity' => hash('crc32', get_class($post)),
4545
'entityId' => $post->id,
4646
'relatedTo' => get_class($post) . ':' . $post->id
47-
]), Module::$name);
47+
]), Module::$name));
4848
}
4949
}

widgets/Comment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ protected function registerAssets()
154154
*/
155155
protected function generateEntityKey()
156156
{
157-
return Yii::$app->getSecurity()->encryptByKey(Json::encode([
157+
return utf8_encode(Yii::$app->getSecurity()->encryptByKey(Json::encode([
158158
'entity' => $this->entity,
159159
'entityId' => $this->entityId,
160160
'relatedTo' => $this->relatedTo
161-
]), Module::$name);
161+
]), Module::$name));
162162
}
163163
}

0 commit comments

Comments
 (0)