Skip to content

Commit d4525e5

Browse files
committed
Add support for PHP 8.4 and librdkafka 2.4.0, 2.5.0, 2.5.3, 2.6.0
1 parent c89ff42 commit d4525e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5799
-697
lines changed

.github/workflows/test-extension-compatibility.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ jobs:
1414
php:
1515
- '8.1'
1616
librdkafka:
17-
- 'v1.9.2'
17+
- 'v2.6.0'
1818
rdkafka:
1919
- '6.x'
2020
services:
2121
zookeeper:
22-
image: confluentinc/cp-zookeeper:7.5.3
22+
image: confluentinc/cp-zookeeper:7.7.1
2323
ports:
2424
- 2181:2181
2525
env:
2626
ZOOKEEPER_CLIENT_PORT: 2181
2727
ZOOKEEPER_TICK_TIME: 2000
2828
kafka:
29-
image: confluentinc/cp-kafka:7.5.3
29+
image: confluentinc/cp-kafka:7.7.1
3030
ports:
3131
- 9092:9092
3232
env:

.github/workflows/test-macos.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- '8.1'
1616
- '8.2'
1717
- '8.3'
18+
- '8.4'
1819
defaults:
1920
run:
2021
shell: bash
@@ -46,7 +47,7 @@ jobs:
4647
php-version: ${{ matrix.php }}
4748
coverage: none
4849
extensions: ffi, pcntl
49-
ini-values: "${{ matrix.php == '8.3' && 'zend.max_allowed_stack_size=256k' || '' }}"
50+
ini-values: "${{ (matrix.php == '8.3' || matrix.php == '8.4') && 'zend.max_allowed_stack_size=256k' || '' }}"
5051

5152
- name: Install dependencies
5253
uses: ramsey/composer-install@v2

.github/workflows/test-windows.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ jobs:
1515
- '8.1'
1616
- '8.2'
1717
- '8.3'
18+
- '8.4'
1819
librdkafka:
19-
- '2.3.0'
20+
- '2.6.0'
2021
defaults:
2122
run:
2223
shell: bash
@@ -35,9 +36,9 @@ jobs:
3536
run: |
3637
nuget install librdkafka.redist -Version ${{ matrix.librdkafka }}
3738
choco install --no-progress wget nssm
38-
wget -q -O kafka_2.13-3.6.1.tgz http://ftp.fau.de/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz
39-
tar -xzf kafka_2.13-3.6.1.tgz
40-
cp -pr kafka_2.13-3.6.1 /c/kafka
39+
wget -q -O kafka_2.13-3.8.0.tgz http://ftp.fau.de/apache/kafka/3.8.0/kafka_2.13-3.8.0.tgz
40+
tar -xzf kafka_2.13-3.8.0.tgz
41+
cp -pr kafka_2.13-3.8.0 /c/kafka
4142
sed -i "s|broker.id=0|broker.id=111|g" /c/kafka/config/server.properties
4243
nssm install zookeeper /c/kafka/bin/windows/zookeeper-server-start.bat /c/kafka/config/zookeeper.properties
4344
nssm set zookeeper AppExit Default Exit

.github/workflows/test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@ jobs:
1313
matrix:
1414
include:
1515
- php: '8.1'
16-
librdkafka: 'v2.3.0'
16+
librdkafka: 'v2.6.0'
1717
publish: true
1818
exclude:
1919
- php: '8.1'
20-
librdkafka: 'v2.3.0'
20+
librdkafka: 'v2.6.0'
2121
publish: false
2222
php:
2323
- '7.4'
2424
- '8.0'
2525
- '8.1'
2626
- '8.2'
2727
- '8.3'
28+
- '8.4'
2829
librdkafka:
30+
- 'v2.6.0'
31+
- 'v2.5.3'
32+
- 'v2.4.0'
2933
- 'v2.3.0'
3034
- 'v2.2.0'
3135
- 'v2.1.1'
@@ -46,14 +50,14 @@ jobs:
4650
continue-on-error: ${{ matrix.librdkafka == 'master' }}
4751
services:
4852
zookeeper:
49-
image: confluentinc/cp-zookeeper:7.5.3
53+
image: confluentinc/cp-zookeeper:7.7.1
5054
ports:
5155
- 2181:2181
5256
env:
5357
ZOOKEEPER_CLIENT_PORT: 2181
5458
ZOOKEEPER_TICK_TIME: 2000
5559
kafka:
56-
image: confluentinc/cp-kafka:7.5.3
60+
image: confluentinc/cp-kafka:7.7.1
5761
ports:
5862
- 9092:9092
5963
env:

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77

88
## [0.6.0]
99

