ircmaxell / password_compat

Compatibility with the password_* functions that ship with PHP 5.5
MIT License
2.15k stars 421 forks source link

Avoid creating 'PasswordCompat' functions when PASSWORD_DEFAULT already exists #68

Closed patrickallaert closed 9 years ago

ircmaxell commented 9 years ago

First, there's no danger doing that.

Second, that will always be defined by that point, since it's defined further up in that same file. So therefore the error check is invalid and will cause errors.

What's the purpose for it?

patrickallaert commented 9 years ago

First, there's no danger doing that.

Indeed.

Second, that will always be defined by that point, since it's defined further up in that same file. So therefore the error check is invalid and will cause errors.

True, I thought about doing something like this at the very top of the file:

if (defined('PASSWORD_DEFAULT')) {
    return;
}

but then it conflicted with namespace declaration and reworked this with this (buggy) approach.

What's the purpose for it?

Nothing important, I just wanted to avoid having the PasswordCompat\binary/* functions loaded in a PHP 5.5 project.