• Resolved Camilo

    (@camiloluna)


    I’m getting a fatal error on the latest (10.6.1) version of the plugin as described below.

    Error

    Uncaught TypeError: WC_Stripe_Plugins_Page_Controller::enqueue_scripts():
    Argument #1 ($hook_suffix) must be of type string, null given,
    called in wp-includes/class-wp-hook.php on line 324
    and defined in plugins/woocommerce-gateway-stripe/includes/admin/class-wc-stripe-plugins-page-controller.php:38

    Stack trace shows the action being dispatched from iframe_header() (wp-admin/includes/template.php:2156), which Event Tickets calls from Tribe__Tickets__Admin__Move_Tickets::dialog().

    Steps to reproduce

    1. Activate WooCommerce, WooCommerce Stripe Gateway, and The Events Calendar + Event Tickets.
    2. Create an event with tickets and at least one attendee.
    3. Go to Events → Attendees, select an attendee, choose Move.
    4. The “Move Attendees” iframe dialog opens and the request fatals.

    Root cause

    WC_Stripe_Plugins_Page_Controller::enqueue_scripts() declares a strict string $hook_suffix parameter:

    public function enqueue_scripts( string $hook_suffix ) {
        if ( 'plugins.php' !== $hook_suffix ) { return; }
        ...
    }

    WordPress core’s iframe_header() calls do_action( 'admin_enqueue_scripts', $hook_suffix ) using the global $hook_suffix, which is null in any iframe context where the global was never populated (Event Tickets’ Move Attendees and Move Tickets dialogs, Press This, the legacy plugin upload iframe, etc.). With a strict scalar typehint and no nullable annotation, the call fatals on PHP 7+.

    Suggested fix (with AI help)

    Either:

    • Relax the signature to ?string $hook_suffix = null and treat null as “not on plugins.php”, or
    • Cast at the boundary: $hook_suffix = is_string( $hook_suffix ) ? $hook_suffix : ''; before the equality check.

    Either avoids the TypeError without changing existing behavior — the method already early-returns for anything that isn’t ‘plugins.php’.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.