-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Deprecated "checkDNS" option in Url constraint #25516
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
Conversation
ro0NL
commented
Dec 15, 2017
•
edited
Loading
edited
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #23538 |
License | MIT |
Doc PR | symfony/symfony-docs#8921 |
@@ -90,6 +90,8 @@ public function validate($value, Constraint $constraint) | |||
throw new InvalidOptionsException(sprintf('Invalid value for option "checkDNS" in constraint %s', get_class($constraint)), array('checkDNS')); | |||
} | |||
|
|||
@trigger_error(sprintf('The "checkDNS" option in "%s" is deprecated since 4.1 and will be removed in 5.0.', Url::class), E_USER_DEPRECATED); |
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.
since version 4.1
I'm wondering: should we add a few words why? like eg
The "checkDNS" option in "%s" is deprecated since 4.1 and will be removed in 5.0. It's too fragile to be relied upon.
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.
the notice should be before the above "if", isn't it?
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.
Not sure if this is too fragile, but the false positive rate is so high that it's not reliable. I think reliable is perhaps better.
@@ -73,6 +73,8 @@ public function validate($value, Constraint $constraint) | |||
} | |||
|
|||
if ($constraint->checkDNS) { | |||
@trigger_error(sprintf('The "checkDNS" option in "%s" is deprecated since version 4.1 and will be removed in 5.0. Its false positive rate is too high to be relied upon.', Url::class), E_USER_DEPRECATED); |
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.
I would just suggest a dash: false-positive
UPGRADE-4.1.md
Outdated
@@ -30,6 +30,7 @@ Validator | |||
|
|||
* The `Email::__construct()` 'strict' property is deprecated and will be removed in 5.0. Use 'mode'=>"strict" instead. | |||
* Calling `EmailValidator::__construct()` method with a boolean parameter is deprecated and will be removed in 5.0, use `EmailValidator("strict")` instead. | |||
* Deprecated `checkDNS` option in `Url` constraint. It will be removed in 5.0. |
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.
Deprecated the checkDNS
option in the Url
[...]
UPGRADE-5.0.md
Outdated
@@ -29,7 +29,7 @@ Validator | |||
|
|||
* The `Email::__construct()` 'strict' property has been removed. Use 'mode'=>"strict" instead. | |||
* Calling `EmailValidator::__construct()` method with a boolean parameter has been removed, use `EmailValidator("strict")` instead. | |||
|
|||
* Removed `checkDNS` option in `Url` constraint. |
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.
Removed the checkDNS
option from the Url
constraint.
4.1.0 | ||
----- | ||
|
||
* Deprecated `checkDNS` option in `Url` constraint. It will be removed in 5.0. |
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.
Deprecated the checkDNS
option in the Url
[...]
@@ -21,18 +21,57 @@ | |||
*/ | |||
class Url extends Constraint | |||
{ | |||
/** | |||
* @deprecated since version 4.1, to be removed in 5.0 |
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.
since Symfony 4.1 (see #25565)
Forgot to deprecate |
As people may forgot to not use the |
Deprecation now moved to constraint constructor. |
UPGRADE-4.1.md
Outdated
@@ -30,6 +30,7 @@ Validator | |||
|
|||
* The `Email::__construct()` 'strict' property is deprecated and will be removed in 5.0. Use 'mode'=>"strict" instead. | |||
* Calling `EmailValidator::__construct()` method with a boolean parameter is deprecated and will be removed in 5.0, use `EmailValidator("strict")` instead. | |||
* Deprecated the `checkDNS` and `dnsMessage` options in the `Url` constraint. They will be removed in 5.0. |
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.
[...] options of the [...]
UPGRADE-5.0.md
Outdated
@@ -29,7 +29,7 @@ Validator | |||
|
|||
* The `Email::__construct()` 'strict' property has been removed. Use 'mode'=>"strict" instead. | |||
* Calling `EmailValidator::__construct()` method with a boolean parameter has been removed, use `EmailValidator("strict")` instead. | |||
|
|||
* Removed the `checkDNS` and `dnsMessage` options in the `Url` constraint. |
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.
[...] options from the [...]
4.1.0 | ||
----- | ||
|
||
* Deprecated the `checkDNS` and `dnsMessage` options in the `Url` constraint. They will be removed in 5.0. |
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.
[...] options of the [...]
Thank you @ro0NL. |
I'm actually sad to see this go. Adding the functionality back into our project as a customized extension was not difficult, but I think it odd that there was so little discussion around the deprecation. If the underlying functionality is deemed inconclusive because of false positives, that's something that should be understood by the consuming application. We know that, and use this functionality as just one piece of a greater validation strategy. Having it as an option was just that, an option. |
Also, the same functionality continues to exist undeprecated as the |
This PR was merged into the 5.0-dev branch. Discussion ---------- [Validator] Remove checkDNS option in Url | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> See #25516 Commits ------- 885703f [Validator] Remove checkDNS option in Url