[wp-trac] [WordPress Trac] #56340: PHP8.1 E_DEPRECATED in PasswordHash::gensalt_blowfish
WordPress Trac
noreply at wordpress.org
Fri Aug 5 08:55:05 UTC 2022
#56340: PHP8.1 E_DEPRECATED in PasswordHash::gensalt_blowfish
-----------------------------------+---------------------
Reporter: hanshenrik | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.1
Component: Application Passwords | Version: trunk
Severity: minor | Resolution:
Keywords: has-patch php81 | Focuses:
-----------------------------------+---------------------
Changes (by SergeyBiryukov):
* keywords: has-patch => has-patch php81
* milestone: Awaiting Review => 6.1
Old description:
> 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)));
> ```
New description:
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#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list