1

I have moved a local Wordpress site from one computer to another.

Now the site loads on the new machine and I can switch to other pages in the site but except for the homepage I get many "Creating default object from empty value in..." warnings on every page.

What's causing this?

Thanks

Edit:

Adding a sample of the warnings I get:

Warning: Creating default object from empty value in C:\wamp\www\maps_en2\wp-includes\user.php on line 657

1   0.0007  249320  {main}( )   ..\index.php:0
2   0.0010  252888  require( 'C:\wamp\www\maps_en2\wp-blog-header.php' )    ..\index.php:17
3   0.0013  265520  require_once( 'C:\wamp\www\maps_en2\wp-load.php' )  ..\wp-blog-header.php:12
4   0.0017  277032  require_once( 'C:\wamp\www\maps_en2\wp-config.php' )    ..\wp-load.php:30
5   0.0027  363752  require_once( 'C:\wamp\www\maps_en2\wp-settings.php' )  ..\wp-config.php:90
6   0.2085  14508248    do_action( )    ..\wp-settings.php:298
7   0.2282  14746528    call_user_func_array ( )    ..\plugin.php:395
8   0.2282  14746560    _wp_admin_bar_init( )   ..\plugin.php:395
9   0.2293  14807256    WP_Admin_Bar->initialize( ) ..\admin-bar.php:34
10  0.2294  14808136    get_blogs_of_user( )    ..\class-wp-admin-bar.php:18
  • Can you give more detail as to which file(s) this error is occuring in? If you copy the site to your dev machine, do the errors also happen there? – halfer Jul 22 '13 at 16:56
  • @halfer, all of the pages on my site are Wordpress pages that use templates I wrote, that include php and javascript code. I don't get the warnings on the original machine on which I developed those templates, only on the new machine ( a laptop). – user1430841 Jul 22 '13 at 20:28
  • Added a sample of the warnings on the original post. – user1430841 Jul 22 '13 at 20:31
  • Can you clarify "templates"? Do you mean a theme? Can you narrow down where these are coming from? Is this running custom code or ordinary unmodified Wordpress code? Is it happening on all kinds of page (blog list, single blog entry, a static page, etc)? I wonder, if it is happening on many pages, whether the problem is in your theme header or footer? – halfer Jul 24 '13 at 09:29

3 Answers3

1

Setting display_errors to 0 didn't work for me. But inserting this at the beginning of user.php to disable warnings did:

error_reporting(E_ERROR);
reflexiv
  • 1,693
  • 1
  • 21
  • 24
0

Your new environment might not be having E_STRICT warnings enabled.

Add the following line to your wp-config.php:

ini_set( 'display_errors', 0 );

Note: That should fix the issues, but it's recommended to create the object manually first.

Amal Murali
  • 75,622
  • 18
  • 128
  • 150
  • 1
    You can hide the warnings, but really you should fix them, it is highly probable you will only need to [READ and debug](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) the error messages then make a change in a single line to actually fix the problem rather than hide the symptom. You should always develop with warnings turned on anyway. – Anigel Jul 22 '13 at 15:54
  • But why should there be any missing objects if I imported the database? – user1430841 Jul 22 '13 at 16:13
0

Problem was different wamp versions.