-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ss-2015-026]: BUG Fix FormField error messages not being encoded safely
- Loading branch information
Damian Mooyman
committed
Nov 11, 2015
1 parent
53b3bc7
commit 245e0aa
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 3.1.16 | ||
|
||
## Upgrading | ||
|
||
FormField validation messages generated by the `Validator` class will now be automatically XML | ||
encoded before being rendered alongside an invalid field. | ||
|
||
If a validation message in a custom `Validator` instance should be rendered as literal HTML, | ||
then the $message parameter for `Validator::validationError` should be passed as an instance | ||
of `HTMLText` | ||
|
||
For example: | ||
|
||
|
||
:::php | ||
class MyCustomValidator extends Validator { | ||
public function php($data) { | ||
$this->validationError( | ||
'EmailAddress', | ||
DBField::create_field('HTMLText', "Invalid email. Please sign up at <a href='signup'>this page</a>") | ||
); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters