impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
340 stars 191 forks source link

WP_DEBUG Warning :: Invalid argument supplied for foreach() in... #465

Closed lots0logs closed 7 years ago

lots0logs commented 8 years ago

I'll try to take a closer look at this and submit a PR soon. In the meantime here is the log output:

[21-Jan-2016 03:09:07 UTC] PHP Warning:  Invalid argument supplied for foreach() in /srv/antergos.com/wp-content/plugins/give/includes/forms/template.php on line 112
[21-Jan-2016 03:09:07 UTC] PHP Warning:  Invalid argument supplied for foreach() in /srv/antergos.com/wp-content/plugins/give/includes/price-functions.php on line 74
[21-Jan-2016 03:09:07 UTC] PHP Warning:  Invalid argument supplied for foreach() in /srv/antergos.com/wp-content/plugins/give/includes/forms/template.php on line 326
[21-Jan-2016 03:09:07 UTC] PHP Warning:  Invalid argument supplied for foreach() in /srv/antergos.com/wp-content/plugins/give/includes/price-functions.php on line 74

Cheers!

mathetos commented 8 years ago

Can you go to "Donations > Settings" and the System Info tab and provide that information here?

mathetos commented 8 years ago

Also, is this with the latest Master branch, or what's live on the Plugin Directory?

lots0logs commented 8 years ago

This is with the latest release from wordpress.org. I'll update to the latest master and let you know if it is still an issue. Cheers!

### Begin System Info ###

-- Site Info

Site URL:                 https://antergos.com
Home URL:                 https://antergos.com
Multisite:                Yes

-- Hosting Provider

Host:                     DBH: localhost, SRV: antergos.com

-- User Browser

Platform:                 Linux 
Browser Name:             Chrome  
Browser Version:          47.0.2526.111 
User Agent String:        Mozilla/5.0 (X11; Linux x86_64)  
              AppleWebKit/537.36 (KHTML, like 
                          Gecko) Chrome/47.0.2526.111 Safa
                          ri/537.36

-- WordPress Configuration

