1--TEST-- 2Test function fstat() by calling it with its expected arguments 3--FILE-- 4<?php 5$stat_result = stat(__FILE__); 6clearstatcache(); 7$fp = fopen (__FILE__, 'r'); 8$fstat_result = fstat($fp); 9fclose($fp); 10 11$isWin = (substr(PHP_OS, 0, 3) == 'WIN'); 12$failed = false; 13foreach($stat_result as $key =>$value) { 14 if ($isWin && ($key === 0 || $key === 6 || $key === 'dev' || $key === 'rdev')) { 15 // windows, dev and rdev will not match this is expected 16 } 17 else { 18 if ($fstat_result[$key] != $value) { 19 echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n"; 20 $failed = true; 21 } 22 } 23} 24if ($failed !== true) { 25 echo "PASSED: all elements are the same\n"; 26} 27 28 29?> 30--EXPECT-- 31PASSED: all elements are the same 32