1--TEST-- 2Test stat() function: error conditions 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die('skip.. only for Windows'); 7} 8?> 9--FILE-- 10<?php 11/* 12 Prototype: array stat ( string $filename ); 13 Description: Gives information about a file 14*/ 15 16$file_path = __DIR__; 17$arr = array(__FILE__); 18 19echo "\n*** Testing stat() for error conditions ***\n"; 20var_dump( stat() ); // args < expected 21var_dump( stat(__FILE__, 2) ); // file, args > expected 22var_dump( stat(__DIR__, 2) ); //dir, args > expected 23 24var_dump( stat("$file_path/temp.tmp") ); // non existing file 25var_dump( stat("$file_path/temp/") ); // non existing dir 26var_dump( stat(22) ); // scalar argument 27var_dump( stat($arr) ); // array argument 28 29echo "Done\n"; 30?> 31--EXPECTF-- 32*** Testing stat() for error conditions *** 33 34Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d 35NULL 36 37Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d 38NULL 39 40Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d 41NULL 42 43Warning: stat(): stat failed for %s in %s on line %d 44bool(false) 45 46Warning: stat(): stat failed for %s in %s on line %d 47bool(false) 48 49Warning: stat(): stat failed for 22 in %s on line %d 50bool(false) 51 52Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d 53NULL 54Done 55