• fiskhandlarn

    (@fiskhandlarn)


    When developing locally I would like to use PHP’s native error handler instead of Bugsnag’s, but still have the same code base/database for my local and live server (and not being forced to manually deactivate the plugin for different servers).

    ATM it’s impossible to override with the bugsnag_set_error_and_exception_handlers filter from within functions.php (since it’s applied directly when the plugin loads (which is before the theme)). Would it be possible to run constructBugsnag() in the init hook or similar, and not directly when the plugin is loaded? That way I could disable bugsnag’s error handlers depending on my debug environment variable from within the theme’s function.php.

    I also tried running restore_error_handler();, but that results in this warning:

    
    strpos(): Empty needle in plugins\bugsnag\bugsnag-php\Error.php on line 386
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fiskhandlarn

    (@fiskhandlarn)

    FYI, when I rewrite bugsnag.php with this as the first line in the constructor:

    
            add_action('init', array($this, 'activateBugsnag'));
    

    and change activateBugsnag() to public, the error handlers are indeed disabled, but I get the same warning as above:

    
    Warning: strpos(): Empty needle in plugins\bugsnag\bugsnag-php\Error.php on line 386
    
    Thread Starter fiskhandlarn

    (@fiskhandlarn)

    Opened an issue on github instead: https://github.com/bugsnag/bugsnag-wordpress/issues/27

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Make it possible to disable plugin from theme?’ is closed to new replies.