1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

fileinfo: Stop calling finfo_close() in tests (#18405)

This function is a noop and will be proposed for deprecation. This patch
removes the useless calls.
This commit is contained in:
Tim Düsterhus
2025-04-23 18:57:32 +02:00
committed by GitHub
parent 0e1bbf9259
commit 7831f65f83
11 changed files with 0 additions and 15 deletions

View File

@@ -7,7 +7,6 @@ fileinfo
$filename = __DIR__ . '/bug79756.xls';
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_file($finfo, $filename);
finfo_close($finfo);
echo $mime;
?>
--EXPECT--

View File

@@ -15,13 +15,11 @@ $m = "0 byte x\n".
file_put_contents($fd, $a);
$fi = finfo_open(FILEINFO_NONE);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
file_put_contents($fd, $b);
file_put_contents($fm, $m);
$fi = finfo_open(FILEINFO_NONE, $fm);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
?>
Done
--CLEAN--

View File

@@ -15,13 +15,11 @@ $m = "0 byte x\n".
file_put_contents($fd, $a);
$fi = finfo_open(FILEINFO_NONE);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
file_put_contents($fd, $b);
file_put_contents($fm, $m);
$fi = finfo_open(FILEINFO_NONE, $fm);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
?>
Done
--CLEAN--

View File

@@ -19,7 +19,6 @@ $fi = finfo_open(FILEINFO_NONE);
$t = microtime(true);
var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 3) {
echo "Ok\n";
} else {

View File

@@ -23,7 +23,6 @@ $fi = finfo_open(FILEINFO_NONE);
$t = microtime(true);
var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 1.5) {
echo "Ok\n";
} else {

View File

@@ -19,7 +19,6 @@ $fi = finfo_open(FILEINFO_NONE);
$t = microtime(true);
var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 1.5) {
echo "Ok\n";
} else {

View File

@@ -27,7 +27,6 @@ foreach( $options as $option ) {
foreach( $buffers as $string ) {
var_dump( finfo_buffer( $finfo, $string, $option ) );
}
finfo_close( $finfo );
}
?>

View File

@@ -27,7 +27,6 @@ foreach( $options as $option ) {
foreach( $buffers as $string ) {
var_dump( finfo_buffer( $finfo, $string, $option ) );
}
finfo_close( $finfo );
}
?>

View File

@@ -12,8 +12,6 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );

View File

@@ -12,8 +12,6 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );

View File

@@ -18,7 +18,6 @@ foreach($lst as $p) {
if ($i !== $exp) {
echo "'$p' failed\nexp: '$exp'\ngot: '$i'\n";
}
finfo_close($finfo);
}
echo "==DONE==";