Skip to content

Commit 95b37a5

Browse files
fix(captcha): Use a patch to remove deprecated warning in PHP 8.4 (#27)
* fix(gregwar): Use patch to fix gregwar deprecated issue in PHP 8.4 * fix(gregwar): Allow patch for coding tools
1 parent 01c20ea commit 95b37a5

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ protected methods, properties and constants belonging to the `src` folder and of
1111

1212
---
1313

14+
## [1.3.1](https://github.com/crowdsecurity/cs-standalone-php-bouncer/releases/tag/v1.3.1) - 2024-12-12
15+
16+
[_Compare with previous release_](https://github.com/crowdsecurity/cs-standalone-php-bouncer/compare/v1.3.0...v1.3.1)
17+
18+
### Fixed
19+
20+
- Fix Captcha deprecated warning in PHP 8.4
21+
22+
---
23+
1424
## [1.3.0](https://github.com/crowdsecurity/cs-standalone-php-bouncer/releases/tag/v1.3.0) - 2024-11-05
1525

1626
[_Compare with previous release_](https://github.com/crowdsecurity/cs-standalone-php-bouncer/compare/v1.2.0...v1.3.0)

composer.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,23 @@
4141
],
4242
"require": {
4343
"php": ">=7.2.5",
44-
"crowdsec/bouncer": "^3.2.0"
44+
"crowdsec/bouncer": "^3.2.0",
45+
"cweagans/composer-patches": "^1.7"
4546
},
4647
"require-dev": {
4748
"phpunit/phpunit": "^8.5.30 || ^9.3",
4849
"mikey179/vfsstream": "^1.6.11"
50+
},
51+
"config": {
52+
"allow-plugins": {
53+
"cweagans/composer-patches": true
54+
}
55+
},
56+
"extra": {
57+
"patches": {
58+
"gregwar/captcha": {
59+
"Fix deprecation in CaptchaBuilder constructor": "patches/gregwar-captcha-constructor.patch"
60+
}
61+
}
4962
}
5063
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/Gregwar/Captcha/CaptchaBuilder.php b/src/Gregwar/Captcha/CaptchaBuilder.php
2+
index ab8d93f..67e77cf 100644
3+
--- a/src/Gregwar/Captcha/CaptchaBuilder.php
4+
+++ b/src/Gregwar/Captcha/CaptchaBuilder.php
5+
@@ -133,7 +133,7 @@ class CaptchaBuilder implements CaptchaBuilderInterface
6+
*/
7+
public $tempDir = 'temp/';
8+
9+
- public function __construct($phrase = null, PhraseBuilderInterface $builder = null)
10+
+ public function __construct($phrase = null, ?PhraseBuilderInterface $builder = null)
11+
{
12+
if ($builder === null) {
13+
$this->builder = new PhraseBuilder;

src/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ class Constants extends LibConstants
2121
/** @var string The user agent suffix for CrowdSec api calls */
2222
public const USER_AGENT_SUFFIX = 'Standalone';
2323
/** @var string The last version of this bouncer */
24-
public const VERSION = 'v1.3.0';
24+
public const VERSION = 'v1.3.1';
2525
}

tools/coding-standards/composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@
2121
"type": "path",
2222
"url": "../../"
2323
}
24+
},
25+
"config": {
26+
"allow-plugins": {
27+
"cweagans/composer-patches": true
28+
}
2429
}
25-
}
30+
}

0 commit comments

Comments
 (0)