WordPress.org

Support

Support » Plugins and Hacks » Warning about 'default object from empty'

Warning about 'default object from empty'

  • Works fine if I’m logged in. But the first-time visitor to my restricted page receives a PHP warning on my development web server:
    Warning: Creating default object from empty value in D:\htdocs\sdbuildingtrades\wp-content\plugins\pagerestrict\pagerestrict.php on line 76

    Where pagerestrict.php line 76 contains “$post->comment_status = ‘closed’;”

    The warning appeared after moving the website to a new server, in effect upgrading several components at once: Apache 2.2.22 -> 2.4.4, MySQL 5.5.24 -> 5.6.12, PHP 5.3.13 -> 5.4.12, WordPress 3.1.2 -> 3.5.2. I know this hardly pins anything down, sorry.

    Thanks in advance for any tips about work-arounds.

    http://wordpress.org/extend/plugins/pagerestrict/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I got the same error
    Warning: Creating default object from empty value in C:\xampp\htdocs\site\wp-content\plugins\pagerestrict\pagerestrict.php on line 76
    Does anyone have solution?

    Your web host probably upgraded to PHP 5.4. I had this crop up on my server when I upgraded this week. My understanding is that this error message really doesn’t DO anything other than annoy you, so its safe to turn off the display of it.

    In wp-config.php, put this line:

    ini_set( 'display_errors', 0 );

    I put it near the top, under:

    * @package WordPress
    */

    Thanks for the help it worked.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Warning about 'default object from empty'’ is closed to new replies.