• Undefined array key “input” in class-easyfancybox-admin.php line 609

    Environment: Firelight Lightbox 2.3.22 (the 2.3.23 changelog does not mention this, so I assume it is still present), WordPress 7.1, PHP 8.3, single site.

    Every admin_init triggers this warning:

    PHP Warning: Undefined array key “input” in wp-content/plugins/easy-fancybox/inc/class-easyfancybox-admin.php on line 609

    The line is inside add_settings_fields_recursively():

    if (
        is_array( $option )
        && array_key_exists( 'options', $option )
        // Exclude select inputs, which have options key.
        && 'select' !== $option['input']
    ) {

    Some entries in the options tree have an ‘options’ key but no ‘input’ key, so the comparison reads an undefined index. The logic still evaluates as intended (a missing ‘input’ is not ‘select’), so there is no functional bug, only the warning.

    Because admin_init also fires on admin-ajax.php, this runs on every ajax request from every logged-in user, not just on admin pages. On a BuddyPress community with a few hundred active members we log roughly 11,000 of these warnings per day, which drowns out real errors.

    Suggested fix, one line:

    && 'select' !== ( $option['input'] ?? '' )

    Optionally, register the settings fields only on the plugin’s own settings screen (or skip when wp_doing_ajax()) so the recursive walk does not run on every ajax call at all.

    Happy to test a dev build. Thanks for maintaining the plugin.

You must be logged in to reply to this topic.