Skip to content

Commit e38c6e2

Browse files
Merge pull request #82 from julienloizelet/feat/memcached-php-8-1
Feat/memcached php 8 1
2 parents a9ac080 + 5e7d033 commit e38c6e2

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

.github/workflows/test-suite.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
ddev --version
6363
ddev exec php -v
6464
ddev exec -s crowdsec crowdsec -version
65+
ddev php -r "echo phpversion('memcached');"
6566
6667
- name: Clone PHP lib Crowdsec files
6768
uses: actions/checkout@v2
@@ -87,9 +88,12 @@ jobs:
8788
tar -xf GeoLite2-City.tar.gz
8889
rm GeoLite2-Country.tar.gz GeoLite2-Country.tar.gz.sha256.txt GeoLite2-City.tar.gz GeoLite2-City.tar.gz.sha256.txt
8990
90-
- name: Run PHP UNIT tests
91+
- name: Run PHP UNIT tests (IP verification)
9192
run: |
9293
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} LAPI_URL=http://crowdsec:8080 MEMCACHED_DSN=memcached://memcached:11211 REDIS_DSN=redis://redis:6379 /usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/IpVerificationTest.php
94+
95+
- name: Run PHP UNIT tests (Geolocation)
96+
run: |
9397
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} LAPI_URL=http://crowdsec:8080 /usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/GeolocationTest.php
9498
9599
- name: Prepare Standalone Bouncer end-to-end tests

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
![Version](https://img.shields.io/github/v/release/crowdsecurity/php-cs-bouncer?include_prereleases)
88
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=crowdsecurity_php-cs-bouncer&metric=alert_status)](https://sonarcloud.io/dashboard?id=crowdsecurity_php-cs-bouncer)
9-
![Build Status](https://img.shields.io/github/workflow/status/crowdsecurity/php-cs-bouncer/tests/main)
9+
[![Test suite](https://github.com/crowdsecurity/php-cs-bouncer/actions/workflows/test-suite.yml/badge.svg)](https://github.com/crowdsecurity/php-cs-bouncer/actions/workflows/test-suite.yml)
1010
![Licence](https://img.shields.io/github/license/crowdsecurity/php-cs-bouncer)
1111

1212

docs/TECHNICAL_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ To get a robust library and not provide security bug unmaintained, we use [compo
6363
The oldest PHP version compatible with these libraries is PHP 7.2.x.
6464

6565

66+
### Memcached and PHP 8.x
67+
68+
In order to use Memcached with a PHP 8.x set up, you must have an installed version of the memcached php extension > 3.1.5. To check what is your current version, you could run :
69+
70+
`php -r "echo phpversion('memcached');"`
71+

tests/TestHelpers.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,7 @@ public static function cacheAdapterProvider(): array
4949
$redisCacheAdapterDsn = getenv('REDIS_DSN');
5050
$redisClient = RedisAdapter::createConnection($redisCacheAdapterDsn);
5151
$redisAdapter = new RedisAdapter($redisClient);
52-
53-
// memcached version 3.1.5 is not ready for PHP 8.1
54-
if (\PHP_VERSION_ID >= 80100 && version_compare(phpversion('memcached'), '3.1.5', '<=')) {
55-
return [
56-
'PhpFilesAdapter' => [$phpFilesAdapter],
57-
'RedisAdapter' => [$redisAdapter],
58-
];
59-
}
52+
6053
/** @var string */
6154
$memcachedCacheAdapterDsn = getenv('MEMCACHED_DSN');
6255
$memcachedAdapter = new MemcachedAdapter(MemcachedAdapter::createConnection($memcachedCacheAdapterDsn));

0 commit comments

Comments
 (0)