WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms + Stripe
Problem with array_key_exists() warnings (9 posts)

  1. mattkoltermann
    Member
    Posted 1 year ago #

    I've created a form that contains, among other standard Gravity Form fields, product, name, address, and credit card fields. When I complete the fields using any one of the test card details provided by Stripe and submit the form, the test payment is correctly processed but there are a series of seven warnings that briefly appear directly below the submit button on my form as it's being processed right before being redirected to the confirmation page. Six of them look exactly like this:

    Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /home/rutgersc/public_html/wp-content/plugins/gravity-forms-stripe/stripe.php on line 2356

    Here's a screenshot of the warnings.

    I'm running WordPress 3.4.2, Gravity Forms 1.6.10, and Gravity Forms + Stripe 1.6.9.1.

    Any ideas? Thanks for your help debugging!

    http://wordpress.org/extend/plugins/gravity-forms-stripe/

  2. mattkoltermann
    Member
    Posted 1 year ago #

    Wow. After hours of trying to figure it out myself, of course I discover the root of the problem 20 mins after posting this :)

    The reason why those error messages were appearing is because I had "Page" selected under Form Settings > Confirmation and Ajax set to "true". When I changed the setting to "false" the warnings disappeared.

    I'll leave this open in case this is a potential issue the developer might like to address, unless this is functioning as designed.

  3. Dave
    Member
    Posted 1 year ago #

    Hmmm I'm experiencing this issue too.

    The above solution does not solve it. I have text selected and ajax is false.

    Here is whats in line 2356

    if ( 'creditcard' == $input_type ) {
    
    			if ( ! array_key_exists( $field['inputs'][0]['id'], $lead ) ) {
    				$input_name = "input_" . str_replace('.', '_', $field['inputs'][0]['id']);
    				$original_value_changed = $original_value = rgpost( $input_name );
    				$original_value_changed = str_replace( ' ', '', $original_value_changed );
    				$card_number_length = strlen( $original_value_changed );
    				$original_value_changed = substr( $original_value_changed, -4, 4 );
    				$original_value_changed = str_pad( $original_value_changed, $card_number_length, "X", STR_PAD_LEFT );
    				if( $original_value_changed == $value ) {
    					$value = $original_value;
    				}
    			}
    
    		}

    Any suggestions?

  4. Dave
    Member
    Posted 1 year ago #

    Interesting. I set form to ajax="true" and the warnings disappear.

  5. mattkoltermann
    Member
    Posted 1 year ago #

    Very strange, Dave...that's the opposite of what worked for me.

  6. arir456
    Member
    Posted 1 year ago #

    I seem to be having the same problem as you but have absolutely no idea how to fix it. I have "text" selected under Form Settings > Confirmation and I have no idea how to change the "ajax". Is there anything you to can suggest please?

    How do I switch "ajax" ? Please help if you can.

    Thank you!

  7. Dave
    Member
    Posted 1 year ago #

    Ajax can be set to true or false in the shortcode. Go to the page where the form is on. When you use the add form button, the ajax setting can be checked/unchecked there.

    Same applies if it's used in a widget.

  8. chrome88
    Member
    Posted 12 months ago #

    just for the record, using "ajax=true" worked for me. before that (using the default of ajax not being defined in the shortcode) i was getting the same error message.

  9. Scoobiefan
    Member
    Posted 11 months ago #

    I had ajax=false, and would get the warnings at the top of the page when an error happened or when the confirmation message was shown (they go to a confirmation page now)

    I set ajax=false and it shows up for a brief second below the submit button, but only if the form is a success. If the card does not go through, I do not see these messages.

    Thank you for making an error that would definitely be seen turn into an error that might be seen.

    Tried to do some editing with no success. If I figure it out I'll make sure to post something.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.