title: PHP password_hash and password_verify weird issue not verifying
body: <p>Here is my scenario:</p>
  <p>I have a function that gives out json response when called for. Its inside a class that has the Signup.class.php included which has the <code>Signup</code> class. Where the GET param <code>pass</code> is being accessed inside the <code>gen_hash()</code> function as shown above. The code is below.</p>
  <p>The code is live at <a href="https://api1.selfmade.ninja/api/gen_hash?pass=hellooo" rel="nofollow noreferrer">https://api1.selfmade.ninja/api/gen_hash?pass=hellooo</a></p>
  <pre><code>        private function gen_hash(){
              if(isset($this-&gt;_request['pass'])){
                  $s = new Signup(&quot;&quot;, $this-&gt;_request['pass'], &quot;&quot;);
                  $hash = $s-&gt;hashPassword();
                  $data = [
                      &quot;hash&quot; =&gt; $hash,
                      &quot;info&quot; =&gt; password_get_info($hash),
                      &quot;val&quot; =&gt; $this-&gt;_request['pass'],
                      &quot;verify&quot; =&gt; password_verify($this-&gt;_request['pass'], $hash),
                      &quot;spot_verify&quot; =&gt; password_verify($this-&gt;_request['pass'], password_hash($this-&gt;_request['pass'], PASSWORD_BCRYPT))
                  ];
                  $data = $this-&gt;json($data);
                  $this-&gt;response($data,200);
              }
          }
  </code></pre>
  <p>This function calls Signup.class.php which has the following code:</p>
  <pre><code>&lt;?php
  
  require_once('Database.class.php');
  
  class Signup {
  
      private $username;
      private $password;
      private $email;
  
      private $db;
  
      public function __construct($username, $password, $email){
          $this-&gt;db = Database::getConnection();
          $this-&gt;username = $username;
          $this-&gt;password = $password;
          $this-&gt;email = $email;
      }
  
      public function getInsertID(){
  
      }
  
      public function hashPassword(){
          //echo $this-&gt;password;
          return password_hash($this-&gt;$password, PASSWORD_BCRYPT);
      }
  
  }
  </code></pre>
  <p>The issue is as follows:</p>
  <ol>
  <li>The &quot;spot_verify&quot; array key from <code>gen_hash()</code> has a code that works as intended.</li>
  <li>But the &quot;verify&quot; array key from <code>gen_hash()</code> has a code that is not working as intended. It is always telling false whatsoever the case is. The hash is being generated from the <code>Signup::hashPassword()</code> function. It is all working as expected. The value is setting right, and is being passed to the <code>password_hash</code> function from within the <code>Signup::hashPassword()</code>. But inside gen_hash() under &quot;verify&quot;, it just tells false.</li>
  </ol>
  <p>The code is live at <a href="https://api1.selfmade.ninja/api/gen_hash?pass=hellooo" rel="nofollow noreferrer">https://api1.selfmade.ninja/api/gen_hash?pass=hellooo</a></p>
  <p>It is giving the following answer and it makes no sense. Why is verify false?:</p>
  <pre><code>{
      &quot;hash&quot;: &quot;$2y$10$Y3bq8EzFmEpgM6zZqONeeeP3gaUkSClyjmS3NCWxrpFS6R8okRHJG&quot;,
      &quot;info&quot;: {
          &quot;algo&quot;: &quot;2y&quot;,
          &quot;algoName&quot;: &quot;bcrypt&quot;,
          &quot;options&quot;: {
              &quot;cost&quot;: 10
          }
      },
      &quot;val&quot;: &quot;hellooo&quot;,
      &quot;verify&quot;: false,
      &quot;spot_verify&quot;: true
  }
  </code></pre>
  <p>What I did already? I ensured that the same password value is being passed to password_hash and password_verify. But this makes no sense. What am I missing?</p>