Version:                  4.4.1
Language:                 en_US
Permalink Structure:      /blog/%postname%/
Active Theme:             Divi-Antergos 
Show On Front:            page
Page On Front:            Home (#44)
Page For Posts:           Unset
Remote Post:              wp_remote_post() works
Table Prefix:             Length: 4   Status: Acceptable
Admin AJAX:               Accessible
WP_DEBUG:                 Enabled
Memory Limit:             128M
Registered Post Stati:    publish, future, draft, pending, private, trash, auto-draft, inherit, refunded, failed, revoked, abandoned, preapproval, cancelled

-- Give Configuration

Version:                  1.3.5
Upgraded From:            1.3.1.1
Test Mode:                Disabled
Currency Code:            USD
Currency Position:        before
Decimal Separator:        .
Thousands Separator:      ,

-- Give Page Configuration

Success Page:             https://antergos.com/donation-confirmation/
Failure Page:             https://antergos.com/transaction-failed/
Give Forms Slug:           /donations

-- Give Gateway Configuration

Enabled Gateways:         PayPal Standard, Stripe
Default Gateway:          Stripe

-- Must-Use Plugins

-- WordPress Active Plugins

Akismet: 3.1.7
Download Monitor: 1.9.1
Force Regenerate Thumbnails: 2.0.5
Give - Donation Plugin: 1.3.5
Give - PayPal Pro Gateway: 1.0.1
Give - PDF Receipts: 2.0
Give - Stripe Payment Gateway: 1.3.0.53
JSON API: 1.1.1
Redis Object Cache: 1.2.1
Stripe Donation for WordPress: 1.0
Super RSS Reader: 2.5

-- WordPress Inactive Plugins

Advanced Code Editor: 2.2.6
Antergos Dashboard Widgets: 1.0
AP HoneyPot: 1.4
Elegant Themes Divi Beta Tester: 1.0
Elegant Themes Updater: 1.2
Enlighter - Customizable Syntax Highlighter: 2.11
Frontend Publishing Pro: 2.82
Give - Form Field Manager: 1.1
Heartbeat Control: 1.0.3
Join My Multisite: 1.7.8
Mailgun: 1.4
MG POST Contributors: 1.3.
Monarch Plugin: 1.2.6
Multi Currency PayPal Donations: 2.2.2
Multisite Admin bar Switcher: 1.2.3
Multi Site Plugins Add New: 1.1
P3 (Plugin Performance Profiler): 1.5.3.9
Register IPs: 1.6.1
Revisr: 2.0.2
Simple Category Icons: 1.12
Table of Contents Plus: 1509
Top 10: 2.2.4
Transifex Live Translation Plugin: 1.1.0
Transposh Translation Filter: 0.9.8.1
Ultimate Member: 1.3.36
Ultimate Member - Google reCAPTCHA: 1.0.0
User Role Editor: 4.22
Wordpress Auth0 Integration: 1.3.6
WordPress Importer: 0.6.1
WordPress Zero Spam: 2.0.2
WP REST API: 2.0-beta10
WP Rocket: 2.6.15
Yoast SEO: 3.0.7

-- Network Active Plugins

Advanced Code Editor: 2.2.6
Akismet: 3.1.7
AP HoneyPot: 1.4
Wordpress Auth0 Integration: 1.3.6
Elegant Themes Divi Beta Tester: 1.0
Elegant Themes Updater: 1.2
Enlighter - Customizable Syntax Highlighter: 2.11
Heartbeat Control: 1.0.3
Join My Multisite: 1.7.8
Mailgun: 1.4
Monarch Plugin: 1.2.6
Multi Site Plugins Add New: 1.1
Multisite Admin bar Switcher: 1.2.3
Redis Object Cache: 1.2.1
Register IPs: 1.6.1
Revisr: 2.0.2
Ultimate Member: 1.3.36
Ultimate Member - Google reCAPTCHA: 1.0.0
User Role Editor: 4.22
Yoast SEO: 3.0.7
WP Rocket: 2.6.15
WordPress Zero Spam: 2.0.2

-- Webserver Configuration

PHP Version:              7.0.2
MySQL Version:            5.5.5
Webserver Info:           nginx/1.8.0

-- PHP Configuration

Safe Mode:                Disabled
Memory Limit:             512M
Upload Max Size:          60M
Post Max Size:            40M
Upload Max Filesize:      60M
Time Limit:               300
Max Input Vars:           1000
Display Errors:           N/A

-- PHP Extensions

cURL:                     Supported
cURL Version:             7.46.0
fsockopen:                Supported
SOAP Client:              Installed
Suhosin:                  Not Installed

-- Session Configuration

Give Use Sessions:        Enabled
Session:                  Enabled
Session Name:             PHPSESSID
Cookie Path:              /
Save Path:                
Use Cookies:              On
Use Only Cookies:         On

### End System Info ###
DevinWalker commented 8 years ago

@lots0logs I just looked into this and it appears all the warnings shown have to do with looping through prices. I'm guessing somehow the prices of your forms caused an issue? Can you let me know how to reproduce this? Did your forms have prices or none like this:

2-10-2016 10-40-10 pm

DevinWalker commented 8 years ago

Bumping off 1.3.6 milestone until further investigation

lots0logs commented 8 years ago

@DevinWalker Hmm..I don't have any prices set. I chose the Multi-Level and Custom Amount options. I don't see the "Add Level" button that is shown in your screenshot?

DevinWalker commented 8 years ago

@lots0logs can you send me a screenshot of what you see as well as a console view of Chrome Developer tools? It seems there may be a conflict present

lots0logs commented 8 years ago

You know what I just realized, I didn't install the forms add-on. I have it, and I thought I installed it but I was wrong :sweat_smile:

DevinWalker commented 8 years ago

OK, no problem. LMk if you see anything come up again.

lots0logs commented 8 years ago

Hi @DevinWalker , I'm starting to see this error again in my logs. I never did install the forms add-on as we don't really need custom forms at the moment. Here is the latest stacktrace from Bugsnag:

PHP Warning Invalid argument supplied for foreach() 
    wp-content/plugins/give/includes/payments/functions.php:1751 give_get_price_id
    wp-content/plugins/give/includes/payments/functions.php:134 give_insert_payment
    wp-content/plugins/Give-Stripe-master/includes/give-stripe-processing.php:174 give_stripe_process_stripe_payment
    wp-includes/plugin.php:525 do_action
    wp-content/plugins/give/includes/gateways/functions.php:226 give_send_to_gateway
    wp-content/plugins/give/includes/process-purchase.php:125 give_process_purchase_form
    wp-includes/plugin.php:525 do_action
    wp-content/plugins/give/includes/actions.php:43 give_post_actions
    wp-includes/plugin.php:525 do_action
    wp-settings.php:393 require_once
    wp-config.php:107 require_once
    wp-load.php:37 require_once
    wp-blog-header.php:13 require
    index.php:17 [main]

And here is the params from the POST request that resulted in the above stacktrace (I replaced personal/private info with ***):

params
{
  "give-form-id": "***",
  "give-form-title": "Credit/Debit or PayPal",
  "give-current-url": "https://antergos.com/donate",
  "give-form-url": "https://antergos.com/donate",
  "give-form-minimum": "0.00",
  "give-honeypot": "",
  "give-price-id": "0",
  "give-amount": "1.00",
  "payment-mode": "stripe",
  "give_first": "***",
  "give_last": "***",
  "give_email": "***@freenet.de",
  "card_address": "***",
  "card_address_2": "",
  "card_city": "***",
  "card_zip": "***",
  "billing_country": "DE",
  "card_state": "***",
  "give_action": "purchase",
  "give-gateway": "stripe",
  "give_stripe_token": "tok_***"
}

Let me know if there is anything else I can provide that would be helpful. Cheers! :smiley:

_Update:_ I just noticed that the url paramter of the POST request could be relevent to the issue:

url
https://antergos.com/donate?payment-mode=paypal
DevinWalker commented 8 years ago

I believe this is fixed in our most recent version about to be pushed out but I want to be sure - @lots0logs can you send me a screenshot of the donation form levels?

lots0logs commented 8 years ago

@DevinWalker There arent any levels visible because we just let the donator input the amount they want to donate. Here is a screenshot of the donation form settings: https://www.dropbox.com/s/3h1blfiq6hk8wko/screencapture-antergos-com-wp-admin-post-php-1467418048559.png?dl=0

DevinWalker commented 8 years ago

@lots0logs if you're not using levels then switch the form to "Set Donation". The bug report above indicates that Give is attempting to loop through levels that are not there - because the form is set to a multi-level form. Changing the form type to "Set Donation" will prevent that from happening while also allowing the donor to choose their own amount to give.

The strange thing is that the multi-levels are not displaying when you have that option set. I'll have to investigate that. Perhaps, is there any JS error in your console or it could be a conflict with another plugin.