10+
This pre-release improves compatible with the [PHP RdKafka extension](https://github.com/arnaud-lb/php-rdkafka) ^5.0 and ^6.0.
11+
1012
### Added
1113

12-
- Add support for PHP 8.3 and librdkafka 2.1.0, 2.1.1, 2.2.0, 2.3.0
14+
- Add support for PHP 8.3 and 8.4
15+
- Add support for librdkafka 2.1.0, 2.1.1, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.5.3, 2.6.0
1316

1417
### Fixed
1518

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"ext-rdkafka": "*"
4343
},
4444
"require-dev": {
45-
"phpunit/phpunit": "^9.4",
45+
"phpunit/phpunit": "^9.4 || ^10.5",
4646
"ircmaxell/php-c-parser": "dev-master#fd8f5efefd0fcc6c5119d945694acaa3a6790ada",
4747
"symplify/easy-coding-standard": "^12.0",
4848
"klitsche/ffigen": "0.8.1",

docker-compose.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
version: '3'
2-
31
networks:
42
php-rdkafka-ffi:
53

64
services:
75
zookeeper:
8-
image: confluentinc/cp-zookeeper:7.5.3
6+
image: confluentinc/cp-zookeeper:7.7.1
97
ports:
108
- 2181:2181
119
environment:
@@ -15,7 +13,7 @@ services:
1513
- php-rdkafka-ffi
1614

1715
kafka:
18-
image: confluentinc/cp-kafka:7.5.3
16+
image: confluentinc/cp-kafka:7.7.1
1917
ports:
2018
- 9092:9092
2119
hostname: kafka
@@ -102,6 +100,18 @@ services:
102100
networks:
103101
- php-rdkafka-ffi
104102

103+
php84:
104+
build:
105+
context: resources/docker/php84-librdkafka-ffi
106+
image: php84-librdkafka-ffi:latest
107+
volumes:
108+
- .:/app
109+
- ./resources/docker/php84-librdkafka-ffi/php.ini:/usr/local/etc/php/php.ini
110+
depends_on:
111+
- kafka
112+
networks:
113+
- php-rdkafka-ffi
114+
105115
mkdocs:
106116
build:
107117
context: resources/docker/mkdocs-material

resources/docker/php74-librdkafka-ffi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM php:7.4-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.3.0
4+
ARG LIBRDKAFKA_VERSION=v2.6.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \

resources/docker/php80-librdkafka-ffi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM php:8.0-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.3.0
4+
ARG LIBRDKAFKA_VERSION=v2.6.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \

resources/docker/php81-librdkafka-ffi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM php:8.1-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.3.0
4+
ARG LIBRDKAFKA_VERSION=v2.6.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \

resources/docker/php82-librdkafka-ffi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM php:8.2-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.3.0
4+
ARG LIBRDKAFKA_VERSION=v2.6.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \

resources/docker/php83-librdkafka-ffi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM php:8.3-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.3.0
4+
ARG LIBRDKAFKA_VERSION=v2.6.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM php:8.4-rc-cli
2+
3+
# enable ffi and install librdkafka
4+
ARG LIBRDKAFKA_VERSION=v2.6.0
5+
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
6+
RUN set -e; \
7+
apt-get update; \
8+
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev libc6-dev; \
9+
docker-php-ext-configure ffi; \
10+
docker-php-ext-install -j$(nproc) ffi pcntl; \
11+
git clone --branch "${LIBRDKAFKA_VERSION}" --depth 1 https://github.com/confluentinc/librdkafka.git /tmp/librdkafka; \
12+
cd /tmp/librdkafka; \
13+
./configure; \
14+
make; \
15+
make install; \
16+
ldconfig; \
17+
apt-get autoremove -y; \
18+
rm -rf /var/lib/apt/lists/*; \
19+
rm -rf /tmp/*;
20+
21+
# install xdebug
22+
ARG XDEBUG_VERSION=beta
23+
RUN pecl install xdebug-${XDEBUG_VERSION}; \
24+
docker-php-ext-enable xdebug;
25+
26+
# install rdkafka ext - this is just required to run the compatibility tests
27+
ARG RDKAFKA_EXT_VERSION=6.x
28+
RUN git clone --branch "$RDKAFKA_EXT_VERSION" --depth 1 https://github.com/arnaud-lb/php-rdkafka.git /tmp/php-rdkafka; \
29+
cd /tmp/php-rdkafka; \
30+
phpize; \
31+
./configure; \
32+
make; \
33+
make install; \
34+
rm -rf /tmp/*;
35+
36+
ENV COMPOSER_HOME /tmp
37+
ENV COMPOSER_ALLOW_SUPERUSER 1
38+
COPY --from=composer /usr/bin/composer /usr/bin/composer
39+
40+
RUN useradd -Ms /bin/bash --user-group --uid 2000 phpdev; \
41+
mkdir /app; \
42+
chown phpdev -R /app; \
43+
chown phpdev -R /tmp;
44+
45+
USER phpdev
46+
47+
WORKDIR /app
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zend.max_allowed_stack_size=256k

resources/ffigen/LibrdkafkaHeaderFiles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class LibrdkafkaHeaderFiles
1212
{
13-
private const RELEASE_URL = 'https://api.github.com/repos/confluentinc/librdkafka/releases';
13+
private const RELEASE_URL = 'https://api.github.com/repos/confluentinc/librdkafka/releases?per_page=100';
1414
private const DOWNLOAD_BASE_URL_TEMPLATE = 'https://raw.githubusercontent.com/confluentinc/librdkafka/%s/src';
1515

1616
private ConfigInterface $config;
@@ -94,7 +94,7 @@ private function loadSupportedVersions(): array
9494
foreach ($releases as $release) {
9595
if ($release->prerelease === false) {
9696
$version = str_replace('v', '', $release->tag_name);
97-
if (Comparator::greaterThanOrEqualTo($version, '1.0.0') && Comparator::lessThan($version, '2.4.0')) {
97+
if (Comparator::greaterThanOrEqualTo($version, '1.0.0') && Comparator::lessThan($version, '2.7.0')) {
9898
$supportedVersions[$version] = sprintf(
9999
self::DOWNLOAD_BASE_URL_TEMPLATE,
100100
$release->tag_name

src/RdKafka/FFI/Library.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Library
2727
use Methods;
2828

2929
public const VERSION_AUTODETECT = '';
30-
public const VERSION_LATEST = '2.3.0';
30+
public const VERSION_LATEST = '2.6.0';
3131
public const PHP_LIBRARY_VERSION = '0.6.0';
3232

3333
private static FFI $ffi;

0 commit comments

Comments
 (0)