From 2d0c76b165fcb3fdb822e875a88c49d772b4f83a Mon Sep 17 00:00:00 2001 From: NickSdot Date: Wed, 29 Jul 2026 02:01:42 +0700 Subject: [PATCH 1/2] Clean up IPC objects in arginfo mismatch test --- Zend/tests/arginfo_zpp_mismatch.phpt | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index d7aefc6f374f..94f6b070900e 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -10,6 +10,36 @@ if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions") require __DIR__ . "/arginfo_zpp_mismatch.inc"; +function testWeakSysvIpcFunction($function): bool { + if (!in_array($function, ['msg_queue_exists', 'msg_get_queue', 'sem_get', 'shm_attach'], true)) { + return false; + } + + for ($argumentCount = 0; $argumentCount <= 8; $argumentCount++) { + $arguments = array_fill(0, $argumentCount, null); + if ($function === 'msg_queue_exists' && $argumentCount >= 1) { + $arguments[0] = 1; + } + if (($function === 'sem_get' || $function === 'shm_attach') && $argumentCount >= 3) { + $arguments[2] = 0600; + } + + try { + $result = @$function(...$arguments); + if ($result instanceof SysvMessageQueue) { + msg_remove_queue($result); + } elseif ($result instanceof SysvSemaphore) { + sem_remove($result); + } elseif ($result instanceof SysvSharedMemory) { + shm_remove($result); + } + } catch (Throwable) { + } + } + + return true; +} + function test($function) { if (skipFunction($function)) { return; @@ -21,6 +51,10 @@ function test($function) { } else { echo "Testing " . get_class($function[0]) . "::$function[1]\n"; } + if (testWeakSysvIpcFunction($function)) { + ob_end_clean(); + return; + } try { @$function(); } catch (Throwable) { From ab7526bfae5f5e36867ae855ce0f986d994a25f1 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Wed, 29 Jul 2026 02:03:20 +0700 Subject: [PATCH 2/2] Fix GH-16592 test leaking a message queue --- ext/sysvmsg/tests/gh16592.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/sysvmsg/tests/gh16592.phpt b/ext/sysvmsg/tests/gh16592.phpt index 8490d000f891..f5b8119ef8d8 100644 --- a/ext/sysvmsg/tests/gh16592.phpt +++ b/ext/sysvmsg/tests/gh16592.phpt @@ -8,12 +8,14 @@ class Test { function __serialize() {} } -$q = msg_get_queue(1); +// use a private queue, so we only remove our own. +$q = msg_get_queue(0, 0600); try { msg_send($q, 1, new Test, true); } catch (\TypeError $e) { echo $e->getMessage(); } +msg_remove_queue($q); ?> --EXPECT-- Test::__serialize() must return an array