Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The function returns the result of preg_match which returns either an integer (0 or 1) or FALSE if an error occurs.
So there is never TRUE returned, you cannot test like === TRUE.
I'm not sure if this is a documentation problem. In my opinion the function should return the following:
return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail) === 1;
Comments
Comment #1
berliner CreditAttribution: berliner commentedsee:
http://api.drupal.org/api/function/valid_email_address/6
http://php.net/manual/en/function.preg-match.php
Comment #2
jhodgdonThanks for reporting, but this issue has already been reported.
#505730: valid_email_address: wrong return type