Class SafeString
Responsibility: Validate raw user input as "safe string" to display it in response. Remove from submitted value base ASCII characters from 0 to 31 included (first column) and special characters: & " ' < > | = \ %
. THIS VALIDATOR DOESN'T MEAN SAFE VALUE TO PREVENT SQL INJECTS! To prevent sql injects - use \PDO::prepare();
and \PDO::execute()
.
- MvcCore\Ext\Forms\Validator implements MvcCore\Ext\Forms\IValidator
-
MvcCore\Ext\Forms\Validators\SafeString
Namespace: MvcCore\Ext\Forms\Validators
Located at ext-form/src/MvcCore/Ext/Forms/Validators/SafeString.php
Located at ext-form/src/MvcCore/Ext/Forms/Validators/SafeString.php
public
string|null
|
CreateInstance(),
GetErrorMessage(),
SetField(),
SetForm(),
__construct(),
setUpFieldProps(),
throwNewInvalidArgumentException()
|
protected static
string[]
|
$baseAsciiChars
Base ASCII characters from 0 to 31 included (first column). |
#
[
"\x00" => '', "\x08" => '', "\x10" => '', "\x18" => '',
"\x01" => '', /*"\x09"=> "\t",*/ "\x11" => '', "\x19" => '',
"\x02" => '', /*"\x0A"=> "\n",*/ "\x12" => '', "\x1A" => '',
"\x03" => '', "\x0B" => '', "\x13" => '', "\x1B" => '',
"\x04" => '', "\x0C" => '', "\x14" => '', "\x1C" => '',
"\x05" => '', /*"\x0D"=> "\r",*/ "\x15" => '', "\x1D" => '',
"\x06" => '', "\x0E" => '', "\x16" => '', "\x1E" => '',
"\x07" => '', "\x0F" => '', "\x17" => '', "\x1F" => '',
]
|
protected static
string[]
|
$specialMeaningChars
Characters to prevent XSS attack and some other special chars what could be dangerous user input. |
#
[
// commented characters are cleaned bellow by `htmlspecialchars()`
//'&' => "&",
//'"' => """,
//"'" => "'",
//'<' => "<",
//'>' => ">",
'|' => "|",
'=' => "=",
'\\'=> "\",
'%' => "%",
]
|
$errorMessages,
$field,
$fieldSpecificProperties,
$form,
$toolClass
|