Skip to content

Commit 4d8fc4f

Browse files
fix(TypeError): Cast missing database option value to string if necessary
1 parent 1294636 commit 4d8fc4f

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: actions/checkout@v3
4141

4242
- name: Check version ${{ env.VERSION_NUMBER }} consistency in files
43-
# Check crowdsec.php, readme.txt, inc/Constants.php and CHANGELOG.md
43+
# Check crowdsec.php (2), readme.txt (1), inc/Constants.php (1) and CHANGELOG.md (3)
4444
run: |
4545
CURRENT_DATE=$(date +'%Y-%m-%d')
4646
CHANGELOG_VERSION=$(grep -o -E "## \[(.*)\].* - $CURRENT_DATE" CHANGELOG.md | head -1 | sed 's/ //g')

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## [2.0.2](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.0.2) - 2023-02-16
9+
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.0.1...v2.0.2)
10+
11+
### Fixed
12+
- Cast missing database options to string if necessary ([#127](https://github.com/crowdsecurity/cs-wordpress-bouncer/issues/127))
13+
14+
15+
---
16+
817
## [2.0.1](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.0.1) - 2023-02-14
918
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.0.0...v2.0.1)
1019

crowdsec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://github.com/crowdsecurity/cs-wordpress-bouncer
55
* Description: Safer Together. Protect your WordPress application with CrowdSec.
66
* Tags: crowdsec-bouncer, wordpress, security, firewall, captcha, ip-scanner, ip-blocker, ip-blocking, ip-address, ip-database, ip-range-check, crowdsec, ban-hosts, ban-management, anti-hacking, hacker-protection, captcha-image, captcha-generator, captcha-generation, captcha-service
7-
* Version: 2.0.1
7+
* Version: 2.0.2
88
* Author: CrowdSec
99
* Author URI: https://www.crowdsec.net/
1010
* Github: https://github.com/crowdsecurity/cs-wordpress-bouncer
@@ -13,7 +13,7 @@
1313
* Requires PHP: 7.2
1414
* Requires at least: 4.9
1515
* Tested up to: 6.1
16-
* Stable tag: 2.0.1
16+
* Stable tag: 2.0.2
1717
* Text Domain: crowdsec-wp
1818
* First release: 2021.
1919
*/

inc/Bouncer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ public function handleRawConfigs(array $rawConfigs): array
6262
{
6363
return [
6464
// LAPI connection
65-
'api_key' => $this->escape($rawConfigs['crowdsec_api_key'] ?? ''),
65+
'api_key' => $this->escape((string)$rawConfigs['crowdsec_api_key'] ?? ''),
6666
'auth_type' => (string)($rawConfigs['crowdsec_auth_type'] ?? Constants::AUTH_KEY),
67-
'tls_cert_path' => Constants::TLS_DIR . '/' . ltrim($rawConfigs['crowdsec_tls_cert_path'] ?? '', '/'),
68-
'tls_key_path' => Constants::TLS_DIR . '/' . ltrim($rawConfigs['crowdsec_tls_key_path'] ?? '', '/'),
67+
'tls_cert_path' => Constants::TLS_DIR . '/' . ltrim((string)$rawConfigs['crowdsec_tls_cert_path'] ?? '', '/'),
68+
'tls_key_path' => Constants::TLS_DIR . '/' . ltrim((string)$rawConfigs['crowdsec_tls_key_path'] ?? '', '/'),
6969
'tls_verify_peer' => (bool)($rawConfigs['crowdsec_tls_verify_peer'] ?? false),
7070
'tls_ca_cert_path' => Constants::TLS_DIR . '/' .
71-
ltrim($rawConfigs['crowdsec_tls_ca_cert_path'], '/'),
72-
'api_url' => $this->escape($rawConfigs['crowdsec_api_url'] ?? ''),
71+
ltrim((string)$rawConfigs['crowdsec_tls_ca_cert_path'], '/'),
72+
'api_url' => $this->escape((string)$rawConfigs['crowdsec_api_url'] ?? ''),
7373
'use_curl' => (bool)($rawConfigs['crowdsec_use_curl'] ?? false),
7474
'api_timeout' => (int)($rawConfigs['crowdsec_api_timeout'] ?? Constants::API_TIMEOUT),
7575
// Debug
@@ -86,10 +86,10 @@ public function handleRawConfigs(array $rawConfigs): array
8686
Constants::REMEDIATION_BYPASS),
8787
// Cache settings
8888
'stream_mode' => (bool)($rawConfigs['crowdsec_stream_mode'] ?? false),
89-
'cache_system' => $this->escape($rawConfigs['crowdsec_cache_system'] ?? Constants::CACHE_SYSTEM_PHPFS),
89+
'cache_system' => $this->escape((string)$rawConfigs['crowdsec_cache_system'] ?? Constants::CACHE_SYSTEM_PHPFS),
9090
'fs_cache_path' => Constants::CACHE_PATH,
91-
'redis_dsn' => $this->escape($rawConfigs['crowdsec_redis_dsn'] ?? ''),
92-
'memcached_dsn' => $this->escape($rawConfigs['crowdsec_memcached_dsn'] ?? ''),
91+
'redis_dsn' => $this->escape((string)$rawConfigs['crowdsec_redis_dsn'] ?? ''),
92+
'memcached_dsn' => $this->escape((string)$rawConfigs['crowdsec_memcached_dsn'] ?? ''),
9393
'clean_ip_cache_duration' => (int)($rawConfigs['crowdsec_clean_ip_cache_duration'] ??
9494
Constants::CACHE_EXPIRATION_FOR_CLEAN_IP),
9595
'bad_ip_cache_duration' => (int)($rawConfigs['crowdsec_bad_ip_cache_duration'] ??

inc/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Constants extends LibConstants
2020
public const LOG_BASE_PATH = __DIR__ . '/../logs/';
2121
public const CACHE_PATH = __DIR__ . '/../.cache';
2222
public const CONFIG_PATH = __DIR__ . '/standalone-settings.php';
23-
public const VERSION = 'v2.0.1';
23+
public const VERSION = 'v2.0.2';
2424
public const GEOLOCATION_DIR = __DIR__ . '/../geolocation';
2525
public const TLS_DIR = __DIR__ . '/../tls';
2626
}

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://crowdsec.net/
44
Tags: crowdsec-bouncer, wordpress, security, firewall, captcha, ip-scanner, ip-blocker, ip-blocking, ip-address, ip-database, ip-range-check, crowdsec, ban-hosts, ban-management, anti-hacking, hacker-protection, captcha-image, captcha-generator, captcha-generation, captcha-service
55
Requires at least: 4.9
66
Tested up to: 6.1
7-
Stable tag: 2.0.1
7+
Stable tag: 2.0.2
88
Requires PHP: 7.2
99
License: MIT
1010
License URI: https://opensource.org/licenses/MIT

0 commit comments

Comments
 (0)