Skip to content

Callback hooked into give_form_html_tags incorrectly returns array|bool #6771

Open
@kjohnson

Description

@kjohnson

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    keep-fresh"Keep Fresh" issues should not be marked as stale.type: bugExisting functionality is broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions