Skip to content

Conversation

@BrookeDot
Copy link
Contributor

What?

PHP 8.4 requires null values to be explicitly declared: https://www.php.net/manual/en/migration84.deprecated.php

This PR does that for the U2F.php class fixing the warning:

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

Why?

To avoid noise in the PHP logs and it is likely this may be a fatal in a future version of PHP.

How?

This adds a ? to the class to allow it to be explicitly null.

Testing Instructions

Install PHP 8.4, make the change in the PR and watch the error go away.

Changelog Entry

Fixed - PHP 8.4: Implicitly marking parameter $previous as nullable is deprecated (#663)

Fix PHP 8.4 warning
@kasparsd
Copy link
Collaborator

The plugin is currently supporting PHP 7.2 and above:

https://github.com/WordPress/two-factor/blob/953b7c98a51d3ab2f3d2c6c25f007f626be4b7de/two-factor.php#L16C23-L16C26

It appears that support for nullable arguments was added to 7.1 so this is safe to merge.

Thanks for the pull request!

Noting that U2F support will be removed soon #439 but having this fixed is definitely worth it.

@kasparsd kasparsd merged commit 6d6d39a into WordPress:master Feb 13, 2025
24 checks passed
@jeffpaul jeffpaul added this to the 0.12.0 milestone Feb 13, 2025
@kasparsd kasparsd mentioned this pull request Feb 14, 2025
@jeffpaul jeffpaul modified the milestones: 0.13.0, 0.12.0 Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants