Strict comparisons
This commit is contained in:
parent
1579666238
commit
01ed6ecf72
@ -54,14 +54,14 @@ class Validator implements ValidatorInterface {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkEncoding($str, $against) {
|
public function checkEncoding($str, $against) {
|
||||||
if ('UTF-8' == $against) {
|
if ('UTF-8' === $against) {
|
||||||
return $this->isUtf8($str);
|
return $this->isUtf8($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasMbString) {
|
if ($this->hasMbString) {
|
||||||
return mb_check_encoding($str, $against);
|
return mb_check_encoding($str, $against);
|
||||||
} elseif ($this->hasIconv) {
|
} elseif ($this->hasIconv) {
|
||||||
return ($str == iconv($against, "{$against}//IGNORE", $str));
|
return ($str === iconv($against, "{$against}//IGNORE", $str));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -73,7 +73,7 @@ class Validator implements ValidatorInterface {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif ($this->hasIconv) {
|
} elseif ($this->hasIconv) {
|
||||||
if ($str != iconv('UTF-8', 'UTF-8//IGNORE', $str)) {
|
if ($str !== iconv('UTF-8', 'UTF-8//IGNORE', $str)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user