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

Callback hooked into give_form_html_tags incorrectly returns array|bool #6771

Open
kjohnson opened this issue Apr 11, 2023 · 0 comments
Open
Labels
keep-fresh "Keep Fresh" issues should not be marked as stale. type: bug Existing functionality is broken

Comments

@kjohnson
Copy link
Member

Details

The callback function give_stripe_form_add_data_tag_keys incorrectly returns array|bool for a filter that only supports an array return type.

In a rare condition, such as the legacy Stripe front-end files being loaded when a Stripe gateway is not active, the early return value of false breaks the output of the form HTML.

For example, see impress-org/givewp-next-gen#164.

Visuals

// give/includes/forms/template.php

/* var array $form_html_tags */
$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
// give/includes/gateways/stripe/includes/filters.php

/* @return array|bool */
function give_stripe_form_add_data_tag_keys( $form_html_tags, $form ) {

    if ( ! give_stripe_is_any_payment_method_active() ) {
        return false;
    }

    // ...

    return $form_html_tags;
}
@kjohnson kjohnson added type: bug Existing functionality is broken keep-fresh "Keep Fresh" issues should not be marked as stale. labels Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep-fresh "Keep Fresh" issues should not be marked as stale. type: bug Existing functionality is broken
Projects
None yet
Development

No branches or pull requests

1 participant