Title: Errors after upgrade from PHP4 to PHP5
Last modified: August 19, 2016

---

# Errors after upgrade from PHP4 to PHP5

 *  Resolved Anonymous User 96400
 * (@anonymized-96400)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/errors-after-upgrade-from-php4-to-php5/)
 * Hello,
 * yesterday night my server got updated to PHP5 and MySQL5. Now this morning I 
   am getting these warnings on my site:
 *     ```
       Warning: array_keys() [function.array-keys]: The first argument should be an array in /www/htdocs/w006dc1d/travelogues/wp-includes/widgets.php on line 686
   
       Warning: Invalid argument supplied for foreach() in /www/htdocs/w006dc1d/travelogues/wp-includes/widgets.php on line 686
       ```
   
 * The admin area can’t be accessed at all. That’s what I’m getting there:
 *     ```
       Warning: array_keys() [function.array-keys]: The first argument should be an array in /www/htdocs/w006dc1d/travelogues/wp-includes/widgets.php on line 686
   
       Warning: Invalid argument supplied for foreach() in /www/htdocs/w006dc1d/travelogues/wp-includes/widgets.php on line 686
   
       Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w006dc1d/travelogues/wp-includes/widgets.php:686) in /www/htdocs/w006dc1d/travelogues/wp-includes/pluggable.php on line 770
       ```
   
 * Any help would really be appreciated. Here’s a link to my site: [http://travel-junkie.com/](http://travel-junkie.com/)
   
   Thanks, Boris

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter Anonymous User 96400
 * (@anonymized-96400)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/errors-after-upgrade-from-php4-to-php5/#post-812310)
 * Hey,
 * ok, I figured out that if I uncomment in wp-includes/widgets.php these lines 
   starting from line 686 that everything turns back to normal:
 *     ```
       foreach ( array_keys($options) as $o ) {
       		// Old widgets can have null values for some reason
       		if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) )
       			continue;
       		$id = "text-$o"; // Never never never translate an id
       		wp_register_sidebar_widget($id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ));
       		wp_register_widget_control($id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ));
       	}
       ```
   
 * Surely there has to be another way, though. I am not using any widgets on my 
   blog, I don’t even have a sidebar, so that’s probably why this works for me.
 * Cheers,
    Boris
 *  Thread Starter Anonymous User 96400
 * (@anonymized-96400)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/errors-after-upgrade-from-php4-to-php5/#post-812315)
 * There are also problems with the Contact Form 7 and the Buy Me Beer plugins not
   displaying properly.
 *  Thread Starter Anonymous User 96400
 * (@anonymized-96400)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/errors-after-upgrade-from-php4-to-php5/#post-812316)
 * Maybe I should have searched for this first. Sorry for that. For everybody with
   a similar problem, here’s the solution for all my problems.
 * Adding this to my theme’s functions.php, deleting my browser cache and then loading
   the site again fixed all the warnings and errors:
    `delete_option('widget_rss');`
 * You have to remember to delete that line again once the warnings have disappeared.
 * All my special characters, plus a couple plugins (Buy Me Beer & Contact Form 
   7), were mangled. Commenting this line out of my wp-config.php file solved all
   that:
    `define('DB_CHARSET', 'utf8');`
 * Thanks to Otto42 for that!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Errors after upgrade from PHP4 to PHP5’ is closed to new replies.

## Tags

 * [php4](https://wordpress.org/support/topic-tag/php4/)
 * [php5](https://wordpress.org/support/topic-tag/php5/)
 * [warning](https://wordpress.org/support/topic-tag/warning/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 1 participant
 * Last reply from: Anonymous User 96400
 * Last activity: [17 years, 10 months ago](https://wordpress.org/support/topic/errors-after-upgrade-from-php4-to-php5/#post-812316)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
