Merge branch 'PHP-8.1' into PHP-8.2

This commit is contained in:
Jakub Zelenka 2023-08-28 12:15:33 +01:00
commit 038bbd2d2f
No known key found for this signature in database
GPG key ID: 1C0779DC5C0A9DE4

View file

@ -590,6 +590,8 @@ $all_stat_keys = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
"rdev", "size", "atime", "mtime", "ctime",
"blksize", "blocks");
$stat_time_diff_keys = array(8, 'atime');
function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
// dump the stat if requested
if ( $flag == true ) {
@ -606,8 +608,13 @@ function compare_stats($stat1, $stat2, $fields, $op = "==", $flag = false ) {
{
case "==":
if ( $stat1[ $fields[$index] ] != $stat2[ $fields[$index] ] ) {
$result = false;
echo "Error: stat1 do not match with stat2 at key value: $fields[$index]\n";
if ( ! in_array( $index, $stat_time_diff_keys ) ) {
$result = false;
echo "Error: stat1 do not match with stat2 at key value: $fields[$index]\n";
} elseif (abs($stat1[ $fields[$index] ] - $stat2[ $fields[$index] ]) > 1) {
$result = false;
echo "Error: stat1 differs too much from stat2 at key value: $fields[$index]\n";
}
}
break;