Skip to content

Commit 4e880e8

Browse files
committed
minor #9131 Updated the behavior of the checkDNS option (javiereguiluz)
This PR was squashed before being merged into the 3.4 branch (closes #9131). Discussion ---------- Updated the behavior of the checkDNS option This fixes #8171. Commits ------- 599d556 Updated the behavior of the checkDNS option
2 parents 7b219e0 + 599d556 commit 4e880e8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

reference/constraints/Url.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ checkDNS
233233

234234
By default, this constraint just validates the syntax of the given URL. If you
235235
also need to check whether the associated host exists, set the ``checkDNS``
236-
option to ``true``:
236+
option to the value of any of the ``CHECK_DNS_TYPE_*`` constants in the
237+
:class:`Symfony\\Component\\Validator\\Constraints\\Url` class:
237238

238239
.. configuration-block::
239240

@@ -248,7 +249,7 @@ option to ``true``:
248249
{
249250
/**
250251
* @Assert\Url(
251-
* checkDNS = true
252+
* checkDNS = "ANY"
252253
* )
253254
*/
254255
protected $bioUrl;
@@ -260,7 +261,7 @@ option to ``true``:
260261
AppBundle\Entity\Author:
261262
properties:
262263
bioUrl:
263-
- Url: { checkDNS: true }
264+
- Url: { checkDNS: 'ANY' }
264265
265266
.. code-block:: xml
266267
@@ -273,7 +274,7 @@ option to ``true``:
273274
<class name="AppBundle\Entity\Author">
274275
<property name="bioUrl">
275276
<constraint name="Url">
276-
<option name="checkDNS">true</option>
277+
<option name="checkDNS">ANY</option>
277278
</constraint>
278279
</property>
279280
</class>
@@ -292,13 +293,13 @@ option to ``true``:
292293
public static function loadValidatorMetadata(ClassMetadata $metadata)
293294
{
294295
$metadata->addPropertyConstraint('bioUrl', new Assert\Url(array(
295-
'checkDNS' => true,
296+
'checkDNS' => Assert\Url::CHECK_DNS_TYPE_ANY,
296297
)));
297298
}
298299
}
299300
300301
This option uses the :phpfunction:`checkdnsrr` PHP function to check the validity
301-
of the ``ANY`` DNS record corresponding to the host associated with the given URL.
302+
of the DNS record corresponding to the host associated with the given URL.
302303

303304
dnsMessage
304305
~~~~~~~~~~

0 commit comments

Comments
 (0)