• Resolved Sii Cockerill

    (@designtwelve)


    There’s a PHP Error message:

    E_ERROR: Call to undefined function wp_get_current_user()

    Stack trace:
    in current_user_can called at /…./wp-includes/capabilities.php (1387)
    …/plugins/wp-simple-firewall/icwp-plugin-controller.php (843)
    …/…
    … in ICWP_WPSF_FeatureHandler_Base_V3::action_doFeautureShutdown

    https://wordpress.org/plugins/wp-simple-firewall/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Paul

    (@paultgoodchild)

    when and where does this occur, and can you provide the full stack trace?

    Thread Starter Sii Cockerill

    (@designtwelve)

    Hi Paul,

    I can’t be exactly sure – the error is being reported via New Relic on my client’s server.

    I’ll install your plugin locally, allow errors and see what more I can find out for you.

    Plugin Author Paul

    (@paultgoodchild)

    Cool… the more stuff you can share on this, the better. This isn’t being reported anywhere else, but I can probably solve it with some checks for the function anyway.

    Thread Starter Sii Cockerill

    (@designtwelve)

    Hi Paul,

    Here’s the full stack trace.

    Error message
    E_ERROR: Call to undefined function wp_get_current_user()
    Sample stack trace
    in current_user_can called at /var/www/website/blog/wp-includes/capabilities.php (1387)
    …w/website/blog/wp-content/plugins/wp-simple-firewall/icwp-plugin-controller.php (843)
    …website/blog/wp-content/plugins/wp-simple-firewall/src/features/login_protect.php (54)
    …ar/www/website/blog/wp-content/plugins/wp-simple-firewall/src/features/base.php (534)
    …ar/www/website/blog/wp-content/plugins/wp-simple-firewall/src/features/base.php (232)
    in ICWP_WPSF_FeatureHandler_Base_V3::action_doFeatureShutdown called at ? (?)
    in call_user_func_array called at /var/www/website/blog/wp-includes/plugin.php (496)
    …w/website/blog/wp-content/plugins/wp-simple-firewall/icwp-plugin-controller.php (623)
    in ICWP_WPSF_Plugin_Controller::onWpShutdown called at ? (?)
    in call_user_func_array called at /var/www/website/blog/wp-includes/plugin.php (496)
    in do_action called at /var/www/website/blog/wp-includes/load.php (613)
    in shutdown_action_hook called at ? (?)

    Plugin Author Paul

    (@paultgoodchild)

    How often does this error occur? Is it every page load? Do you know the page that’s been loading when it happens?

    Thread Starter Sii Cockerill

    (@designtwelve)

    The logs show the same error on these pages:

    index.php
    /blog/wp-comments-post.php
    /blog/wp-login.php
    /blog/xml-rpc.php
    /blog/wp-admin/profile.php
    /blog/wp-admin/admin-ajax.php
    /blog/wp-admin/index.php
    /blog/index.php

    Index is getting the most hits, but it seems that it is every page load.

    Plugin Author Paul

    (@paultgoodchild)

    This error is very strange:

    – wp_get_current_user() is defined in pluggable.php
    – pluggable.php is included in wp-settings.php right after plugins are loaded.
    – that means, for pluggable.php to not be loaded, something serious has gone wrong, since it’s core to the WordPress page load.
    – This means our plugin has been loaded and then the PHP process is being shutdown before the pluggable.php file is processed.
    – The error is occuring on PHP shutdown i.e. there’s a wp_die() or die() being called.
    – This points to one of your other plugins shutting down the PHP process before pluggable.php gets included.

    Can you try deactivating your plugins, one at a time, to find out which one is shutting it down early?

    Plugin Author Paul

    (@paultgoodchild)

    It can’t be every page load because then your site would never be loading – since it’s shutting down even before plugins are loaded.

    Thread Starter Sii Cockerill

    (@designtwelve)

    Thanks Paul,

    There’s a plugin called User Role Editor that allows management of user capabilities.
    From the look of the error, that could be culpable… difficult to switch that off on the live site though.

    Plugin Author Paul

    (@paultgoodchild)

    Worth pointing the author to this forum post. There’s not a lot that I can do on my plugin to cater for that error because the error is happening so early on.

    They need to better utilize hooks if they’re going to kill the process. This ensures that, at the very least, pluggable.php have been loaded. If they put in their die() within “plugins_loaded”, that would solve the issue since by then, pluggable has been loaded.

    Thread Starter Sii Cockerill

    (@designtwelve)

    Thanks Paul,

    First thing I’ll do is try and prove that User Role Editor is the culprit.

    Plugin Author Paul

    (@paultgoodchild)

    Cool, that’s the first step – find the cause of the shutdown.

    Plugin Author Paul

    (@paultgoodchild)

    Any luck with this?

    Thread Starter Sii Cockerill

    (@designtwelve)

    Hi Paul,

    Unfortunately not – the errors continued even with User Role Editor disabled.
    I’ve tested the site locally and see no errors in the log when I browse the normal site pages.

    In the live server logs, there are fatal errors throw several times per minute, but none of them say which script caused the error to be thrown. They occasionally list a referrer, but if I try those URLs myself, no PHP error is thrown.

    It’s quite odd. I’m wondering if it’s bot activity… but even then, that doesn’t help use figure out what’s causing it.

    I need to be able to see the errors being generated on my local or staging server, in order to then disable the plugins one by one to find the problem.

    Do you have any ideas how to explore the error logs further to work out what produces the error?

    Thread Starter Sii Cockerill

    (@designtwelve)

    I’ve tailed the live error log and access log simultaneously and reviewed the URLs that seem to cause the errors.

    Visiting those URLs doesn’t replicate the issue, so I’m pretty much at a loss.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Call to undefined function wp_get_current_user()’ is closed to new replies.