[9.x] Fix deprecation warning when comparing a password against a NULL
database password
#44986
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.
This used to be dealt with via a
strlen(null)
check added in this commita36f1fe
@GrahamCampbell I'd appreciate if you could cast your eye over this change.
strlen(null)
used to return 0 as shown in this PHP docs comment, however since PHP 8.0, passing null to strlen() has been deprecated.I think this check has always been a null check as passing an empty string as the second parameter to
password_verify()
has always been permitted and throws no level of warning or error.To be on the safe side I have also added tests for when
$hashedValue
is passed in as an empty string.We're are seeing a lot of deprecation notices as in our system it is possible for users to have a NULL password in the database until they have activated their account and setup a password.