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

berliner’s picture

jhodgdon’s picture

Status: Active » Closed (duplicate)

Thanks for reporting, but this issue has already been reported.
#505730: valid_email_address: wrong return type