Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Validator] Added HostnameValidator#31518
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
javiereguiluz commentedJul 3, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@karser thanks for this contribution! I like this a lot ... except for the Here's a proposal:
|
@javiereguiluz thanks for the feedback. I implemented your proposal (see the test cases). wdyt?
The option |
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Validator/Tests/Constraints/DomainValidatorTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
f650936
to98f6a2e
CompareUh oh!
There was an error while loading.Please reload this page.
69d879a
to5bdd6c3
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
wouldDomainName
be a more inuitive name?
also please update validation.en.xml + any language you know :)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
d930263
to13d3e65
Comparesrc/Symfony/Component/Validator/Constraints/HostnameValidator.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
really looking forward for this 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
with some minor comments
'You can register them by adding a new driver to the '. | ||
'"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver') | ||
)); | ||
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.'You can register them by adding a new driver to the '.'"%s" service definition.', $this->getObjectManagerElementName($objectManagerName.'_metadata_driver'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This should be reverted.
'The user object has to be serialized with its own identifier '. | ||
'mapped by Doctrine.' | ||
); | ||
throw new \InvalidArgumentException('You cannot refresh a user '.'from the EntityUserProvider that does not contain an identifier. '.'The user object has to be serialized with its own identifier '.'mapped by Doctrine.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This should be reverted.
@@ -1,6 +1,10 @@ | |||
CHANGELOG | |||
========= | |||
5.1.0 | |||
----- | |||
* added the `Hostname` constraint and validator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
missing blank line above the entry.
Thank you@karser. |
This PR was merged into the 5.1-dev branch.Discussion----------[Validator] Added HostnameValidator| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets |#10088 <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features -->This PR adds HostnameValidator support. I encountered this need in my project and was surprised that this issue has been open for years.Here is short example:```App\Entity\Acme: properties: domain: - Hostname: ~ non_tld_domain: - Hostname: { requireTld: false }```The option `requireTld` is `true` by default and disallows domains like localhost and etc.Commits-------8a08c20 Added HostnameValidator
Uh oh!
There was an error while loading.Please reload this page.
This PR adds HostnameValidator support. I encountered this need in my project and was surprised that this issue has been open for years.
Here is short example:
The option
requireTld
istrue
by default and disallows domains like localhost and etc.