From 73cb3ebfa544e6c6a69725c1de7e8282d99cfc0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Ceslav=20Przywara?= Date: Wed, 7 Feb 2024 18:47:04 +0100 Subject: [PATCH 1/2] Prepare version 0.22.1 --- CHANGELOG.md | 4 ++++ bc-security.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08b0191..d790b77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # BC Security Changelog +## Upcoming version 0.22.1 (????-??-??) + +... + ## Version 0.22.0 (2024-02-01) This release has been tested with PHP 8.3 and WordPress 6.4. PHP 8.1 or newer and WordPress 6.2 or newer are now required! diff --git a/bc-security.php b/bc-security.php index 5a0f99c..a5bb4b5 100644 --- a/bc-security.php +++ b/bc-security.php @@ -4,7 +4,7 @@ * Plugin Name: BC Security * Plugin URI: https://github.com/chesio/bc-security * Description: Helps keeping WordPress websites secure. - * Version: 0.22.0 + * Version: 0.22.1 * Author: Česlav Przywara * Author URI: https://www.chesio.com * Requires PHP: 8.1 From 22554888b00b6299e9c9b48414f63d7c1ff49e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Ceslav=20Przywara?= Date: Wed, 7 Feb 2024 18:53:41 +0100 Subject: [PATCH 2/2] Fix Uncaught TypeError Fixes #153. --- CHANGELOG.md | 6 ++++-- .../Security/Modules/ExternalBlocklist/Settings.php | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d790b77..45652ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # BC Security Changelog -## Upcoming version 0.22.1 (????-??-??) +## Version 0.22.1 (2024-02-07) -... +### Fixed + +* Fix `Uncaught TypeError` when saving external blocklist settings [#153](https://github.com/chesio/bc-security/issues/153). ## Version 0.22.0 (2024-02-01) diff --git a/classes/BlueChip/Security/Modules/ExternalBlocklist/Settings.php b/classes/BlueChip/Security/Modules/ExternalBlocklist/Settings.php index 2f8171d..d828817 100644 --- a/classes/BlueChip/Security/Modules/ExternalBlocklist/Settings.php +++ b/classes/BlueChip/Security/Modules/ExternalBlocklist/Settings.php @@ -27,14 +27,16 @@ class Settings extends CoreSettings /** * Sanitize lock scope values. Allow only expected values. * - * @param int $value + * @internal Form data are submitted as string, so always accept string type for $value. + * + * @param int|string $value * @param int $default * * @return int */ - public static function sanitizeAccessScope(int $value, int $default): int + public static function sanitizeAccessScope(int|string $value, int $default): int { - return Scope::tryFrom($value) ? $value : $default; + return Scope::tryFrom((int) $value) ? ((int) $value) : $default; } /**