Support » Plugin: WordPress Native PHP Sessions » Call to a member function get_row() on null

  • Resolved subair.tc

    (@subairtc)


    hi,
    I got an error Call to a member function get_row() on null in newrelic report on when using this plugin,
    Can you please help to resolve this issue.

     E_ERROR: Call to a member function get_row() on null
    Sample stack trace
    …w.fapvoice.com/wp-content/plugins/wp-native-php-sessions/inc/
    class-session.php (23)
    …x/www/www.fapvoice.com/wp-content/plugins/wp-native-php-sessions/
    callbacks.php (100)
    in _pantheon_session_write called at ? (?)
    
    
    • This topic was modified 5 years, 3 months ago by subair.tc.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    I got an error Call to a member function get_row() on null in newrelic report on when using this plugin,

    Related: pantheon-systems/wp-native-php-sessions#49

    Could you share as much detail as you can from the New Relic report? The stack trace implies _pantheon_session_write() is being called before $wpdb is initialized, but I’m unsure as to how this could be the case if all plugins are loaded after the database is initialized.

    A few more questions that might be able to help:

    * How have you installed the WP Native PHP Sessions? As a normal plugin, mu-plugin, or some other way?
    * What code on the site depends on sessions? When is it starting the session?

    Thanks

    Thread Starter subair.tc

    (@subairtc)

    hi @danielbachhuber,
    Thank you for you quick reply,

    We are using the newrelic.com application for performance analysis of the website.

    Answer for your Questions.
    * Currently we are using as normal plugin and we are plan to make it as mu-plugin.
    * We are using session for ‘remeber-me’ option on website registration. we have some custom behavior for remember-me feature.

    Thanks.

    Thread Starter subair.tc

    (@subairtc)

    Hi,
    Any luck to solve this issue ?

    Thanks
    Subair

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Not yet!

    I haven’t been able to reproduce the issue, so I’m not sure of the root cause at the moment. If you’d like to help out with some debugging, it would be valuable if you could track down how to reliably reproduce the issue, and share those steps here.

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    I’ve been able to reproduce this issue. The fix is in v0.6.0.

    Thread Starter subair.tc

    (@subairtc)

    We have updated the plugin into latest version 0.6.0, but we still got the same error in newrelic report

    E_ERROR: Call to a member function get_row() on null 
    wp-content/plugins/wp-native-php-sessions/inc/
    class-session.php (23)
    wp-content/plugins/wp-native-php-sessions/
    callbacks.php (94)
    

    Please help us to fix this issue.
    Thanks

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    @subairtc Can you provide steps to reproduce this issue?

    Thread Starter subair.tc

    (@subairtc)

    Hi,
    Thank you for the quick response.
    Please see the Stack trace we get from New Relic.Hope this will help you to troubleshoot the issue.

    E_ERROR: Call to a member function get_row() on null
    in Pantheon_Sessions\Session::get_by_sid called at /wp-content/plugins/wp-native-php-sessions/inc/class-session.php (23)
    in Pantheon_Sessions\Session::get_by_sid called at /wp-content/plugins/wp-native-php-sessions/callbacks.php (94)
    in _pantheon_session_write called at ? (?)
    
    Thread Starter subair.tc

    (@subairtc)

    hi @danielbachhuber
    Any update on this ?

    Thread Starter subair.tc

    (@subairtc)

    hi @danielbachhuber ,

    i got a answer from the link

    It is a wordpress feature, so the global $wpdb can be called only if it has been defined previously.
    
    This means, inside the /wp-content/... folder if you use a script with wp specific features it won't work until it is compiled with wordpress core.
    
    So, for example, a theme template or plugin files can work just by calling $wpdb, but your standalone script won't, even if it is inside the plugin or theme directory.
    
    Simple solution is to include /wp-config.php file before running that script. Just write:
    
    include_once($_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-config.php' );
    
    before calling $wpdb. It works for me.
    

    is this is the issue ? Please help me

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Call to a member function get_row() on null’ is closed to new replies.