Skip to content

[Validator][CidrValidator] Fix error message for OutOfRangeNetmask validation #58387

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

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

Fabdouarrahmane
Copy link
Contributor

@Fabdouarrahmane Fabdouarrahmane commented Sep 25, 2024

Q A
Branch? 7.1
Bug fix? yes
New feature? no
Deprecations? no
License MIT

Description

This pull request addresses an issue with the error message generated for the OutOfRangeNetmask validation in the CidrValidator. The previous implementation allowed a maximum netmask of 128, which is incorrect for IPv4 addresses. The maximum should be set to 32 instead.

Changes Made:

  • Updated the error message parameters in the CidrValidator to reflect the correct maximum netmask for IPv4.
  • Modified the corresponding test to ensure that it accurately verifies the expected behavior.

Benefits:

This fix ensures that users receive accurate feedback when providing invalid CIDR notations, which enhances the overall reliability of the validation process.

Testing:

All existing tests have been run, and the new behavior has been verified. The tests confirm that the error message now correctly states the maximum allowed netmask for IPv4 addresses.

Feel free to adjust any part of it to better fit your style or add any additional information you think is relevant!

@carsonbot carsonbot added this to the 7.1 milestone Sep 25, 2024
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot carsonbot changed the title Fix CidrValidator: Corrected error message for OutOfRangeNetmask vali… [Validator] Fix CidrValidator: Corrected error message for OutOfRangeNetmask vali… Sep 25, 2024
@nicolas-grekas nicolas-grekas changed the title [Validator] Fix CidrValidator: Corrected error message for OutOfRangeNetmask vali… [Validator] Fix CidrValidator: Corrected error message for OutOfRangeNetmask validation Sep 28, 2024
@OskarStark OskarStark changed the title [Validator] Fix CidrValidator: Corrected error message for OutOfRangeNetmask validation [Validator][CidrValidator] Fix error message for OutOfRangeNetmask validation Sep 30, 2024
@nicolas-grekas
Copy link
Member

Thank you @Fabdouarrahmane.

@nicolas-grekas nicolas-grekas merged commit b6a9fe3 into symfony:7.1 Oct 9, 2024
8 of 10 checks passed
@fabpot fabpot mentioned this pull request Oct 27, 2024
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.

5 participants