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

Notice: Undefined index & variable with each recurring contribution #412

Open
IowaBoy1 opened this issue Mar 4, 2023 · 6 comments
Open

Comments

@IowaBoy1
Copy link

IowaBoy1 commented Mar 4, 2023

Drupal 7.94
Civi 5.58.0
iATSPayments 1.7.4

I am not sure if this is anything to be concerned about:

With each recurring contribution when the daily recurring cron runs, it send this set of php notices:
Notice: Undefined index: source in civicrm_api3_job_iatsverify() (line 186 of /sites/default/files/civicrm/extensions/com.iatspayments.civicrm/api/v3/Job/Iatsverify.php).
Notice: Undefined variable: CRM16923AnUnreliableMethodHasBeenUserToDeterminePaymentProcessorFromContributionPage in CRM_Contribute_BAO_Contribution->composeMessageArray() (line 2480 of /sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php).
Notice: Undefined index: 3 5 16 1 in CRM_Financial_BAO_PaymentProcessor::getPayment() (line 222 of /sites/all/modules/civicrm/CRM/Financial/BAO/PaymentProcessor.php).

@adixon
Copy link
Contributor

adixon commented Mar 6, 2023

Thanks for the report.

In general a php "Notice" doesn't interfere with normal site stuff, but it can be an indication of code not doing the right thing.

In the first case, it does raise a red flag, since I'd assume that source is always defined - so some kind of interesting change is in there that may or may not be worth addressing.

I'll take a look at them ...

@adixon
Copy link
Contributor

adixon commented Mar 7, 2023

@demeritcowboy noticed that the api no longer returns the contribution source field as 'source', but as 'contribution_source', so I've updated the code where this gets used.

@adixon
Copy link
Contributor

adixon commented Mar 8, 2023

As far as the other two notices ... I've been unable to reproduce them on my test install. They're not critical, and it appears that they're a result of some kind of side effect from a civicrm core internal - i.e. the job itself isn't trying to determine a payment processor from a contribution page. It'd be great if you're able to get a full stack trace and we could see why it's trying to do that (I'd assume it's part of the repeattransaction api which tends to be a bit complicated because it's trying to handle a lot of different cases).

@IowaBoy1
Copy link
Author

I am not sure what I need to do to get you a full stack trace. Point me in the right direction (link to a how to) and I will get on it. Thanks

@adixon
Copy link
Contributor

adixon commented Mar 10, 2023

Well, if you're brave then you can add the below code to your extension at the point where you want to report the stack. It'll print out a simplified stack trace to your civicrm error log (which you can access using my log viewer extension if you don't already have it installed). I'd recommend you add it just before where those notices were triggered, possibly with an if so that it only triggers when the notice is likely to be triggered.
e.g. just before line 2480 of /sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php

$stack = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), TRUE);
CRM_Core_Error::debug_var('stack', $stack);

@IowaBoy1
Copy link
Author

I put that stack trace in at line 2480.
I just realized today that these messages are not showing anywhere on my Drupal logs or Civi Logs. These are coming from an email sent by our host provider. I asked them where they are getting them since I do not see them in the other two places, but they have not responded yet.

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

No branches or pull requests

2 participants