1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00

Change conditional check in disk_free_space() test

As the notion of free space is fuzzy on some filesystems (such as BTRFS)
we check that the disk space after adding a file is less or equal than before

This closes Bug #80629
This commit is contained in:
George Peter Banyard
2022-11-09 17:20:04 +00:00
parent dbf54e1a8b
commit bab9e349cb
@@ -17,7 +17,7 @@ var_dump( diskfreespace($file_path) );
echo "*** Testing with newly created directory ***\n";
$dir = "/disk_free_space";
mkdir($file_path.$dir);
echo" \n Free Space before writing to a file\n";
echo "\n Free Space before writing to a file\n";
$space1 = disk_free_space($file_path.$dir);
var_dump( $space1 );
@@ -30,7 +30,8 @@ echo "\n Free Space after writing to a file\n";
$space2 = disk_free_space($file_path.$dir);
var_dump( $space2 );
if($space1 > $space2 )
// Some file systems (like BTRFS) have a fuzzy notion of "free space" and will thus claim the same amount of free space
if ($space1 >= $space2)
echo "\n Free Space Value Is Correct\n";
else {
echo "\n Free Space Value Is Incorrect\n";
@@ -53,7 +54,7 @@ rmdir($file_path."/disk_free_space");
float(%f)
float(%f)
*** Testing with newly created directory ***
Free Space before writing to a file
float(%f)