Conditional use of the PayPal Checkout Add-On Causes Fatal Error

Greetings,

Be advised: I created a video which shows the issue. You can access it from my screencast account here.

The Issue

I am using the PayPal Checkout Add-On for donations. I have created and tested two different forms with a conditional field which states "Make this donation Monthly". The first form uses a checkbox, which causes a fatal error unless a highly non-intuitive approach is used. The second form is slightly more intuitive, and uses radio buttons but also flat out fails.

Be advised: I have conditional PayPal feeds, based on the “Make this donation Monthly” option for BOTH forms (Checkbox and Radio Buttons)

The causes of the failures are as follows: once the use enters an amount, the paypal field is displayed. However, IF -in the case of the the checkbox form- the user THEN checks "Make this donation Monthly" and so triggers the Subscription PayPal feed, the process ends with a Fatal Error.

If -in the case of the the radio button form- the user THEN selects "YES" for "Make this donation Monthly", and so triggers the Subscription PayPal feed, the process also ends with a Fatal Error.

Any Ideas? Thanks,
Preston

p.s. I also submitted this to support in case this is a bug.

What is the 500 Internal Server Error that is being logged (either in the web server error log, PHP error log, WP_DEBUG debug.log or in the email with the stack trace that WordPress will send to the website admin email address)?

Based on the video, here is the error message where I used the checkbox form.

[11-Oct-2021 19:20:03 UTC] PHP Warning:  in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
[11-Oct-2021 19:20:14 UTC] PHP Warning:  in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
[11-Oct-2021 19:20:35 UTC] PHP Notice:  Undefined variable: subscriptions_model in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 19:20:35 UTC] PHP Fatal error:  Uncaught Error: Call to a member function load() on null in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php:138
Stack trace:
#0 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php(110): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->create_subscription(Array, Array, Array, Array)
#1 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php(3513): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->initialize_subscription(Array, Array, Array, Array)
#2 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-payment-addon.php(638): GF_PPCP->subscribe(Array, Array, Array, Array)
#3 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-p in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 19:20:56 UTC] PHP Warning:  in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379

Thank you for that. Checking the system report in your support ticket, you are using the PayPal Checkout version 2.0.3. The latest available is 2.2. Can you please try updating to that release and see if the issue persists?

Didn’t know that. Will do and report back.

well, I would LOVE to update, but after checking updates, it’s not giving me the option to update. So how to facilitate the update?

You can download it from your downloads page:
https://www.gravityforms.com/my-account/downloads/

And upload and install like any other plugin from your Plugins screen:

OK, it appears I had to completely delete the add-on. Then reinstall it, wherein I got the update. Testing again.

Using Version 2.2: Same scenario, same results.

[11-Oct-2021 20:09:14 UTC] PHP Notice:  Undefined variable: subscriptions_model in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 20:09:14 UTC] PHP Fatal error:  Uncaught Error: Call to a member function load() on null in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php:138
Stack trace:
#0 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php(110): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->create_subscription(Array, Array, Array, Array)
#1 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php(3547): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->initialize_subscription(Array, Array, Array, Array)
#2 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-payment-addon.php(638): GF_PPCP->subscribe(Array, Array, Array, Array)
#3 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-p in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138

Thank you for updating. We’ll leave the rest to the support ticket. I updated it with these notes. Thank you.

Okie-Dokie! Thanks for trying. I will report back any results from support.

1 Like

Update: I received a message wherein support was initially unable to recreate the error. So I created another video wherein I successfully recreated the error, using Gravity Forms own demo site. Mainly, because this way I could eliminate any issues around my PC, Server, etc. Not using any of that.

Thanks Preston. I still have your ticket and we’re looking at it today.

© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.