Skip to content

Commit 341014c

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Make bug70417.phpt less flaky
2 parents 9b23fb2 + 79dd8f2 commit 341014c

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

ext/phar/tests/tar/bug70417.phpt

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,17 @@ Bug #70417 (PharData::compress() doesn't close temp file)
33
--EXTENSIONS--
44
phar
55
zlib
6-
--SKIPIF--
7-
<?php
8-
9-
exec('lsof -p ' . getmypid(), $out, $status);
10-
if ($status !== 0) {
11-
die("skip lsof(8) not available");
12-
}
13-
if (!str_starts_with($out[0], 'COMMAND')) {
14-
die("skip Might be a different lsof");
15-
}
16-
?>
176
--FILE--
187
<?php
19-
function countOpenFiles() {
20-
exec('lsof -p ' . escapeshellarg(getmypid()) . ' 2> /dev/null', $out); // Note: valgrind can produce false positives for /usr/bin/lsof
21-
return count($out);
22-
}
238
$filename = __DIR__ . '/bug70417.tar';
249
@unlink("$filename.gz");
25-
$openFiles1 = countOpenFiles();
10+
$resBefore = count(get_resources());
2611
$arch = new PharData($filename);
2712
$arch->addFromString('foo', 'bar');
2813
$arch->compress(Phar::GZ);
2914
unset($arch);
30-
$openFiles2 = countOpenFiles();
31-
var_dump($openFiles1 === $openFiles2);
15+
$resAfter = count(get_resources());
16+
var_dump($resBefore === $resAfter);
3217
?>
3318
--CLEAN--
3419
<?php

0 commit comments

Comments
 (0)