Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Validator: HostWithPublicIPv4Address #257

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Jun 14, 2024

Q A
Documentation yes
Bugfix no
BC Break no
New Feature yes
RFC no
QA no

Description

Whilst doing some refactoring for v3, I found that the Email Address validator validates IP addresses/hostnames for reserved IPs.

In order to test this effectively, it makes more sense to implement this as a validator and compose that into the Email address validator - it is likely to prove useful to some users too in a standalone context.

So, this validator is a pretty straightforward extraction of https://github.com/laminas/laminas-validator/blob/2.57.x/src/EmailAddress.php#L282-L344

The expectation is that the functionality in the Email validator will be replaced with this.

Whilst doing some refactoring for v3, I found that the Email Address validator validates IP addresses/hostnames for reserved IPs.

In order to test this effectively, it makes more sense to implement this as a validator and compose that into the Email address validator - it is likely to prove useful to some users too in a standalone context.

So, this validator is a pretty straightforward extraction of https://github.com/laminas/laminas-validator/blob/2.57.x/src/EmailAddress.php#L282-L344

The expectation is that the functionality in the Email validator will be replaced with this.

Signed-off-by: George Steel <[email protected]>
@gsteel gsteel force-pushed the v2/reserved-ip-v4-validator branch from 670d16d to 754fe72 Compare June 14, 2024 10:49
…so make use of PHP's built-in filters for (assumed) improved performance.

Signed-off-by: George Steel <[email protected]>
@gsteel gsteel requested review from Ocramius and boesing June 14, 2024 13:08
Copy link
Member

@boesing boesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, still a bunch of manually listed IPs.
Was not expecting that there are that many ranges which are not covered by the filter_var stuff. Good to know.

@gsteel gsteel self-assigned this Jun 14, 2024
@gsteel gsteel merged commit 1e24e70 into laminas:2.57.x Jun 14, 2024
14 of 15 checks passed
@gsteel gsteel deleted the v2/reserved-ip-v4-validator branch June 14, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants