Not PHP 8.1 compatible – critical error with php 8.1
-
I know this plugin is no longer supported and can no longer be downloaded to use, but for those that are still using it beware. If you update to PHP 8.1 (possibly even 8.0) and a WordPress version that is numbered as a patch ie major.minor.patch such as 5.9.1 your website will fail due to a critical error in the plugin.
On line 46 of the main plugin file (slt-force-strong-passwords.php)
define( 'SLT_FSP_USE_ZXCVBN', version_compare( round( $wp_version, 1 ), '3.7' ) >= 0 );
will cause a fatal php error ie:
Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given
as $wp_version will be ‘5.9.1’ a string and not an int or float, round fails.
Why has this worked until now you ask? I expect it is because it is not until PHP 8.0 that things became more strict with passing the correct data types.One way to get your site working again, would be to replace the line with
define( 'SLT_FSP_USE_ZXCVBN', true );
assuming that you are using WordPress greater than 3.7 (which would be a worry if you are not)Hope this helps someone.
- The topic ‘Not PHP 8.1 compatible – critical error with php 8.1’ is closed to new replies.