Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Sep 19, 2024

Conversation

mfulb
Copy link
Contributor

@mfulb mfulb commented Sep 9, 2024

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
Copy link

newrelic-php-agent-bot commented Sep 9, 2024

Test Suite Status Result
Multiverse 7/7 passing
SOAK 56/56 passing

@mfulb mfulb marked this pull request as ready for review September 10, 2024 16:41
PHP 8+ only pass 4 parameters instead of 5 to a handler configured with
set_error_handler().  Since newrelic_notice_error() can be used as an
error handler it needs to accept this form as well.
It is now valid to pass 4 arguments to newrelic_notice_error() so
it was necessary to modify the test case.
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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 Coverage Δ
agent-for-php-7.2 78.36% <100.00%> (+0.03%) ⬆️
agent-for-php-7.3 78.38% <100.00%> (+0.02%) ⬆️
agent-for-php-7.4 78.09% <100.00%> (+0.02%) ⬆️
agent-for-php-8.0 78.11% <100.00%> (+0.02%) ⬆️
agent-for-php-8.1 78.09% <100.00%> (+0.02%) ⬆️
agent-for-php-8.2 77.69% <100.00%> (+0.02%) ⬆️
agent-for-php-8.3 77.69% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lavarou lavarou added this to the next-release milestone Sep 13, 2024
@mfulb mfulb requested a review from hahuja2 September 16, 2024 17:29
hahuja2
hahuja2 previously approved these changes Sep 17, 2024
bduranleau-nr
bduranleau-nr previously approved these changes Sep 18, 2024
bduranleau-nr
bduranleau-nr previously approved these changes Sep 18, 2024
@hahuja2 hahuja2 self-requested a review September 18, 2024 18:54
hahuja2
hahuja2 previously approved these changes Sep 18, 2024
@mfulb mfulb dismissed stale reviews from hahuja2 and bduranleau-nr via f8a208b September 18, 2024 19:06
@mfulb mfulb requested a review from hahuja2 September 18, 2024 19:07
@mfulb mfulb merged commit 8de09b0 into dev Sep 19, 2024
57 checks passed
@mfulb mfulb deleted the fix/notice-error-api-php8 branch September 19, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants