Skip to content

Commit

Permalink
Merge pull request #363 from Tautve/issue_357
Browse files Browse the repository at this point in the history
Fixed Issue #357
  • Loading branch information
willemwollebrants committed Oct 3, 2022
2 parents d0fb8ee + fd902d1 commit 57a9f68
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Valitron/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ protected function validateAscii($field, $value)
*/
protected function validateEmailDNS($field, $value)
{
if (!is_string($value)) {
return false;
}

if ($this->validateEmail($field, $value)) {
$domain = ltrim(stristr($value, '@'), '@') . '.';
if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46')) {
Expand All @@ -651,6 +655,10 @@ protected function validateEmailDNS($field, $value)
*/
protected function validateUrl($field, $value)
{
if (!is_string($value)) {
return false;
}

foreach ($this->validUrlPrefixes as $prefix) {
if (strpos($value, $prefix) !== false) {
return filter_var($value, \FILTER_VALIDATE_URL) !== false;
Expand All @@ -669,6 +677,10 @@ protected function validateUrl($field, $value)
*/
protected function validateUrlActive($field, $value)
{
if (!is_string($value)) {
return false;
}

foreach ($this->validUrlPrefixes as $prefix) {
if (strpos($value, $prefix) !== false) {
$host = parse_url(strtolower($value), PHP_URL_HOST);
Expand Down

0 comments on commit 57a9f68

Please sign in to comment.