Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,21 @@ Validator
changed to `true` as of 4.0. If you need the previous behaviour ensure to
set the option to `false`.

* Setting the `checkDNS` option of the `Url` constraint to `true` is dropped
in favor of `Url::CHECK_DNS_TYPE_*` constants values.

Before:

```php
$constraint = new Url(['checkDNS' => true]);
```

After:

```php
$constraint = new Url(['checkDNS' => Url::CHECK_DNS_TYPE_ANY]);
```

VarDumper
---------

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Validator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CHANGELOG
is not supported anymore.
* removed the `DateTimeValidator::PATTERN` constant
* removed the `AbstractConstraintValidatorTest` class
* removed support for setting the `checkDNS` option of the `Url` constraint to `true`

3.4.0
-----
Expand Down
6 changes: 0 additions & 6 deletions src/Symfony/Component/Validator/Constraints/UrlValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ public function validate($value, Constraint $constraint)
}

if ($constraint->checkDNS) {
// backwards compatibility
if ($constraint->checkDNS === true) {
$constraint->checkDNS = Url::CHECK_DNS_TYPE_ANY;
@trigger_error(sprintf('Use of the boolean TRUE for the "checkDNS" option in %s is deprecated. Use Url::CHECK_DNS_TYPE_ANY instead.', Url::class), E_USER_DEPRECATED);
}

if (!in_array($constraint->checkDNS, array(
Url::CHECK_DNS_TYPE_ANY,
Url::CHECK_DNS_TYPE_A,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,23 +260,6 @@ public function getCheckDnsTypes()
);
}

/**
* @group legacy
*/
public function testCheckDnsWithBoolean()
{
DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'A'))));

$constraint = new Url(array(
'checkDNS' => true,
'dnsMessage' => 'myMessage',
));

$this->validator->validate('http://example.com', $constraint);

$this->assertNoViolation();
}

/**
* @expectedException \Symfony\Component\Validator\Exception\InvalidOptionsException
* @requires function Symfony\Bridge\PhpUnit\DnsMock::withMockedHosts
Expand Down