Skip to content

Conversation

bduranleau-nr
Copy link
Contributor

No description provided.

@newrelic-php-agent-bot
Copy link

newrelic-php-agent-bot commented Dec 11, 2024

Test Suite Status Result
Multiverse 0/7 passing
SOAK 60/62 passing

!= nr_php_error_record_exception(NRPRG(txn), exception, priority, true,
NULL,
&NRPRG(exception_filters) TSRMLS_CC)) {
nrl_verbosedebug(NRL_TXN, "Drupal: unable to record exception");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be higher priority than verbosedebug?

@codecov-commenter
Copy link

codecov-commenter commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 6.89655% with 27 lines in your changes missing coverage. Please review.

Project coverage is 78.60%. Comparing base (4393980) to head (82ec0d7).

Files with missing lines Patch % Lines
agent/fw_drupal8.c 6.89% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #995      +/-   ##
==========================================
- Coverage   78.68%   78.60%   -0.08%     
==========================================
  Files         196      196              
  Lines       27047    27076      +29     
==========================================
+ Hits        21281    21283       +2     
- Misses       5766     5793      +27     
Flag Coverage Δ
agent-for-php-7.2 78.61% <6.89%> (-0.08%) ⬇️
agent-for-php-7.3 78.63% <6.89%> (-0.08%) ⬇️
agent-for-php-7.4 78.33% <6.89%> (-0.08%) ⬇️
agent-for-php-8.0 78.35% <6.89%> (-0.08%) ⬇️
agent-for-php-8.1 78.34% <6.89%> (-0.08%) ⬇️
agent-for-php-8.2 77.93% <6.89%> (-0.08%) ⬇️
agent-for-php-8.3 77.93% <6.89%> (-0.08%) ⬇️

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.

@bduranleau-nr bduranleau-nr marked this pull request as ready for review December 12, 2024 23:06
/* Warning avoidance */
(void)wraprec;

NR_PHP_WRAPPER_REQUIRE_FRAMEWORK(NR_FW_DRUPAL8);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use a variation of the NR_PHP_WRAPPER_REQUIRE_FRAMEWORK macro (which doesnt yet exist) to make sure a compatible version of Drupal is present? This works with 9+ correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes exceptions for 8 and exceptions and errors for 9+. For Drupal 8 errors, this code has no impact (positive or negative) as the problem with error reporting originates from this block unique to pre-oapi instrumentation, and D8 is only compatible with PHP up to 7.4.


/*
* Get the exception from the event.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code seems to rely on nr_php_call() gracefully handling if these methods did not exist. Have you verified this is how it works?
I am also curious if these calls could return a valid zval that is not an exception object and perhaps it would be best to verify it is what we expect?
Or does nr_php_error_record_exception() handle this inspection and verification?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code seems to rely on nr_php_call() gracefully handling if these methods did not exist. Have you verified this is how it works?

I believe this is outside the scope of this PR. We use nr_php_call in this same manner throughout the agent, but for what it's worth, I do believe it handles the case that it does not exist gracefully.

I am also curious if these calls could return a valid zval that is not an exception object and perhaps it would be best to verify it is what we expect?

The very first call in nr_php_error_record_exception is to nr_php_error_zval_is_exception.

bduranleau-nr and others added 2 commits December 16, 2024 15:31
Co-authored-by: Michal Nowacki <[email protected]>
Co-authored-by: Michal Nowacki <[email protected]>
Copy link
Member

@lavarou lavarou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bduranleau-nr bduranleau-nr merged commit aae7611 into dev Dec 20, 2024
56 checks passed
@bduranleau-nr bduranleau-nr deleted the fix/drupal-error-handling branch December 20, 2024 18:51
@zsistla zsistla added this to the next-release milestone Dec 20, 2024
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.

6 participants