Skip to content

Commit 66d2cc2

Browse files
Merge pull request #130 from julienloizelet/fix/throw-if-instantiated
fix(error): error is thrown only if bouncer has been successfully ins…
2 parents d0113a7 + 3d37adb commit 66d2cc2

File tree

12 files changed

+62
-29
lines changed

12 files changed

+62
-29
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ 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.3](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.0.3) - 2023-02-16
9+
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.0.2...v2.0.3)
10+
11+
### Fixed
12+
- If `display_errors` setting is `true`, error is thrown only if bouncer has been successfully instantiated
13+
14+
---
15+
816
## [2.0.2](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.0.2) - 2023-02-16
917
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.0.1...v2.0.2)
1018

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020
},
2121
"require": {
22-
"crowdsec/bouncer": "^1.0.1",
22+
"crowdsec/bouncer": "^1.1.1",
2323
"symfony/polyfill-mbstring": "1.20.0",
2424
"symfony/service-contracts": "2.4.1"
2525
},

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.2
7+
* Version: 2.0.3
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.2
16+
* Stable tag: 2.0.3
1717
* Text Domain: crowdsec-wp
1818
* First release: 2021.
1919
*/

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.2';
23+
public const VERSION = 'v2.0.3';
2424
public const GEOLOCATION_DIR = __DIR__ . '/../geolocation';
2525
public const TLS_DIR = __DIR__ . '/../tls';
2626
}

inc/bounce-current-ip.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ function safelyBounceCurrentIp()
2929
' in file:' . $e->getFile() .
3030
'(line ' . $e->getLine() . ')', true
3131
));
32+
return;
3233
}
33-
$displayErrors = (bool)($crowdSecConfigs['crowdsec_display_errors'] ?? false);
34+
$displayErrors = $bouncer->getConfig('display_errors');
3435
if (true === $displayErrors) {
3536
throw new BouncerException($e->getMessage(), $e->getCode(), $e);
3637
}

inc/standalone-bounce.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
' in file:' . $e->getFile() .
2525
'(line ' . $e->getLine() . ')', true
2626
));
27+
return;
2728
}
28-
$displayErrors = (bool)($crowdSecConfigs['crowdsec_display_errors'] ?? false);
29+
$displayErrors = $bouncer->getConfig('display_errors');
2930
if (true === $displayErrors) {
3031
throw new BouncerException($e->getMessage(), $e->getCode(), $e);
3132
}

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.2
7+
Stable tag: 2.0.3
88
Requires PHP: 7.2
99
License: MIT
1010
License URI: https://opensource.org/licenses/MIT

vendor/composer/installed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@
8181
},
8282
{
8383
"name": "crowdsec/bouncer",
84-
"version": "v1.0.1",
85-
"version_normalized": "1.0.1.0",
84+
"version": "v1.1.1",
85+
"version_normalized": "1.1.1.0",
8686
"source": {
8787
"type": "git",
8888
"url": "https://github.com/crowdsecurity/php-cs-bouncer.git",
89-
"reference": "c508c199a2f5778d878117cf52321df4c8fcbefb"
89+
"reference": "f132937b62fbae5efb72c6666afe74de168b16f6"
9090
},
9191
"dist": {
9292
"type": "zip",
93-
"url": "https://api.github.com/repos/crowdsecurity/php-cs-bouncer/zipball/c508c199a2f5778d878117cf52321df4c8fcbefb",
94-
"reference": "c508c199a2f5778d878117cf52321df4c8fcbefb",
93+
"url": "https://api.github.com/repos/crowdsecurity/php-cs-bouncer/zipball/f132937b62fbae5efb72c6666afe74de168b16f6",
94+
"reference": "f132937b62fbae5efb72c6666afe74de168b16f6",
9595
"shasum": ""
9696
},
9797
"require": {
@@ -109,7 +109,7 @@
109109
"mikey179/vfsstream": "^1.6.11",
110110
"phpunit/phpunit": "^8.5.30 || ^9.3"
111111
},
112-
"time": "2023-02-10T08:18:52+00:00",
112+
"time": "2023-02-16T05:36:26+00:00",
113113
"type": "library",
114114
"installation-source": "dist",
115115
"autoload": {
@@ -148,7 +148,7 @@
148148
],
149149
"support": {
150150
"issues": "https://github.com/crowdsecurity/php-cs-bouncer/issues",
151-
"source": "https://github.com/crowdsecurity/php-cs-bouncer/tree/v1.0.1"
151+
"source": "https://github.com/crowdsecurity/php-cs-bouncer/tree/v1.1.1"
152152
},
153153
"install-path": "../crowdsec/bouncer"
154154
},

vendor/composer/installed.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => 'crowdsec/wordpress-bouncer',
44
'pretty_version' => 'dev-main',
55
'version' => 'dev-main',
6-
'reference' => 'de6e91744a5574837c9ca5def6e81a70fc213ee1',
6+
'reference' => 'd0113a72084f888ce5523938728e75c9e88ba22d',
77
'type' => 'project',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
@@ -20,9 +20,9 @@
2020
'dev_requirement' => false,
2121
),
2222
'crowdsec/bouncer' => array(
23-
'pretty_version' => 'v1.0.1',
24-
'version' => '1.0.1.0',
25-
'reference' => 'c508c199a2f5778d878117cf52321df4c8fcbefb',
23+
'pretty_version' => 'v1.1.1',
24+
'version' => '1.1.1.0',
25+
'reference' => 'f132937b62fbae5efb72c6666afe74de168b16f6',
2626
'type' => 'library',
2727
'install_path' => __DIR__ . '/../crowdsec/bouncer',
2828
'aliases' => array(),
@@ -67,7 +67,7 @@
6767
'crowdsec/wordpress-bouncer' => array(
6868
'pretty_version' => 'dev-main',
6969
'version' => 'dev-main',
70-
'reference' => 'de6e91744a5574837c9ca5def6e81a70fc213ee1',
70+
'reference' => 'd0113a72084f888ce5523938728e75c9e88ba22d',
7171
'type' => 'project',
7272
'install_path' => __DIR__ . '/../../',
7373
'aliases' => array(),

0 commit comments

Comments
 (0)