2
<?php
    $connection=new PDO("mysql:host=localhost;dbname=userdata", "secure_credentials", "battery_staple");
    $user=$_POST['username1'];
    $pass=$_POST['password1'];
    $snip=mb_substr($user, 0, 3);
    $pass=password_hash($pass, PASSWORD_BCRYPT);
    $user_query=$connection->prepare("INSERT INTO login (email, password, semod, snippet) VALUES (:email, :password, :semod, :snippet)");
    $user_query->bindParam(':email', $user);
    $user_query->bindParam(':password', $pass);
    $user_query->bindParam(':semod', "false");
    $user_query->bindParam(':snippet', $snip);
    $user_query->execute;

(パスワード変更済み)

上記の PHP コードで小さな問題に直面しています。実行されるたびに、次のエラーが発生します。

Fatal error: Cannot pass parameter 2 by reference by [location][##: I shorted the above code... it's password field with issues]

周りを見ると、これは変数を使用せずに文字列/整数を直接渡す場合の問題のようです。ただし、password_hash()文字列を返すため、文字列を返していないと信じるようになりました。この問題の何が問題になる可能性がありますか?

4

1 に答える 1