newrelic / newrelic-php-agent

The New Relic PHP Agent
https://opensource.newrelic.com/projects/newrelic/newrelic-php-agent
Apache License 2.0
120 stars 63 forks source link

fix(agent): Fixes newrelic_notice_error() API for PHP 8+ #960

Closed mfulb closed 2 months ago

mfulb commented 2 months ago

Starting with PHP 8.0 the set_error_handler() callback function signature drops the $errcontext final parameter so it only contains 4 parameters. This caused using newrelic_notice_error() as a callback handler for PHP 8+ to not work as the API call did not accept only 4 arguments. This PR adds support for this function signature. There are also numerous tests added that will hopefully caught this kind of issue in the future.

newrelic-php-agent-bot commented 2 months ago
Test Suite Status Result
Multiverse :white_check_mark: 7/7 passing
SOAK :white_check_mark: 56/56 passing
codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.35%. Comparing base (393ca93) to head (f8a208b).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #960 +/- ## ========================================== + Coverage 78.32% 78.35% +0.02% ========================================== Files 194 194 Lines 26880 26879 -1 ========================================== + Hits 21055 21061 +6 + Misses 5825 5818 -7 ``` | [Flag](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | Coverage Δ | | |---|---|---| | [agent-for-php-7.2](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.36% <100.00%> (+0.03%)` | :arrow_up: | | [agent-for-php-7.3](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.38% <100.00%> (+0.02%)` | :arrow_up: | | [agent-for-php-7.4](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.09% <100.00%> (+0.02%)` | :arrow_up: | | [agent-for-php-8.0](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.11% <100.00%> (+0.02%)` | :arrow_up: | | [agent-for-php-8.1](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.09% <100.00%> (+0.02%)` | :arrow_up: | | [agent-for-php-8.2](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.69% <100.00%> (+0.02%)` | :arrow_up: | | [agent-for-php-8.3](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/960/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.69% <100.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.