Skip to content

createPasswordHash() broken on PHP >= 5.3.7 #3

@gjuric

Description

@gjuric
PasswordLib::createPasswordHash($password, $prefix = '$2a$')

Uses '$2a$' as a default prefix if none is specified. The factory then cycles through the available implementations and compares the $prefix with $implementation::getPrefix() but Blowfish returns '$2y2' on newer versions of PHP which makes PasswordLib throw a \DomainException('Unsupported Prefix Supplied') Exception.

public static function getPrefix() {
    if (version_compare(PHP_VERSION, '5.3.7') >= 0) {
        return '$2y$';
    } else {
        return '$2a$';
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions