I have been experiencing too many following errors in my apache logs.
PHP Fatal error: Cannot call overloaded function for non-object in wp-includes/capabilities.php on line 1187
This is inside function current_user_can( $capability ) and line 1187 is as follows:
$current_user = wp_get_current_user();
I am not able to figure out what can be the issue?
This issue usually stems from PHP configuration issues, APC caching, and/or a call to an incompatible XML library.
From what I’ve seen, it is usually a combination of php 5.2.X and caching. If you’re using caching on your site, try switching from APC/memcached cache to disk caching and see if it clears up. 9/10 times, disabling APC at the server level clears it up as well (if you have full server access). Keep in mind that your host may have APC enabled by default.
In the meantime, make sure you have these lines in your
wp-config.php
:This turns on WP debugging, and will output to /wp-content/debug.log. It’s not a full stack trace, but it keeps these errors from showing up to your end users and may log other errors you haven’t seen. You can also install the Debug Bar plugin, which will let you (Administrators only) see errors/notices, memory usage by php (which can tell you if you need to increase the limit), number of queries (if
SAVE_QUERIES
is set) used to generate a page, and so on. You can also (again, if you have server access) set up PHP with XDebug, which will generate a full stack trace on PHP errors.I hope some of this at least points you in the right direction.
Hey I found the answer in this forum.
“Just wanted to share how I fix the issue. In the cpanel control panel, choose “Select PHP version”. Then I select “PHP Version 5.5″. Then click save.”
Worked for me. It seems like it’s a godaddy php configuration issue. My error message was for a line in user.php not capabilities.
I have found that usually these capability problems end up being in a plugin somewhere (hard to find since the error looks like it’s in core wordpress).
The non-object part may mean that wp does not yet have the $current_user object setup – may mean a call to a capability check too early in the wordpress actions.
The overloading part usually means that it is a user meta value that wp is trying to fetch (which a capability is).
BEST way is disable plugins one by one until message goes away – then you know which plugin it is at least. Bit tough if you do not know when it is happening – can you tell which page it is on, or what people are doingwhen it happens?
Then look at plugins wordpress functions – maybe a add action that is early in action sequence? http://codex.wordpress.org/Plugin_API/Action_Reference
(could also try googling each plugin with the later part of that message?
eg: “wp-includes/capabilities.php on line 1187” gave me:
http://support.dev7studios.com/discussions/nivo-slider-wordpress-plugin/544-fatal-error
let us know how you go