[wp-trac] [WordPress Trac] #56340: PHP8.1 E_DEPRECATED in PasswordHash::gensalt_blowfish

WordPress Trac noreply at wordpress.org
Fri Aug 5 07:44:21 UTC 2022


#56340: PHP8.1 E_DEPRECATED in PasswordHash::gensalt_blowfish
-----------------------------------+-----------------------------
 Reporter:  hanshenrik             |      Owner:  (none)
     Type:  defect (bug)           |     Status:  new
 Priority:  normal                 |  Milestone:  Awaiting Review
Component:  Application Passwords  |    Version:  trunk
 Severity:  minor                  |   Keywords:
  Focuses:                         |
-----------------------------------+-----------------------------
 since PHP8.1, PasswordHash::gensalt_blowfish risk getting E_DEPRECATED
 errors like
 >Deprecated: Implicit conversion from float 48.8 to int loses precision

 in
 ```
 $output .= chr((ord('0') + $this->iteration_count_log2 / 10));
 ```
 - the fix is simple, change it from implicit conversion to explicit
 conversion:
 ```
 $output .= chr((int)((ord('0') + $this->iteration_count_log2 / 10)));
 ```

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56340>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list