PHP Fatal Error….
-
This plugin appears to be throwing occasional Fatal Errors. Specifically, the error logs read
“PHP Fatal error: Call to a member function get_role_caps() on a non-object in /***/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389”It means I keep having to log out and then log back in again in order to keep editing and previewing.
Is there a simple fix for this?
Thanks
-
Hi,
Can you please provide the full debug.log trace related to this error? I’d like to see where exactly this originates from and under which conditions. I don’t see any of this happening and suspect that it is related to a plugin conflict or a fix needed under a very specific condition.
Thanks!
I have the server error logs available. Is that what you require? I’m hosted on Wpengine.
The first 18 instances (out of many) are below:[Fri Feb 24 00:19:20.505283 2017] [:error] [pid 20548] [client 69.92.34.69:32566] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389, referer: https://discoveringdowsing.com/wp-admin/post.php?post=9551&action=edit
[Fri Feb 24 00:21:32.607717 2017] [:error] [pid 3436] [client 69.92.34.69:34989] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389, referer: https://discoveringdowsing.com/wp-admin/post.php?post=9551&action=edit
[Fri Feb 24 00:23:36.136676 2017] [:error] [pid 18356] [client 69.92.34.69:37012] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389, referer: https://discoveringdowsing.com/wp-admin/post.php?post=9551&action=edit
[Fri Feb 24 00:25:37.724056 2017] [:error] [pid 1343] [client 69.92.34.69:41964] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389, referer: https://discoveringdowsing.com/wp-admin/post.php?post=9551&action=edit
[Fri Feb 24 00:28:04.984258 2017] [:error] [pid 16956] [client 127.0.0.1:17471] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 00:33:04.503612 2017] [:error] [pid 28256] [client 127.0.0.1:22541] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 00:38:06.518633 2017] [:error] [pid 27609] [client 127.0.0.1:26917] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 00:43:04.418286 2017] [:error] [pid 6697] [client 127.0.0.1:32412] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 00:48:05.578409 2017] [:error] [pid 5860] [client 127.0.0.1:36276] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 00:53:02.915707 2017] [:error] [pid 17452] [client 127.0.0.1:41076] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 00:58:06.513784 2017] [:error] [pid 16203] [client 127.0.0.1:46274] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:03:05.030080 2017] [:error] [pid 26993] [client 127.0.0.1:52626] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:08:05.723464 2017] [:error] [pid 4780] [client 127.0.0.1:58413] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:13:05.289862 2017] [:error] [pid 16602] [client 127.0.0.1:64404] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:18:04.456569 2017] [:error] [pid 15514] [client 127.0.0.1:15665] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:22:56.489473 2017] [:error] [pid 26841] [client 86.183.43.4:20248] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:28:03.638334 2017] [:error] [pid 25683] [client 127.0.0.1:24222] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389
[Fri Feb 24 01:33:05.303964 2017] [:error] [pid 5459] [client 127.0.0.1:31032] PHP Fatal error: Call to a member function get_role_caps() on a non-object in /nas/content/live/discdowsing/wp-content/plugins/groups/lib/core/class-groups-user.php on line 389I am also getting the exact same error. What’s weird is it seems to be happening every 15 minutes or so for me according to my logs, and looking at the stack trace it references a cron event file.
I am also getting a warning every now and then from the Groups 404 plugin: E_WARNING: require_once(GROUPS_LEGACY_LIB/access/class-groups-post-access-legacy.php): failed to open stream: No such file or directory, might be unrelated though.
I’m currently running Groups 1.13.1 and Groups 404 Redirect 1.3.0, on WordPress 4.7.3
I’m going to try update to Groups 2 and see if that fixes this error
My stack trace:
Error: Call to a member function get_role_caps() on boolean
+ 3 non-project frames
4
File “/srv/www/web/wp/wp-includes/class-wp-hook.php” line 300 in apply_filters
5
File “/srv/www/web/wp/wp-includes/plugin.php” line 203 in apply_filters
6
File “/srv/www/web/wp/wp-includes/class-wp-user.php” line 743 in has_cap
7
File “/srv/www/web/wp/wp-includes/capabilities.php” line 609 in user_can
8
File “/srv/www/web/wp/wp-includes/functions.php” line 2552 in get_allowed_mime_types
+ 2 non-project frames
11
File “/srv/www/web/wp/wp-includes/class-wp-hook.php” line 300 in apply_filters
12
File “/srv/www/web/wp/wp-includes/plugin.php” line 203 in apply_filters
+ 6 non-project frames
19
File “/srv/www/web/wp/wp-includes/class-wp-hook.php” line 298 in apply_filters
20
File “/srv/www/web/wp/wp-includes/class-wp-hook.php” line 323 in do_action
21
File “/srv/www/web/wp/wp-includes/plugin.php” line 515 in do_action_ref_array
22
File “phar:///usr/bin/wp/php/commands/cron-event.php” line 284 in run_event
23
File “phar:///usr/bin/wp/php/commands/cron-event.php” line 255 in run
+ 1 non-project frame
25
File “phar:///usr/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php” line 67 in WP_CLI\Dispatcher\{closure}
+ 1 non-project frame
27
File “phar:///usr/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php” line 372 in invoke
28
File “phar:///usr/bin/wp/php/WP_CLI/Runner.php” line 312 in run_command
29
File “phar:///usr/bin/wp/php/WP_CLI/Runner.php” line 319 in _run_command
30
File “phar:///usr/bin/wp/php/WP_CLI/Runner.php” line 917 in start
31
File “phar:///usr/bin/wp/php/wp-cli.php” line 21 in include
32
File “phar:///usr/bin/wp/php/boot-phar.php” line 5 in include
– 1 non-project frame
33
File “/usr/bin/wp” line 4 in <main>Hi guys,
Thanks for the log excerpts on the error – that’s quite odd … I’m not sure where the boolean comes from when there should actually be an object (the user). I’ll need to investigate this further, would you mind listing the plugins you have installed and activated?
Regarding the warning related to Groups 404 Redirect, I’ve just released an update which fixes this. Thanks for pointing out the issue @lwcooper.
Cheers
VaultPress by Automattic – 1.8.8
Gravity Forms by rocketgenius – 2.1.3
Advanced Custom Fields PRO by Elliot Condon – 5.5.10
Gravity Forms Tooltips by Andrew Norcross – 2.0.3
Gravity Forms Logging Add-On by rocketgenius – 1.2.1
Gravity Forms MailChimp Add-On by rocketgenius – 4.1.8
Gravity Forms User Registration Add-On by rocketgenius – 3.7
Groups 404 Redirect by itthinx – 1.3.0
Groups Gravity Forms Integration by itthinx – 1.2.1
Groups by itthinx – 1.13.1
Jetpack by WordPress.com by Automattic – 4.7
MailChimp WebHooks by Chris Knowles – 1.0.0
PixelYourSite by PixelYourSite – 5.0.0
Postmark (Official) by Andrew Yates & Matt Gibbs – 1.9.3
Rollbar by flowdee – 1.0.3
Safe Redirect Manager by Taylor Lovett (10up) – 1.7.8
Simple Google Analytics Tracking by Dustyn Doyle – 1.2
Soil by Roots – 3.7.0
WooCommerce – Autocomplete Orders by Serious Plugins – 1.1.4
WooCommerce Customer/Order CSV Export by WooThemes / SkyVerge – 4.1.4
WooCommerce Direct Checkout by Terry Tsang – 1.1.2
WooCommerce EU VAT Compliance (Free) by David Anderson – 1.11.2
WooCommerce Stripe Gateway by WooCommerce – 3.0.7
WooCommerce Google Analytics Integration by WooThemes – 1.4.0
WooCommerce MailChimp by Saint Systems – 2.0.20
WooCommerce Smart Coupons by StoreApps – 3.2
WooCommerce by WooThemes – 2.6.14
WooCommerce Helper by WooCommerce – 1.7.2
Wordfence Security by Wordfence – 6.3.3
Zendesk Support for WordPress by Zendesk – 1.6.11I have also written some custom code which uses things like:
Groups_User_Group::delete( $user_id, $group->group_id );Just wanted to say, I have now updated to Groups v2, and this error has gone now.
It was running every 15 minutes on some kind of job, so I was getting the fatal error in my logs every 15 minutes exactly.
Many thanks for that @lwcooper
I’ve added a fix in Groups 2.0.3 to make sure that this kind of error doesn’t show up again. It seems that in come circumstances an invalid user ID ends up being passed to the constructor of the class involved – I couldn’t reproduce it using other plugins, but setting it manually did bring up the errors reported and the fix in the latest release takes care of it.
Again many thanks for your feedback @nigdowser and @lwcooper !
- The topic ‘PHP Fatal Error….’ is closed to new replies.