Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
a08de951
Commit
a08de951
authored
Dec 22, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1582: Error messages shown via client-side validation should not be double encoded
parent
42d8748e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
35 additions
and
34 deletions
+35
-34
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
yii.activeForm.js
framework/yii/assets/yii.activeForm.js
+4
-4
CaptchaValidator.php
framework/yii/captcha/CaptchaValidator.php
+2
-2
BooleanValidator.php
framework/yii/validators/BooleanValidator.php
+2
-2
CompareValidator.php
framework/yii/validators/CompareValidator.php
+2
-2
EmailValidator.php
framework/yii/validators/EmailValidator.php
+2
-2
NumberValidator.php
framework/yii/validators/NumberValidator.php
+6
-6
RangeValidator.php
framework/yii/validators/RangeValidator.php
+2
-2
RegularExpressionValidator.php
framework/yii/validators/RegularExpressionValidator.php
+2
-2
RequiredValidator.php
framework/yii/validators/RequiredValidator.php
+2
-2
StringValidator.php
framework/yii/validators/StringValidator.php
+8
-8
UrlValidator.php
framework/yii/validators/UrlValidator.php
+2
-2
No files found.
framework/CHANGELOG.md
View file @
a08de951
...
...
@@ -10,6 +10,7 @@ Yii Framework 2 Change Log
-
Bug #1509: The SQL for creating Postgres RBAC tables is incorrect (qiangxue)
-
Bug #1545: It was not possible to execute db Query twice, params where missing (cebe)
-
Bug #1550: fixed the issue that JUI input widgets did not property input IDs.
-
Bug #1582: Error messages shown via client-side validation should not be double encoded (qiangxue)
-
Bug #1591: StringValidator is accessing undefined property (qiangxue)
-
Bug: Fixed
`Call to a member function registerAssetFiles() on a non-object`
in case of wrong
`sourcePath`
for an asset bundle (samdark)
-
Bug: Fixed incorrect event name for
`yii\jui\Spinner`
(samdark)
...
...
framework/yii/assets/yii.activeForm.js
View file @
a08de951
...
...
@@ -348,7 +348,7 @@
$container
.
removeClass
(
data
.
settings
.
validatingCssClass
+
' '
+
data
.
settings
.
successCssClass
)
.
addClass
(
data
.
settings
.
errorCssClass
);
}
else
{
$error
.
html
(
''
);
$error
.
text
(
''
);
$container
.
removeClass
(
data
.
settings
.
validatingCssClass
+
' '
+
data
.
settings
.
errorCssClass
+
' '
)
.
addClass
(
data
.
settings
.
successCssClass
);
}
...
...
@@ -365,15 +365,15 @@
var
updateSummary
=
function
(
$form
,
messages
)
{
var
data
=
$form
.
data
(
'yiiActiveForm'
),
$summary
=
$form
.
find
(
data
.
settings
.
errorSummary
),
content
=
''
;
$ul
=
$summary
.
find
(
'ul'
)
;
if
(
$summary
.
length
&&
messages
)
{
$
.
each
(
data
.
attributes
,
function
()
{
if
(
$
.
isArray
(
messages
[
this
.
name
])
&&
messages
[
this
.
name
].
length
)
{
content
+=
'<li>'
+
messages
[
this
.
name
][
0
]
+
'</li>'
;
$ul
.
append
(
$
(
'<li/>'
).
text
(
messages
[
this
.
name
][
0
]))
;
}
});
$summary
.
toggle
(
content
!==
''
).
find
(
'ul'
).
html
(
content
);
$summary
.
toggle
(
$ul
.
find
(
'li'
).
length
>
0
);
}
};
...
...
framework/yii/captcha/CaptchaValidator.php
View file @
a08de951
...
...
@@ -93,9 +93,9 @@ class CaptchaValidator extends Validator
'hash'
=>
$hash
,
'hashKey'
=>
'yiiCaptcha/'
.
$this
->
captchaAction
,
'caseSensitive'
=>
$this
->
caseSensitive
,
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
])
)
,
]),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/yii/validators/BooleanValidator.php
View file @
a08de951
...
...
@@ -72,11 +72,11 @@ class BooleanValidator extends Validator
$options
=
[
'trueValue'
=>
$this
->
trueValue
,
'falseValue'
=>
$this
->
falseValue
,
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
'{true}'
=>
$this
->
trueValue
,
'{false}'
=>
$this
->
falseValue
,
])
)
,
]),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/yii/validators/CompareValidator.php
View file @
a08de951
...
...
@@ -195,11 +195,11 @@ class CompareValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$options
[
'message'
]
=
Html
::
encode
(
strtr
(
$this
->
message
,
[
$options
[
'message'
]
=
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
'{compareAttribute}'
=>
$compareValue
,
'{compareValue}'
=>
$compareValue
,
])
)
;
]);
ValidationAsset
::
register
(
$view
);
return
'yii.validation.compare(value, messages, '
.
json_encode
(
$options
)
.
');'
;
...
...
framework/yii/validators/EmailValidator.php
View file @
a08de951
...
...
@@ -98,9 +98,9 @@ class EmailValidator extends Validator
'pattern'
=>
new
JsExpression
(
$this
->
pattern
),
'fullPattern'
=>
new
JsExpression
(
$this
->
fullPattern
),
'allowName'
=>
$this
->
allowName
,
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
])
)
,
]),
'enableIDN'
=>
(
boolean
)
$this
->
enableIDN
,
];
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/yii/validators/NumberValidator.php
View file @
a08de951
...
...
@@ -124,24 +124,24 @@ class NumberValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$this
->
integerOnly
?
$this
->
integerPattern
:
$this
->
numberPattern
),
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$label
,
])
)
,
]),
];
if
(
$this
->
min
!==
null
)
{
$options
[
'min'
]
=
$this
->
min
;
$options
[
'tooSmall'
]
=
Html
::
encode
(
strtr
(
$this
->
tooSmall
,
[
$options
[
'tooSmall'
]
=
strtr
(
$this
->
tooSmall
,
[
'{attribute}'
=>
$label
,
'{min}'
=>
$this
->
min
,
])
)
;
]);
}
if
(
$this
->
max
!==
null
)
{
$options
[
'max'
]
=
$this
->
max
;
$options
[
'tooBig'
]
=
Html
::
encode
(
strtr
(
$this
->
tooBig
,
[
$options
[
'tooBig'
]
=
strtr
(
$this
->
tooBig
,
[
'{attribute}'
=>
$label
,
'{max}'
=>
$this
->
max
,
])
)
;
]);
}
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/yii/validators/RangeValidator.php
View file @
a08de951
...
...
@@ -73,9 +73,9 @@ class RangeValidator extends Validator
$options
=
[
'range'
=>
$range
,
'not'
=>
$this
->
not
,
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
])
)
,
]),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/yii/validators/RegularExpressionValidator.php
View file @
a08de951
...
...
@@ -80,9 +80,9 @@ class RegularExpressionValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$pattern
),
'not'
=>
$this
->
not
,
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
])
)
,
]),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/yii/validators/RequiredValidator.php
View file @
a08de951
...
...
@@ -101,9 +101,9 @@ class RequiredValidator extends Validator
$options
[
'strict'
]
=
1
;
}
$options
[
'message'
]
=
Html
::
encode
(
strtr
(
$options
[
'message'
],
[
$options
[
'message'
]
=
strtr
(
$options
[
'message'
],
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
])
)
;
]);
ValidationAsset
::
register
(
$view
);
return
'yii.validation.required(value, messages, '
.
json_encode
(
$options
)
.
');'
;
...
...
framework/yii/validators/StringValidator.php
View file @
a08de951
...
...
@@ -151,31 +151,31 @@ class StringValidator extends Validator
$label
=
$object
->
getAttributeLabel
(
$attribute
);
$options
=
[
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$label
,
])
)
,
]),
];
if
(
$this
->
min
!==
null
)
{
$options
[
'min'
]
=
$this
->
min
;
$options
[
'tooShort'
]
=
Html
::
encode
(
strtr
(
$this
->
tooShort
,
[
$options
[
'tooShort'
]
=
strtr
(
$this
->
tooShort
,
[
'{attribute}'
=>
$label
,
'{min}'
=>
$this
->
min
,
])
)
;
]);
}
if
(
$this
->
max
!==
null
)
{
$options
[
'max'
]
=
$this
->
max
;
$options
[
'tooLong'
]
=
Html
::
encode
(
strtr
(
$this
->
tooLong
,
[
$options
[
'tooLong'
]
=
strtr
(
$this
->
tooLong
,
[
'{attribute}'
=>
$label
,
'{max}'
=>
$this
->
max
,
])
)
;
]);
}
if
(
$this
->
length
!==
null
)
{
$options
[
'is'
]
=
$this
->
length
;
$options
[
'notEqual'
]
=
Html
::
encode
(
strtr
(
$this
->
notEqual
,
[
$options
[
'notEqual'
]
=
strtr
(
$this
->
notEqual
,
[
'{attribute}'
=>
$label
,
'{length}'
=>
$this
->
length
,
])
)
;
]);
}
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/yii/validators/UrlValidator.php
View file @
a08de951
...
...
@@ -121,9 +121,9 @@ class UrlValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$pattern
),
'message'
=>
Html
::
encode
(
strtr
(
$this
->
message
,
[
'message'
=>
strtr
(
$this
->
message
,
[
'{attribute}'
=>
$object
->
getAttributeLabel
(
$attribute
),
])
)
,
]),
'enableIDN'
=>
(
boolean
)
$this
->
enableIDN
,
];
if
(
$this
->
skipOnEmpty
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment