Support » Fixing WordPress » Presentation Menu Broken, again

  • I posted yesterday that my Presentation menu was giving me the following message:

    Fatal error: Call to a member function on a non-object in /home/somegre/public_html/wp-includes/functions.php on line 1377

    on the themes and themes editor pages in the Admin.

    I deleted every file in my WP including all the themes and reloaded WP 1.5 and it looked like it solved the problem, until I tried to FTP a theme folder into wp-content/themes this morning and the error message returned. Does anyone have a clue what is wrong.

Viewing 12 replies - 1 through 12 (of 12 total)
  • I’m looking for the same answer

    This is the relevant code from the error you’re getting beginning with line 1373 and ending with line 1380:

    // Files in wp-content/themes directory
    $themes_dir = @ dir($theme_root);
    if ($themes_dir) {
    while(($theme_dir = $themes_dir->read()) !== false) {
    if (is_dir($theme_root . '/' . $theme_dir)) {
    if ($theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS') {

    Line 1377 is this one: `if (is_dir($theme_root . ‘/’ . $theme_dir)) {‘

    Is there anything weird about where you have located your themes folder? I don’t really know enough about php myself to help though….

    any new updates on this prob/solution?

    @goodsnake: So, can I take conclusion that the particular theme that you uploaded is the one that causes the error? Can I have a copy of that theme?

    neptune is the theme i am currently getting that error in

    I tried neptune and didn’t get any error. Do you have the latest release: Neptune 0.6.2 beta+bugfix release

    uploaded newest theme… didnt help…

    default theme has broken presentation also….

    this one is rough

    The relevant lines are:

    1375 $stylish_dir = @ dir($theme_root . '/' . $theme_dir);
    1376 $found_stylesheet = false;
    1377 while(($theme_file = $stylish_dir->read( )) !== false) {

    As you can see, if dir() on line 1375 fails, it fails silently and the bad value isn’t caught. A better approach might be to do:

    1375 $stylish_dir = @ dir($theme_root . '/' . $theme_dir);
    1376 if(!$stylish_dir) continue;

    …which would prevent the nasty error. It might also be good to spit out a warning of some kind. (Something like “Check the permissions and ownership on $theme_dir in your themes/ directory” would work.)

    In my case, the call to dir() fails because PHP does a UID/GID check when in safe mode: It doesn’t have permission to read $theme_root/$theme_dir, so $stylish_dir is FALSE. When line 1377 calls ->read() on $stylish_dir, you get a “Call to member function on non-object,” which is absolutely reasonable. 🙂

    To fix this problem, make sure that the user:group combination that owns the new theme directory is the same as the user:group combination that owns your other WordPress files. Also, make sure the permissions are 555 or another reasonable value.

    cd /www/htdocs/wp-content/themes/
    chown apache:apache my_ultra_sweet_theme
    chmod 555 my_ultra_sweet_theme

    God Bless You…

    I will follow this sneeze of code and see what happens…

    I was at my wits end…

    I may still be



    hey that worked for me too!
    bless you
    bless you!

    Comment for people running WP on Windows XP:

    I had this problem, and basically it was because the folder with the theme didn’t have the right permissions assigned.

    Easiest way to do this (assuming everything worked before) is to right click folder where WP is, go to security tab, click on advanced, and check “inherit from parent the permission…blah blah”, and click ok.

    Then try everything and it should work fine.

    I wouldn’t mess with the code, as suggested above.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Presentation Menu Broken, again’ is closed to new replies.