Commit 2bf24119769 for php.net
commit 2bf2411976951c5a316e2c1c3e6e8a6ef85729dc
Author: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Date: Sat Oct 25 11:15:34 2025 +0200
Make bug70417.phpt less flaky
Closes GH-20287.
(cherry picked from commit ed9529a7d3c1f5dfbf16c2d388d944af8ec86a76)
diff --git a/ext/phar/tests/tar/bug70417.phpt b/ext/phar/tests/tar/bug70417.phpt
index 4d98a18954c..504d7e1e387 100644
--- a/ext/phar/tests/tar/bug70417.phpt
+++ b/ext/phar/tests/tar/bug70417.phpt
@@ -3,32 +3,17 @@
--EXTENSIONS--
phar
zlib
---SKIPIF--
-<?php
-
-exec('lsof -p ' . getmypid(), $out, $status);
-if ($status !== 0) {
- die("skip lsof(8) not available");
-}
-if (!str_starts_with($out[0], 'COMMAND')) {
- die("skip Might be a different lsof");
-}
-?>
--FILE--
<?php
-function countOpenFiles() {
- exec('lsof -p ' . escapeshellarg(getmypid()) . ' 2> /dev/null', $out); // Note: valgrind can produce false positives for /usr/bin/lsof
- return count($out);
-}
$filename = __DIR__ . '/bug70417.tar';
@unlink("$filename.gz");
-$openFiles1 = countOpenFiles();
+$resBefore = count(get_resources());
$arch = new PharData($filename);
$arch->addFromString('foo', 'bar');
$arch->compress(Phar::GZ);
unset($arch);
-$openFiles2 = countOpenFiles();
-var_dump($openFiles1 === $openFiles2);
+$resAfter = count(get_resources());
+var_dump($resBefore === $resAfter);
?>
--CLEAN--
<?php