Trying to access array offset on value of type null in MerchantDetail.php
-
Sorry for the length of this message. I wanted to provide as much information as I could.
I’ve installed the GiveWP plugin v2.9.5 on the website for our community theatre company, which is running WordPress 5.6 hosted on HostGator. I’ve got it mostly working, but there are a couple things not working quite right, probably due to my installation or configuration. After getting PayPal Standard set up, Test mode disabled, and testing PayPal with a real donation, I attempted to delete all the test donations and got the following error message:
There has been a critical error on this website. Please check your site admin email inbox for instructions.
Unfortunately I didn’t get the email, so I dug in to debug it myself. I installed the WP Debugging plugin which displayed the following message immediately after enabling the plugin:
Notice: Trying to access array offset on value of type null in /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/PaymentGateways/PayPalCommerce/Models/MerchantDetail.php on line 156
Then I installed the Query Monitor plugin and with the stack trace found that it was reading the
give_paypal_commerce_live_account
key from thewp_options
table and then attempting to deference thetoken
property as an array. Using phpMyAdmin I was able to determine that the value of that property wasN
. Here’s the full value from the database:a:8:{s:10:"merchantId";N;s:18:"merchantIdInPayPal";N;s:8:"clientId";N;s:12:"clientSecret";N;s:5:"token";N;s:14:"accountIsReady";b:1;s:22:"supportsCustomPayments";N;s:14:"accountCountry";N;}
Next I activated the WP Debugging plugin and then attempted to delete my test donations. This produced the following output:
Notice: Array to string conversion in /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Framework/Database/Exceptions/DatabaseQueryException.php on line 70
Fatal error: Uncaught Give\Framework\Database\Exceptions\DatabaseQueryException: Query failed in database in /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Framework/Database/Exceptions/DatabaseQueryException.php:32 Stack trace: #0 /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Framework/Database/DB.php(79): Give\Framework\Database\Exceptions\DatabaseQueryException::create(Array) #1 /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Framework/Database/DB.php(49): Give\Framework\Database\DB::runQueryWithErrorChecking(Object(Closure)) #2 /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Revenue/Repositories/Revenue.php(62): Give\Framework\Database\DB::delete(‘wp_give_revenue’, Array, Array) #3 /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Revenue/Listeners/DeleteRevenueWhenDonationDeleted.php(39): Give\Revenue\Repositories\Revenue->deleteByDonationId(‘308’) #4 [internal fu in /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Framework/Database/Exceptions/DatabaseQueryException.php on line 32
Next I deactivated the WP Debugging plugin, activated the Query Monitor plugin, performed the delete operation, and the following was displayed:
Fatal error: Uncaught Exception: Query failed in database
in /home2/dpotter/public_html/sycamoretreetheatre.org/wp-content/plugins/give/src/Framework/Database/Exceptions/DatabaseQueryException.php on line 32Call stack:
Give\F\D\E\DatabaseQueryException::create()
wp-content/plugins/give/src/Framework/Database/DB.php:79
Give\F\D\DB::runQueryWithErrorChecking()
wp-content/plugins/give/src/Framework/Database/DB.php:49
Give\F\D\DB::delete()
wp-content/plugins/give/src/Revenue/Repositories/Revenue.php:62
Give\R\R\Revenue::deleteByDonationId()
wp-content/plugins/give/src/Revenue/Listeners/DeleteRevenueWhenDonationDeleted.php:39
Give\R\L\DeleteRevenueWhenDonationDeleted::__invoke()
call_user_func_array()
wp-content/plugins/give/src/Helpers/Hooks.php:37
Give\H\Hooks::Give\H\{closure}()
wp-includes/class-wp-hook.php:289
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:311
WP_Hook::do_action()
wp-includes/plugin.php:484
do_action()
wp-includes/post.php:3090
wp_delete_post()
wp-content/plugins/give/includes/payments/functions.php:365
give_delete_donation()
wp-content/plugins/give/includes/admin/payments/class-payments-table.php:811
Give_Payment_History_Table::process_bulk_action()
wp-content/plugins/give/includes/admin/payments/class-payments-table.php:145
Give_Payment_History_Table::__construct()
wp-content/plugins/give/includes/admin/payments/payments-history.php:31
give_payment_history_page()
wp-includes/class-wp-hook.php:287
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:311
WP_Hook::do_action()
wp-includes/plugin.php:484
do_action()
wp-admin/admin.php:259
require_once()
wp-admin/edit.php:10Not sure if this is related, so I’ll go ahead and mention it. I tried to get the PayPal Donations payment gateway to work after testing the PayPal Standard gateway since there are warnings about PayPal Standard. When I would attempt to make a donation, the UI would display a spinner forever. I haven’t spent time to debug that yet – one step at a time ??.
Thanks for any help you can give me.
DavidThe page I need help with: [log in to see the link]
- The topic ‘Trying to access array offset on value of type null in MerchantDetail.php’ is closed to new replies.