Answers.Body: <p>I highly recommend setting up an IDE with debugger so you can easily step through the code while it is executing. Yes it's a little bit of work to install and learn to use those tools, but <em>worth it!</em></p>
  
  <p>My IDE tells me that the $_params variable is an array declared in CRM_Contribute_Form_ContributionBase but mostly populated during CRM_Contribute_Form_Contribution_Confirm::preProcess().</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-14T09:26:21.340Z
Answers.Text: Thanks, Coleman. I'm using Netbeans+XDebug. You say "my IDE tells me". Which IDE are you using and where does it tell you that?
Answers.UserDisplayName: Borislav Zlatanov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-15T00:07:04.957Z
Answers.Text: I use PHPStorm + XDebug. Not an endorsement, but it works for me. I could have put in breakpoints and stepped backwards through function calls to see the variable being populated, but in this case all I did was highlight the variable and I could see in the code that the preProcess function writes to it a lot.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-14T01:06:23.683Z
Answers.LastActivityDate: 2015-09-14T01:06:23.683Z
Answers.UserDisplayName: Coleman
Body: <p>I'm trying to debug a contribution page and I see that one of the contribution parameters is not set properly. I would like to see where exactly this parameter is being set so I can understand why it is not getting the proper value.</p>
  
  <p>I've been looking inside the CRM_Contribute_Form_ContributionBase class and trying to figure out where its $_params variable is being set. But I have had no success.</p>
  
  <p>What I've done so far (note: I'm referring to the code for 4.6.8):<br>
  1) Determined that one of the parameters in my payment processor (Stripe) is not being correctly set, and this is the cause of the error that I am getting ("Stripe.js token was not passed! Report this message to the site administrator.").<br>
  2) Saw that the contribution parameters are being passed to my payment proc.<br>
  3) Therefore, go one level up. The class CRM_Contribute_BAO_Contribution_Utils is calling the doDirectPayment() method of my payment proc. And it is passing the parameters. This calling happens in the processConfirm() method. But the processConfirm() method is itself passed the contribution params.<br>
  4) So, one level up. Now we find ourselves in CRM_Contribute_Form_Contribution_Confirm->postProcess(). So where does this postProcess() method get the contribution params from? It gets them from $this->_params (line 1037). But the CRM_Contribute_Form_Contribution_Confirm class does not have such a field. Then let's go to its parent.<br>
  5) The parent is CRM_Contribute_Form_ContributionBase. It has a $_params field. But I have not been able to ascertain where that field is set. I only saw that later on some parameters are added, however the params that I'm interested in were already set.</p>
  
  <p>P.S. If someone has any tips or resources on how to more efficiently debug situations like these, please let me know. Finding out the above took me hours. I found it quite difficult to follow these parameters that are being passed around mountains of code, and most of all I could not get to the source (i.e. where they are first being set).</p>
  
Tags: <payment-processor><recurring-contributions>
Title: Where is the $_params field of the CRM_Contribute_Form_ContributionBase class set?
ThreadText: # Where is the $_params field of the CRM_Contribute_Form_ContributionBase class set?
  
  (Asked by: username_0 on 2015-09-11)
  
  I'm trying to debug a contribution page and I see that one of the contribution parameters is not set properly. I would like to see where exactly this parameter is being set so I can understand why it is not getting the proper value.
  
  I've been looking inside the CRM\_Contribute\_Form\_ContributionBase class and trying to figure out where its $\_params variable is being set. But I have had no success.
  
  What I've done so far (note: I'm referring to the code for 4.6.8):  
  1) Determined that one of the parameters in my payment processor (Stripe) is not being correctly set, and this is the cause of the error that I am getting ("Stripe.js token was not passed! Report this message to the site administrator.").  
  2) Saw that the contribution parameters are being passed to my payment proc.  
  3) Therefore, go one level up. The class CRM\_Contribute\_BAO\_Contribution\_Utils is calling the doDirectPayment() method of my payment proc. And it is passing the parameters. This calling happens in the processConfirm() method. But the processConfirm() method is itself passed the contribution params.  
  4) So, one level up. Now we find ourselves in CRM\_Contribute\_Form\_Contribution\_Confirm->postProcess(). So where does this postProcess() method get the contribution params from? It gets them from $this->\_params (line 1037). But the CRM\_Contribute\_Form\_Contribution\_Confirm class does not have such a field. Then let's go to its parent.  
  5) The parent is CRM\_Contribute\_Form\_ContributionBase. It has a $\_params field. But I have not been able to ascertain where that field is set. I only saw that later on some parameters are added, however the params that I'm interested in were already set.
  
  P.S. If someone has any tips or resources on how to more efficiently debug situations like these, please let me know. Finding out the above took me hours. I found it quite difficult to follow these parameters that are being passed around mountains of code, and most of all I could not get to the source (i.e. where they are first being set).
  
  **Tags:** payment-processor, recurring-contributions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-14. Score: 1 | Accepted answer
  
  I highly recommend setting up an IDE with debugger so you can easily step through the code while it is executing. Yes it's a little bit of work to install and learn to use those tools, but *worth it!*
  
  My IDE tells me that the $\_params variable is an array declared in CRM\_Contribute\_Form\_ContributionBase but mostly populated during CRM\_Contribute\_Form\_Contribution\_Confirm::preProcess().
  
  > **Comments:**
  > **username_0**: Thanks, username_1. I'm using Netbeans+XDebug. You say "my IDE tells me". Which IDE are you using and where does it tell you that?  
  > **username_1**: I use PHPStorm + XDebug. Not an endorsement, but it works for me. I could have put in breakpoints and stepped backwards through function calls to see the variable being populated, but in this case all I did was highlight the variable and I could see in the code that the preProcess function writes to it a lot.  
  
  ---
  
  