Skip to content

Commit

Permalink
Merge pull request #24 from marcelthole/laminas-validator-3
Browse files Browse the repository at this point in the history
Allow Laminas validator 3
  • Loading branch information
gsteel authored Dec 3, 2024
2 parents 95a41a7 + cab4d9d commit de53600
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"laminas/laminas-escaper": "^2.9",
"laminas/laminas-validator": "^2.39"
"laminas/laminas-validator": "^2.39 || ^3.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,8 @@ protected static function isValidIpAddress($host, $allowed)
];

// Test only IPv4
$validator = new Validator\Ip($validatorParams);
$return = $validator->isValid($host);
$validatorIpV4 = new Validator\Ip($validatorParams);
$return = $validatorIpV4->isValid($host);
if ($return) {
return true;
}
Expand All @@ -1218,8 +1218,8 @@ protected static function isValidIpAddress($host, $allowed)
'allowliteral' => true,
];
static $regex = '/^\[.*\]$/';
$validator->setOptions($validatorParams);
return preg_match($regex, $host) && $validator->isValid($host);
$validatorIpV6 = new Validator\Ip($validatorParams);
return preg_match($regex, $host) && $validatorIpV6->isValid($host);
}

/**
Expand Down

0 comments on commit de53600

Please sign in to comment.