From 4f58133972e849981053400d49f3cfe1f4290a8c Mon Sep 17 00:00:00 2001 From: Chingis S Date: Mon, 9 Nov 2026 15:35:16 +0300 Subject: [PATCH] Add the bundled System V IPC extensions Enable sysvsem, sysvshm, and sysvmsg in the PHP 8 images. They ship with PHP and need no extra libraries. Production images remove the PHP sources and build tools, so they cannot be added downstream. Nextcloud uses sysvsem to limit concurrent preview generation and warns when it is missing. Debian and Ubuntu PHP packages enable all three by default. Add them to the expected module lists and add functional checks for a message round trip, an exclusive semaphore, and shared memory. --- 8/Dockerfile | 3 +++ 8/tests/README.md | 1 + 8/tests/functional/local.php | 20 ++++++++++++++++++++ 8/tests/php_modules/8.2 | 3 +++ 8/tests/php_modules/8.3 | 3 +++ 8/tests/php_modules/8.4 | 3 +++ 8/tests/php_modules/8.5 | 3 +++ README.md | 3 +++ 8 files changed, 39 insertions(+) diff --git a/8/Dockerfile b/8/Dockerfile index d7753758..b315f731 100644 --- a/8/Dockerfile +++ b/8/Dockerfile @@ -258,6 +258,9 @@ RUN --mount=type=secret,id=composer_auth set -xe; \ pgsql \ soap \ sockets \ + sysvmsg \ + sysvsem \ + sysvshm \ tidy \ xsl \ zip; \ diff --git a/8/tests/README.md b/8/tests/README.md index 966c5254..24dfa641 100644 --- a/8/tests/README.md +++ b/8/tests/README.md @@ -26,6 +26,7 @@ tests for every extension formerly installed through PECL: | rdkafka | Produce a Kafka message, confirm delivery, and consume its payload/key | | smbclient | Authenticate and write, read, and delete a file on a Samba share | | sqlsrv, pdo_sqlsrv | Create temporary tables, execute parameterized inserts, and fetch rows from SQL Server | +| sysvmsg, sysvsem, sysvshm | Send and receive a queued message; hold a single-holder semaphore and refuse a second holder; write and read shared memory | SQL Server integration runs only on **amd64**. Microsoft's Linux server container [requires x86-64](https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker). diff --git a/8/tests/functional/local.php b/8/tests/functional/local.php index 4f76213a..2a9c2167 100644 --- a/8/tests/functional/local.php +++ b/8/tests/functional/local.php @@ -94,6 +94,26 @@ $copy->mergeFromJsonString('42'); verify($copy->getNumberValue() === 42.0, 'Protobuf JSON decoding failed'); }); +runTest('sysvmsg', function () { + $queue = msg_get_queue(ftok(__FILE__, 'm')); + verify(msg_send($queue, 1, ['answer' => 42]), 'System V message send failed'); + verify(msg_receive($queue, 1, $type, 1024, $message, true, MSG_IPC_NOWAIT), 'System V message receive failed'); + verify($type === 1 && $message === ['answer' => 42], 'System V message changed'); + verify(msg_remove_queue($queue), 'System V message queue removal failed'); +}); +runTest('sysvsem', function () { + $semaphore = sem_get(ftok(__FILE__, 's'), 1); + verify(sem_acquire($semaphore), 'System V semaphore acquire failed'); + verify(!sem_acquire($semaphore, true), 'System V semaphore allowed a second holder'); + verify(sem_release($semaphore), 'System V semaphore release failed'); + verify(sem_remove($semaphore), 'System V semaphore removal failed'); +}); +runTest('sysvshm', function () { + $memory = shm_attach(ftok(__FILE__, 'h'), 10000); + verify(shm_put_var($memory, 1, ['answer' => 42]), 'System V shared memory write failed'); + verify(shm_has_var($memory, 1) && shm_get_var($memory, 1) === ['answer' => 42], 'System V shared memory read failed'); + verify(shm_remove($memory), 'System V shared memory removal failed'); +}); runTest('uuid', function () { $id = uuid_create(UUID_TYPE_RANDOM); verify(uuid_is_valid($id) && uuid_type($id) === UUID_TYPE_RANDOM, 'UUID generation failed'); diff --git a/8/tests/php_modules/8.2 b/8/tests/php_modules/8.2 index 81c7957f..97f169d9 100644 --- a/8/tests/php_modules/8.2 +++ b/8/tests/php_modules/8.2 @@ -67,6 +67,9 @@ SPX sqlite3 sqlsrv standard +sysvmsg +sysvsem +sysvshm tidy tokenizer uploadprogress diff --git a/8/tests/php_modules/8.3 b/8/tests/php_modules/8.3 index 81c7957f..97f169d9 100644 --- a/8/tests/php_modules/8.3 +++ b/8/tests/php_modules/8.3 @@ -67,6 +67,9 @@ SPX sqlite3 sqlsrv standard +sysvmsg +sysvsem +sysvshm tidy tokenizer uploadprogress diff --git a/8/tests/php_modules/8.4 b/8/tests/php_modules/8.4 index 81c7957f..97f169d9 100644 --- a/8/tests/php_modules/8.4 +++ b/8/tests/php_modules/8.4 @@ -67,6 +67,9 @@ SPX sqlite3 sqlsrv standard +sysvmsg +sysvsem +sysvshm tidy tokenizer uploadprogress diff --git a/8/tests/php_modules/8.5 b/8/tests/php_modules/8.5 index 7e1a855f..9d04f7f3 100644 --- a/8/tests/php_modules/8.5 +++ b/8/tests/php_modules/8.5 @@ -68,6 +68,9 @@ SPX sqlite3 sqlsrv standard +sysvmsg +sysvsem +sysvshm tidy tokenizer uploadprogress diff --git a/README.md b/README.md index 506a939d..bf851bd8 100644 --- a/README.md +++ b/README.md @@ -407,6 +407,9 @@ a release archive on PHP 8.4/8.5. | sqlite3 | | | | | | [sqlsrv] | 5.13.3 | 5.13.3 | 5.13.3 | 5.12.0 | | standard | | | | | +| sysvmsg | | | | | +| sysvsem | | | | | +| sysvshm | | | | | | tidy | | | | | | tokenizer | | | | | | [uploadprogress] | 2.0.2 | 2.0.2 | 2.0.2 | 2.0.2 |