Skip to content

Avoid deprecated marking a parameter as nullable in PHP 8.4 #663

@BrookeDot

Description

@BrookeDot

Describe the bug

PHP 8.4 deprecated marking a parameter as nullable. For sites running Two Factor a PHP error shows up in the logs:

u2flib_server\Error::__construct(): Implicitly marking parameter $previous as nullable is deprecated, the explicit nullable type must be used instead

Stacktrace

    wp-content/plugins/two-factor/includes/Yubico/U2F.php:504
    Two_Factor_FIDO_U2F->__construct()
    wp-content/plugins/two-factor/providers/class-two-factor-provider.php:28
    Two_Factor_Provider::get_instance()
    wp-content/plugins/two-factor/class-two-factor-core.php:291
    Two_Factor_Core::get_providers()
    wp-includes/class-wp-hook.php:324
    do_action('init')
    wp-settings.php:704

Steps to Reproduce

  1. Install PHP 8.4, Two Factor and optionally Query Monitor but ensure that logging is enabled
  2. Notice the warning in the logs

Screenshots, screen recording, code snippet

No response

Environment information

PHP 8.4.2
WordPress 6.7.2

Please confirm that you have searched existing issues in this repository.

Yes

Please confirm that you have tested with all plugins deactivated except Two-Factor.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions