Title: Warning about &#039;default object from empty&#039;
Last modified: August 21, 2016

---

# Warning about 'default object from empty'

 *  [barryha](https://wordpress.org/support/users/barryha/)
 * (@barryha)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/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/](http://wordpress.org/extend/plugins/pagerestrict/)

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

 *  [anfal_muhammad](https://wordpress.org/support/users/anfal_muhammad/)
 * (@anfal_muhammad)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/warning-about-default-object-from-empty/#post-3932941)
 * 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?
 *  [Frank Hagan](https://wordpress.org/support/users/frank-hagan/)
 * (@frank-hagan)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/warning-about-default-object-from-empty/#post-3932947)
 * 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](https://wordpress.org/support/users/package/) WordPress
   >  */
 *  [anfal_muhammad](https://wordpress.org/support/users/anfal_muhammad/)
 * (@anfal_muhammad)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/warning-about-default-object-from-empty/#post-3932949)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/pagerestrict.svg)
 * [Page Restrict](https://wordpress.org/plugins/pagerestrict/)
 * [Support Threads](https://wordpress.org/support/plugin/pagerestrict/)
 * [Active Topics](https://wordpress.org/support/plugin/pagerestrict/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pagerestrict/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pagerestrict/reviews/)

## Tags

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

 * 3 replies
 * 3 participants
 * Last reply from: [anfal_muhammad](https://wordpress.org/support/users/anfal_muhammad/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/warning-about-default-object-from-empty/#post-3932949)
 * Status: not resolved