bugsnag / bugsnag-php

BugSnag error monitoring and crash reporting tool for PHP apps
https://docs.bugsnag.com/platforms/php
MIT License
554 stars 77 forks source link

New Relic PHP extension causes duplicate errors in BugSnag #660

Closed benzeghers-bold closed 1 year ago

benzeghers-bold commented 1 year ago

Describe the bug

The New Relic PHP extension registers an exception handler before BugSnag. Bugsnag-php calls the previous exception handler but since it does not rethrow the exception, $enableShutdownHandler is not set to false. This causes duplicate errors in BugSnag, one from the exception handler and one from the shutdown handler.

Environment

bugsnag-php version: v3.29.0 PHP version: 8.1 New Relic daemon version: 10.0.0.312-9fd43b56a296

Steps to reproduce

  1. Install New Relic PHP agent: https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-overview/
  2. Run the following PHP script:
    
    <?php

$bugsnag = Bugsnag\Client::make(); Bugsnag\Handler::register($bugsnag);

throw new Exception('Uncaught Exception');


3. The exception thrown will show up in BugSnag twice:
![image](https://user-images.githubusercontent.com/98761454/234120720-8de3bdb1-e20d-4af7-b833-3449afe2ed02.png)
johnkiely1 commented 1 year ago

Hi @benzeghers-bold, if the New Relic code does not rethrow the exception it sounds like a bug in that code, error monitoring/performance monitoring software should rethrow any exceptions that are captured. Have you raised this with New Relic? If not I would suggest raising this with their support team to get their take on it.

johnkiely1 commented 1 year ago

Closing this out, as we haven't heard back from you. Happy to reopen as necessary.