Fix PHP 8.4+ implicit-nullable deprecation in U2F Error constructor - #9
Merged
Merged
Conversation
Add explicit ?\Exception type to the $previous parameter. Implicit nullable parameters (Type $x = null) are deprecated as of PHP 8.4 and emit a deprecation notice on every class load under PHP 8.5. Matches the existing @PARAM \Exception|null docblock.
mikelittle
requested review from
ferschubert-hm,
filter182,
jerico,
vladislavhmn and
wisyhambolu
May 18, 2026 13:15
wisyhambolu
approved these changes
Jun 23, 2026
wisyhambolu
left a comment
There was a problem hiding this comment.
Looks good but @mikelittle should we not also update the doc block here to have same change?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
includes/Yubico/U2F.php:504declares\Exception $previous = null— an implicit-nullable parameter, deprecated in PHP 8.4 and 8.5. This one-line change adds the explicit?to silence the deprecation notice. The docblock already says@param \Exception|null $previous, so behaviour is unchanged.Repro
Under PHP 8.5, loading any code path that touches
U2F.phpemits:In Altis this fires on every WP request inside the local stack on the PHP 8.5 image.
Context
Targeting
force-2fabecause that's the branch Altis ships from (currently pinned at^0.3.3viaaltis/security).