Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7+ & encoding #828

Closed
MimisK13 opened this issue Aug 2, 2018 · 4 comments
Closed

PHP 7+ & encoding #828

MimisK13 opened this issue Aug 2, 2018 · 4 comments

Comments

@MimisK13
Copy link

MimisK13 commented Aug 2, 2018

https://imgur.com/a/ngRgNxv

Same code, different version of PHP.

@yitam
Copy link
Contributor

yitam commented Aug 2, 2018

Please provide more details and steps how to reproduce this issue.

@MimisK13
Copy link
Author

MimisK13 commented Aug 2, 2018

db Model:

`protected static function getDB()
{
    static $db = null;
    if ($db === null)
    {
        $dsn = Config::DB_TYPE . ':Server=' . Config::DB_HOST . ';Database=' . Config::DB_NAME;

        $db = new PDO( $dsn, Config::DB_USER, Config::DB_PASSWORD );

        // Throw an Exception when an error occurs
        $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    return $db;
}`

Query:

` public static function findByUsername($account)
{

    $sql = 'SELECT * FROM dbo.user_auth WHERE account = :account';

    $db = static::getDB();
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':account', $account, PDO::PARAM_STR );

    $stmt->setFetchMode(PDO::FETCH_CLASS, get_called_class());

    $stmt->execute();

    return $stmt->fetch();
}`

`$user = static::findByUsername($account);
 var_dump($user->password);`

Password datatype from database is BINARY(16)

@yitam
Copy link
Contributor

yitam commented Aug 2, 2018

Your password is of binary type, and please see the related issue #553 for the explanation and details of why this change is required.

@MimisK13
Copy link
Author

MimisK13 commented Aug 2, 2018

Thank you very much !

@MimisK13 MimisK13 closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants