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

Invalid Argument Supplied when no Donation Levels #2451

Closed
2 tasks
cwsterling opened this issue Dec 4, 2017 · 1 comment
Closed
2 tasks

Invalid Argument Supplied when no Donation Levels #2451

cwsterling opened this issue Dec 4, 2017 · 1 comment
Assignees
Milestone

Comments

@cwsterling
Copy link

Issue Overview

If you have a donation form with only custom amount turned on and no donation levels, you get an Invalid argument supplied for foreach()

Expected Behavior

Only custom donation level input shows

Current Behavior

Custom input shows, but also PHP errors show if errors are allowed to be shown.

Warning: Invalid argument supplied for foreach() in /srv/users/serverpilot/apps/fixingtheboro/public/wp-content/plugins/give/includes/forms/template.php on line 146
Warning: Invalid argument supplied for foreach() in /srv/users/serverpilot/apps/fixingtheboro/public/wp-content/plugins/give/includes/price-functions.php on line 96
Warning: Invalid argument supplied for foreach() in /srv/users/serverpilot/apps/fixingtheboro/public/wp-content/plugins/give/includes/forms/template.php on line 501 

Possible Solution

Check that the array isn't null before passing into the foreach

Steps to Reproduce (for bugs)

https://fixingtheboro.com/donations/adoption/

  1. Create a new donation form
  2. Delete all the donation levels
  3. Allow for custom levels
  4. View on donation form page.

Related Issues and/or PRs

Todos

  • Tests
  • Documentation

WordPress Environment

``` ### WordPress Environment ###

Home URL: https://fixingtheboro.com
Site URL: https://fixingtheboro.com
WP Version: 4.9.1
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US
Permalink Structure: /%year%/%monthnum%/%day%/%postname%/
Show on Front: page
Page on Front: Welcome (#2)
Page for Posts: Unset
Table Prefix Length: 14
Table Prefix Status: Acceptable
Admin AJAX: Inaccessible
Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval

Server Environment

Hosting Provider: DBH: localhost, SRV: fixingtheboro.com
TLS Connection: Connection uses TLS 1.2
TLS Connection: Probably Okay
Server Info: Apache/2.4.28 (Unix) OpenSSL/1.0.2g
PHP Version: 7.1.11
PHP Post Max Size: 1 GB
PHP Time Limit: 30
PHP Max Input Vars: 5000
PHP Max Upload Size: 512 MB
cURL Version: 7.47.0, OpenSSL/1.0.2g
SUHOSIN Installed: –
MySQL Version: 5.7.20
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
gzip: ✔
GD Graphics Library: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Give Configuration

Give Version: 1.8.16
Upgraded From: 1.8.13
Test Mode: Disabled
Currency Code: USD
Currency Position: After
Decimal Separator: .
Thousands Separator: ,
Success Page: https://fixingtheboro.com/donation-confirmation/
Failure Page: https://fixingtheboro.com/donation-failed/
Donation History Page: https://fixingtheboro.com/donation-history/
Give Forms Slug: /donations/
Enabled Payment Gateways: Offline Donation, PayPal Standard
Default Payment Gateway: PayPal Standard
PayPal IPN Verification: Enabled
PayPal IPN Notifications: IPN received for #861 ( 6AE524058W969342N ) on 12/03/2017 at 19:01. Status VERIFIED
Admin Email Notifications: Enabled
Donor Email Access: Disabled

Session Configuration

Give Use Sessions: Enabled
Session: Disabled

Active Give Add-ons

Other Active Plugins

Advanced Order Export For WooCommerce: by AlgolPlus – 1.5.0
Easy HTTPS (SSL) Redirection: by Tips and Tricks HQ – 1.7
Google Analytics for WordPress by MonsterInsights: by MonsterInsights – 6.2.6
Ninja Forms: by The WP Ninjas – 3.2.4
Redirection: by John Godley – 2.10
Seamless Donations: by David Gewirtz – 4.0.20
SparkPost: by SparkPost – 3.0.1
URL Coupons for WooCommerce: by Rymera Web Co – 1.0.2
WooCommerce: by Automattic – 3.2.4
WooCommerce PayPal Powered by Braintree Gateway: by WooCommerce – 2.0.4
Wordfence Security: by Wordfence – 6.3.21
WP Mail Logging: by Christian Zöller – 1.8.3
YITH Pre-Order for WooCommerce: by YITHEMES – 1.1.3

Inactive Plugins

Akismet Anti-Spam: by Automattic – 4.0.1
Google Captcha (reCAPTCHA) by BestWebSoft: by BestWebSoft – 1.33

Theme

Name: Sparkling
Version: 2.3.5
Author URL: http://colorlib.com/
Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

</details>
@DevinWalker
Copy link
Member

@cwsterling thanks for submitting the issue. I'm curious, why are you using the "Multi-level" donation rather than "Set donation"?

@DevinWalker DevinWalker added this to the 1.8.18 milestone Dec 5, 2017
@DevinWalker DevinWalker self-assigned this Dec 5, 2017
DevinWalker added a commit that referenced this issue Dec 14, 2017
…ing forms without any levels when set to multi-level - Resolves #2451
DevinWalker added a commit that referenced this issue Dec 14, 2017
* release/1.8.18:
  Removed code for deprecated in browser receipt functionality #2483
  Use new link for raw URL rather than deprecated browser link #2483
  Hide the first multi-level remove button to prevent admins from creating forms without any levels when set to multi-level - Resolves #2451
  Strict email

# Conflicts:
#	includes/emails/class-give-email-tags.php
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