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) { 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