#16225 closed defect (bug) (fixed)
Undefined properties in ms-functions.php on line 93
Reported by: | garyc40 | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Import | Keywords: | has-patch |
Focuses: | Cc: |
Description
Reproducing this one is a bit tricky:
- Import content from an xml file, choose to create users to attach these imported posts to
- Go to Users -> Edit an imported user's password so that you can log in under that user
- Log in as that imported user
There are 3 notices:
Notice: Undefined property: stdClass::$archived in /Applications/MAMP/htdocs/wptest/wp-includes/ms-functions.php on line 93
Notice: Undefined property: stdClass::$spam in /Applications/MAMP/htdocs/wptest/wp-includes/ms-functions.php on line 93
Notice: Undefined property: stdClass::$deleted in /Applications/MAMP/htdocs/wptest/wp-includes/ms-functions.php on line 93
Attachments (1)
Change History (8)
#3
@
14 years ago
Here's the output:
object(stdClass)[48] public 'userblog_id' => int 1 public 'blogname' => string 'WP Test' (length=7) public 'domain' => string 'localhost' (length=9) public 'path' => string '/wptest/' (length=8) public 'site_id' => string '1' (length=1) public 'siteurl' => string 'http://localhost/wptest' (length=23)
The weird thing is that $primary_blog
is an empty string. Perhaps the importer I used (WordPress importer) didn't properly update the 'primary_blog' user meta?
I repeated the steps to reproduce above, and try to get_user_meta() of the imported users right after importing. The primary_blog is always empty string.
Or perhaps line 79 in get_active_blog_for_user() is the problem. It seems to work when I change
if ( false !== $primary_blog ) {
to
if ( $primary_blog ) {
#4
@
12 years ago
- Keywords has-patch added; needs-patch removed
this happens because get_blogs_of_user()
builds a map of blogs, checks to make sure ! $blog->archived && ! $blog->spam && ! $blog->deleted
but then builds a new stdClass
and doesn't pass that data along.
( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 )
us checked by get_active_blog_for_user()
, which is correct, because sometimes $primary = get_blog_details( $primary_blog );
which is an object with those properties.
Patch attached.
Can you var_dump $primary?
Sounds like the is_object() check there is designed to prevent this, but it just isn't enough.