Merge "Use the same object when checking if the user is blocked instead of creating...
[lhc/web/wiklou.git] / includes / Block.php
index 42504be..7cdc756 100644 (file)
@@ -1080,8 +1080,6 @@ class Block {
         * @return array( User|String, Block::TYPE_ constant )
         */
        public static function parseTarget( $target ) {
-               $target = trim( $target );
-
                # We may have been through this before
                if( $target instanceof User ){
                        if( IP::isValid( $target->getName() ) ){
@@ -1093,6 +1091,8 @@ class Block {
                        return array( null, null );
                }
 
+               $target = trim( $target );
+
                if ( IP::isValid( $target ) ) {
                        # We can still create a User if it's an IP address, but we need to turn
                        # off validation checking (which would exclude IP addresses)