mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-19 07:07:58 +08:00
Fix #19462: Fix validator client options to encode HTML tags
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
namespace yii\validators;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Json;
|
||||
|
||||
/**
|
||||
* StringValidator validates that the attribute value is of certain length.
|
||||
@@ -168,7 +169,7 @@ class StringValidator extends Validator
|
||||
ValidationAsset::register($view);
|
||||
$options = $this->getClientOptions($model, $attribute);
|
||||
|
||||
return 'yii.validation.string(value, messages, ' . json_encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ');';
|
||||
return 'yii.validation.string(value, messages, ' . Json::htmlEncode($options) . ');';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user