Support » Fixing WordPress » 2.5 – Fatal Error: Cannot use string offset as an array, line 46 dashboard.php

  • Resolved mohkar


    I’ve successfully got 2.5 working locally, however when I migrate to my server by

    a) exporting the database and uploading to my server
    b) updating wp-config.php with the correct details
    c) uploading all files
    and d) changing references from my local install to my online install

    I get the following error when I visit the online WP-Admin:

    Fatal error: Cannot use string offset as an array in <my online site>/blog/wp-admin/includes/dashboard.php on line 46

    I note this does not happen locally. I downloaded my old 2.3 to my local server to do the 2.5 upgrade.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Anyone, I cannot use my site administrative functions till I resolve this.

    I can log in but because the dashboard doesn’t load I can’t access any functions.

    i get this error too…

    BUT you can go directly to the admin functions bypassing the dashboad, go to /blog/wp-admin/edit.php when you get the error.

    Hmm same thing here CMBG! Thanks for showing me that though, gives me some control

    The same problem here …

    Your dashboard widget options somehow got corrupted.

    Open up phpMyAdmin, go to the wp_options table, click on “Search” at the top. Next to the option_name label, type in dashboard_widget_options, and hit “Go”.

    Just one row should pop up. Delete that ONE row by clicking the X.

    That should fix it.

    Thankyou very much, Viper007Bond, did the trick perfectly!

    I wrote a plugin for those who don’t want to use phpMyAdmin as this seems to be a decently common problem.

    I’ve also opened a ticket on the matter and attached a possible fix.

    hey Viper007Bond, it worked perfect!
    thanks man.

    Thank you viper007bond … you saved me a lot of headache! Brilliant!

    Thanks Viper007Bond for your help

    BTW, FYI, Here’s the reason that the dashboard widget options “somehow” got corrupted:

    The option_value for dashboard_widget_options is a serialized object (like many other values in that table). The PHP serialization syntax depends on the lengths of strings being fixed. In the process of transferring the data from my local machine to the live server, I dumped the database (using MySQLDump) and did a search-and-replace on localhost, changing it to the real domain (, in my case). “” is 12 characters longer than “localhost”, and that threw off the deserialization when the option was read back in.

    Thanks Viper007Bond for your help and maximsc for your explaination!

    OK I resolved the issue below, but I’ll leave it for posterity… the answer to my problem was MAGIC QUOTES – they MUST BE TURNED OFF to fix this issue.

    I just moved several sites to a new server, and used cpanel to move the sites, which has worked before. In this current move, all my wordpress sites are showing this error or one of a couple others (all of which have threads here) but none of the fixes mentioned seems to help.

    This is what is on the front page of one of the sites:

    Warning: Invalid argument supplied for foreach() in /home/canadian/public_html/wp-

    includes/capabilities.php on line 31

    Fatal error: Cannot unset string offsets in /home/canadian/public_html/wp-includes/widgets.php on line 362

    Can’t get to the admin screen, don’t use text widgets, deleted the suggested row in the mysql database referring to widgets, none of it has worked. Any advice on this would be appreciated.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘2.5 – Fatal Error: Cannot use string offset as an array, line 46 dashboard.php’ is closed to new replies.