moshair Posted March 7, 2017 Share Posted March 7, 2017 Hello, I'm using Codeigniter Authme as user login system, I made a test to see if it works on php7, I got this warning A PHP Error was encounteredSeverity: 8192 Message: Methods with the same name as their class will not be constructors in a future version of PHP; PasswordHash has a deprecated constructor Filename: vendor/PasswordHash.php Line Number: 27 PasswordHash.php available at: https://github.com/thewasiullah/CodeIgniter-Authme/tree/master/application/vendor Can any one help me to make it compatible with php7+ Regards, Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted March 7, 2017 Share Posted March 7, 2017 The PasswordHash class is ancient. It was written more than a decade ago (appearently for PHP 4) and never updated since. It's also entirely useless, because PHP 7 has its own Password Hashing API. No need for any external libraries. Quote Link to comment Share on other sites More sharing options...
moshair Posted March 7, 2017 Author Share Posted March 7, 2017 (edited) Thank you Jacques1, I don't have a lot knowledge in php classes I modified the PasswordHash.php to be: class PasswordHash { function HashPassword($password) { return password_hash($password, PASSWORD_DEFAULT); } function CheckPassword($password, $stored_hash) { return password_verify($password , $stored_hash ); } } I seems working , the PHP warning disappeared and I logged in with the same password , do you have any comment or suggestion about the code? Edited March 7, 2017 by moshair Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted March 7, 2017 Share Posted March 7, 2017 I wouldn't rely on a one-guy-project that was last updated 4 years ago, especially since authentication is kinda critical. If CodeIgniter is any good, there's an official or at least well-established authentication module. Look for that, not random GitHub repositories. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.