Skip to content

Commit 92003da

Browse files
Merge pull request #126 from julienloizelet/feat/update-gregwar-captcha-bis
feat(captcha): Update gregwar captcha to 1.2.0 and remove some fixes
2 parents c0f5c1f + e07b05f commit 92003da

File tree

4 files changed

+11
-30
lines changed

4 files changed

+11
-30
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this librar
99

1010
---
1111

12+
## [?.?.?](https://github.com/crowdsecurity/php-cs-bouncer/releases/tag/v?.?.?) - ?.?.?
13+
[_Compare with previous release_](https://github.com/crowdsecurity/php-cs-bouncer/compare/v1.4.0...v?.?.?)
14+
15+
16+
### Changed
17+
- Update `gregwar/captcha` from `1.1.9` to `1.2.0` and remove some override fixes
18+
19+
---
20+
21+
1222
## [1.4.0](https://github.com/crowdsecurity/php-cs-bouncer/releases/tag/v1.4.0) - 2023-03-30
1323
[_Compare with previous release_](https://github.com/crowdsecurity/php-cs-bouncer/compare/v1.3.0...v1.4.0)
1424

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"crowdsec/common": "^2.1.0",
4545
"symfony/config": "^4.4.27 || ^5.2 || ^6.0",
4646
"twig/twig": "^3.4.2",
47-
"gregwar/captcha": "^1.1",
47+
"gregwar/captcha": "^1.2.0",
4848
"mlocati/ip-lib": "^1.18",
4949
"ext-json": "*",
5050
"ext-gd": "*"

src/Fixes/Gregwar/Captcha/CaptchaBuilder.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
/**
88
* Override to :
99
* - fix "implicit conversion error on PHP 8.1"
10-
* - fix "creation of dynamic property $background error on PHP 8.2"
11-
*
1210
*
1311
* @see https://github.com/crowdsecurity/php-cs-bouncer/issues/62 and
1412
* @see https://github.com/Gregwar/Captcha/pull/101/files
@@ -18,10 +16,6 @@
1816
*/
1917
class CaptchaBuilder extends GregwarCaptchaBuilder
2018
{
21-
/**
22-
* @var false|int
23-
*/
24-
protected $background = false;
2519
/**
2620
* Writes the phrase on the image
2721
*/
@@ -60,26 +54,4 @@ protected function writePhrase($image, $phrase, $font, $width, $height)
6054

6155
return $col;
6256
}
63-
64-
65-
/**
66-
* Returns a random number or the next number in the
67-
* fingerprint
68-
*/
69-
protected function rand($min, $max)
70-
{
71-
if (!is_array($this->fingerprint)) {
72-
$this->fingerprint = array();
73-
}
74-
75-
if ($this->useFingerprint) {
76-
$value = current($this->fingerprint);
77-
next($this->fingerprint);
78-
} else {
79-
$value = mt_rand((int) $min, (int) $max);
80-
$this->fingerprint[] = $value;
81-
}
82-
83-
return $value;
84-
}
8557
}

tests/Unit/StandaloneBouncerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
* @covers \CrowdSecBouncer\StandaloneBouncer::getPostedVariable
6161
* @covers \CrowdSecBouncer\AbstractBouncer::checkCaptcha
6262
* @covers \CrowdSecBouncer\AbstractBouncer::buildCaptchaCouple
63-
* @covers \CrowdSecBouncer\Fixes\Gregwar\Captcha\CaptchaBuilder::rand
6463
* @covers \CrowdSecBouncer\Fixes\Gregwar\Captcha\CaptchaBuilder::writePhrase
6564
* @covers \CrowdSecBouncer\AbstractBouncer::getCache
6665
* @covers \CrowdSecBouncer\AbstractBouncer::getBanHtml

0 commit comments

Comments
 (0)