Commit cb244d0d authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #3027871 by catch, alexpott, jibran, Gábor Hojtsy, Berdir: [symfony 4]...

Issue #3027871 by catch, alexpott, jibran, Gábor Hojtsy, Berdir: [symfony 4] Symfony\Component\Validator\Constraints\Email::$strict property is deprecated since Symfony 4.1
parent dd324bd1
......@@ -16,7 +16,25 @@
*/
class EmailConstraint extends Email {
public $strict = TRUE;
/**
* {@inheritdoc}
*/
public function __construct($options = []) {
// Since Symfony 4.1, the 'mode' property is used, for previous versions the
// 'strict' property. If the 'strict' property is set,
// \Symfony\Component\Validator\Constraints\EmailValidator will trigger
// a deprecation error, so only assign a value for versions of Symfony
// < 4.2. This compatibility layer can be removed once Drupal requires
// Symfony 4.2 or higher in https://www.drupal.org/node/3009219.
if (property_exists($this, 'mode')) {
$default_options = ['mode' => 'strict'];
}
else {
$default_options = ['strict' => TRUE];
}
$options += $default_options;
parent::__construct($options);
}
/**
* {@inheritdoc}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment