Page Restrict
Warning about 'default object from empty' (4 posts)

  1. barryha
    Posted 3 years ago #

    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.


  2. anfal_muhammad
    Posted 3 years ago #

    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?

  3. Frank Hagan
    Posted 3 years ago #

    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

  4. anfal_muhammad
    Posted 3 years ago #

    Thanks for the help it worked.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Page Restrict
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic