Ditch redundant trim-and-length check
authorRob Church <robchurch@users.mediawiki.org>
Tue, 10 Jul 2007 15:08:48 +0000 (15:08 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Tue, 10 Jul 2007 15:08:48 +0000 (15:08 +0000)
includes/User.php

index e17c253..939caf2 100644 (file)
@@ -497,7 +497,7 @@ class User {
        }
 
        /**
-        * Does the string match roughly an email address ?
+        * Does a string look like an email address?
         *
         * There used to be a regular expression here, it got removed because it
         * rejected valid addresses. Actually just check if there is '@' somewhere
@@ -506,12 +506,10 @@ class User {
         * @todo Check for RFC 2822 compilance (bug 959)
         *
         * @param string $addr email address
-        * @static
         * @return bool
         */
-       static function isValidEmailAddr ( $addr ) {
-               return ( trim( $addr ) != '' ) &&
-                       (false !== strpos( $addr, '@' ) );
+       public static function isValidEmailAddr( $addr ) {
+               return strpos( $addr, '@' ) !== false;
        }
 
        /**