WordPress.org

Ready to get started?Download WordPress

Forums

Fatal error in Dashboard, "Unsupported operand types" ? (12 posts)

  1. donzacharias
    Member
    Posted 6 years ago #

    The upgrade went smoothly and everything is fine *except* in the Dashboard, where I am supposed to get widgets I get


    Fatal error: Unsupported operand types in /path/to/wp-admin/index.php(101) : runtime-created function on line 1

    I can't tell if that is a PHP version error (I'm on 4.3.2) or a problem with a plugin (I deactivated all, same problem) or what. Anybody else experience this? I'm seeing other fatal errors on the forum but not this one.

    Fortunately everything else is working. Thanks!

  2. neilmiddleton
    Member
    Posted 6 years ago #

    I am also getting this error - also on PHP 4.3.2. Does anyone have any ideas on how to sort it?

  3. lisamac
    Member
    Posted 6 years ago #

    I'm stuck too. Just that one error that stops the widgets from displaying in the dashboard. Everything else seems fine.

    Based on some of the other issues people had with php and mysql versions when upgrading from 2.1 to 2.2 I'm guessing it's a similar issue.

    Can anyone verify they have WP2.5 working without this issue using the following setup or similar?

    Current WordPress version 2.5
    Server operating system Linux
    Current version of PHP PHP 4.3.2
    Current version of MySQL MySQL 4.1.22-standard
    Webserver software Apache/2.0.46 (Red Hat)

    Any help you could give would be much appreciated.
    Thanks!
    Lisa

  4. lisamac
    Member
    Posted 6 years ago #

    Works fine with this setup:

    Current WordPress version: 2.5
    Server operating system: Linux
    Current version of PHP: PHP 4.4.8
    Current version of MySQL: MySQL 4.1.11-Debian_4sarge7-log
    Webserver software: Apache/2.0.54

    All plugins disabled didn't solve the problem.

  5. dvsjr
    Member
    Posted 6 years ago #

    can you post line 1 of your index.php file?

  6. neilmiddleton
    Member
    Posted 6 years ago #

    First ten lines:

    <?php
    
    require_once('admin.php');
    
    require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
    
    wp_dashboard_setup();
    
    function index_js() {
    ?>
  7. helpingmoms
    Member
    Posted 6 years ago #

    I've got the exact same error in mine.

  8. donzacharias
    Member
    Posted 6 years ago #

    Commenting out lines 98 through 111 in wp-admin/index.php removed the fatal error, so the widgets show. You don't get theme- and widget-related links in the "Right Now" box is all.

    So based on lisamac's comment, PHP 4.3.2 must have a problem with this

    $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );

  9. mbernolak
    Member
    Posted 6 years ago #

    donzacharias, do you mind posting lines 98 through 111 so I know exactly what to comment out. I commented mine 98-111 out but I am still getting error so maybe I'm not commenting the correct lines in wp-admin/index.php

    This time it's:
    Warning: Unknown modifier 'd' in ...plugins/wordpress-dashboard-editor/dashboard.php on line 109

  10. SidVision
    Member
    Posted 6 years ago #

    Here is the fix. I tried it out and it worked great. I got it from this post:
    http://wordpress.org/support/topic/164325?replies=4

    ---------------------
    This is a bug in wordpress. It's going through a list of lists of stuff in the sidebar, and adding up the lengths of each list. The problem is that the initial sum is NULL rather than 0. Fix is to add ,0 right before the last end paren.

    Like so:

    $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
    ---------------------

    . . so just add the ====> ,0
    like above and try. Make sure you have a backup of your wp-admin/index.php file first. I initially forgot to add the comma and could not get into the admin at all.

  11. Roger Theriault
    Member
    Posted 6 years ago #

    Thanks. I patched my 2.5.1 install. Would be nice if it eventually gets fixed for good, but thanks for the solution.

  12. phaedral
    Member
    Posted 6 years ago #

    SidVision, adding the zero did the trick. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic