Paperless payday loansmilitary payday or take several visits appliance Advance Cash Advance Cash repair bill that pop up anymore.

Error adding theme to WordPress 2.8

I was getting this error:

PHP Fatal error: Call to a member function read() on a non-object in ... \\wp-includes\\theme.php on line 387

Fixed it by editing wp-includes/theme.php, adding ‘is_object’ check at line 387 as follows :

$template_dir = @ dir("$theme_root/$template");
if ( $template_dir ) {
	while ( ($file = $template_dir->read()) !== false ) {
		if ( preg_match('|^\.+$|', $file) )
			continue;
		if ( preg_match('|\.php$|', $file) ) {
			$template_files[] = "$theme_loc/$template/$file";
		} elseif ( is_dir("$theme_root/$template/$file") ) {
			$template_subdir = @ dir("$theme_root/$template/$file");
                if ( is_object($template_subdir) ) {
                        while ( ($subfile = $template_subdir->read()) !== false ) {
                             if ( preg_match('|^\.+$|', $subfile) )
                                continue;
                            if ( preg_match('|\.php$|', $subfile) )
                                $template_files[] = "$theme_loc/$template/$file/$subfile";
                        }
                        @ $template_subdir->close();
                    }
                }
	}
	@ $template_dir->close();
}

13 Comments »

  1. 3mr3 said,

    July 15, 2009 @ 10:21 am

    Teşekkürler.

    Thanks 😉

  2. Cyberfarer said,

    August 6, 2009 @ 12:56 pm

    Yes, thank you.

  3. beastie said,

    August 31, 2009 @ 8:08 pm

    Excellent post thank you for your help!

    !!!

  4. Brandon Rhodes said,

    September 6, 2009 @ 12:41 am

    That solution, in my case, resulted in the dashboard partly disappearing early in the day, then completely disappearing later. So, I returned the code to the way it was. It turns out that the problem is that WordPress now scans all sub-directories of your themes, and, since my theme was version-controlled, it had a “.svn” directory under it that had been set to readable only by me — not by the user running my web site. A quick “chmod” later, and all was working again.

  5. Chris Bauer said,

    September 6, 2009 @ 1:01 am

    Horray! Thanks.

  6. Obie said,

    November 19, 2009 @ 10:06 am

    Thanks-a-million!

  7. Javier said,

    December 3, 2009 @ 6:48 pm

    The same solution as Brandon worked fine for me. I am not really sure how it happened but the permissions changed without my acknowledge.

    Anyway its working fine now.

    Javier.

  8. Error adding theme to Wordpress 2.8 | WpMash - WordPress News said,

    December 18, 2009 @ 12:31 pm

    […] See the article here: Error adding theme to WordPress 2.8 […]

  9. Tweets that mention Barbarous Dissonance » Error adding theme to Wordpress 2.8 -- Topsy.com said,

    December 18, 2009 @ 2:06 pm

    […] This post was mentioned on Twitter by enricocorinti, enricocorinti. enricocorinti said: #WP Admin Page Blank after upgrade to 2.8? A bad #Wordpress #bug fixed! http://icio.us/idqskq […]

  10. booleanlife said,

    March 13, 2010 @ 6:32 am

    the whole blog is not loading due to this problem
    and changing theme.php didn’t fix it.
    Can you tell us where you changed the chmod
    brandon?

  11. hdenman said,

    March 13, 2010 @ 11:58 am

    booleanlife – my assumption is that brandon would have set the .svn directory inside the theme to be world readable, something like chmod -R a+r .svn issued in the shell from inside the theme directory.

    This will only apply if your theme is being kept in version control using subversion.

  12. Anderson said,

    March 2, 2012 @ 6:17 pm

    works like a charm.

    thanks, man!

  13. Anderson Clayton said,

    June 15, 2012 @ 4:55 pm

    Brandon`s solutions worked for me, but in my case it was “log” directory inside default WP themes that wasnt readable.

    regards

RSS feed for comments on this post · TrackBack URI

Leave a Comment