[wpmu-trac] [WordPress MU Trac] #1130: Possible logic error in wpmu-functions.php

WordPress MU Trac wpmu-trac at lists.automattic.com
Sun Oct 11 19:23:02 UTC 2009


#1130: Possible logic error in wpmu-functions.php
---------------------+------------------------------------------------------
 Reporter:  ctsttom  |       Owner:  somebody
     Type:  defect   |      Status:  new     
 Priority:  high     |   Milestone:          
Component:  General  |     Version:          
 Severity:  minor    |    Keywords:          
---------------------+------------------------------------------------------
 Whilst updating the WPMU doc I was trying to work out the purpose of the
 $user variable which is passed into wpmu_validate_blog_signup on line 997.

 I was reading through the code and noticed at line 1053 to 1056 the
 following code is used...

         if ( username_exists($blogname) ) {
                 if  ( !is_object($user) && ( $user->user_login !=
 $blogname ) )
                         $errors->add('blogname', __("Sorry, that blog is
 reserved!"));
         }

 The first if makes sense its checking to see if the blogname is also a
 username for another user to prevent people signing up blog names for
 which users exist which may wish to register their username as a blog
 name.

 However the nested seems to never become true as its saying if $user is
 not an object and if the object $user....

 As you can see there is no situation I can imagine where $user could be an
 object and also not be an object at the same time.

 So how does this work?!

-- 
Ticket URL: <http://trac.mu.wordpress.org/ticket/1130>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser


More information about the wpmu-trac mailing list