Skip to content

Commit

Permalink
fix(captcha): Use a patch to remove deprecated warning in PHP 8.4 (#27)
Browse files Browse the repository at this point in the history
* fix(gregwar): Use patch to fix gregwar deprecated issue in PHP 8.4

* fix(gregwar): Allow patch for coding tools
  • Loading branch information
julienloizelet authored Dec 12, 2024
1 parent 01c20ea commit 95b37a5
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ protected methods, properties and constants belonging to the `src` folder and of

---

## [1.3.1](https://github.com/crowdsecurity/cs-standalone-php-bouncer/releases/tag/v1.3.1) - 2024-12-12

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

### Fixed

- Fix Captcha deprecated warning in PHP 8.4

---

## [1.3.0](https://github.com/crowdsecurity/cs-standalone-php-bouncer/releases/tag/v1.3.0) - 2024-11-05

[_Compare with previous release_](https://github.com/crowdsecurity/cs-standalone-php-bouncer/compare/v1.2.0...v1.3.0)
Expand Down
15 changes: 14 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,23 @@
],
"require": {
"php": ">=7.2.5",
"crowdsec/bouncer": "^3.2.0"
"crowdsec/bouncer": "^3.2.0",
"cweagans/composer-patches": "^1.7"
},
"require-dev": {
"phpunit/phpunit": "^8.5.30 || ^9.3",
"mikey179/vfsstream": "^1.6.11"
},
"config": {
"allow-plugins": {
"cweagans/composer-patches": true
}
},
"extra": {
"patches": {
"gregwar/captcha": {
"Fix deprecation in CaptchaBuilder constructor": "patches/gregwar-captcha-constructor.patch"
}
}
}
}
13 changes: 13 additions & 0 deletions patches/gregwar-captcha-constructor.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/Gregwar/Captcha/CaptchaBuilder.php b/src/Gregwar/Captcha/CaptchaBuilder.php
index ab8d93f..67e77cf 100644
--- a/src/Gregwar/Captcha/CaptchaBuilder.php
+++ b/src/Gregwar/Captcha/CaptchaBuilder.php
@@ -133,7 +133,7 @@ class CaptchaBuilder implements CaptchaBuilderInterface
*/
public $tempDir = 'temp/';

- public function __construct($phrase = null, PhraseBuilderInterface $builder = null)
+ public function __construct($phrase = null, ?PhraseBuilderInterface $builder = null)
{
if ($builder === null) {
$this->builder = new PhraseBuilder;
2 changes: 1 addition & 1 deletion src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ class Constants extends LibConstants
/** @var string The user agent suffix for CrowdSec api calls */
public const USER_AGENT_SUFFIX = 'Standalone';
/** @var string The last version of this bouncer */
public const VERSION = 'v1.3.0';
public const VERSION = 'v1.3.1';
}
7 changes: 6 additions & 1 deletion tools/coding-standards/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@
"type": "path",
"url": "../../"
}
},
"config": {
"allow-plugins": {
"cweagans/composer-patches": true
}
}
}
}

0 comments on commit 95b37a5

Please sign in to comment.