diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index 0292bea1182..d4ad02a363b 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -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;