Annotation of embedaddon/php/ext/standard/tests/file/lstat_stat_error.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test lstat() and stat() functions: error conditions
                      3: --SKIPIF--
                      4: <?php
                      5: if (substr(PHP_OS, 0, 3) == 'WIN') {
                      6:     die('skip.. lstat() not available on Windows');
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: /* Prototype: array lstat ( string $filename );
                     12:    Description: Gives information about a file or symbolic link
                     13: 
                     14:    Prototype: array stat ( string $filename );
                     15:    Description: Gives information about a file
                     16: */
                     17: 
                     18: echo "*** Testing lstat() for error conditions ***\n";
                     19: $file_path = dirname(__FILE__); 
                     20: var_dump( lstat() );  // args < expected
                     21: var_dump( lstat(__FILE__, 2) );  // args > expected
                     22: var_dump( lstat("$file_path/temp.tmp") ); // non existing file
                     23: var_dump( lstat(22) ); // scalar argument
                     24: $arr = array(__FILE__);
                     25: var_dump( lstat($arr) ); // array argument
                     26: 
                     27: echo "\n*** Testing stat() for error conditions ***\n";
                     28: var_dump( stat() );  // args < expected
                     29: var_dump( stat(__FILE__, 2) );  // file, args > expected
                     30: var_dump( stat(dirname(__FILE__), 2) );  //dir, args > expected
                     31: 
                     32: var_dump( stat("$file_path/temp.tmp") ); // non existing file
                     33: var_dump( stat("$file_path/temp/") ); // non existing dir
                     34: var_dump( stat(22) ); // scalar argument
                     35: var_dump( stat($arr) ); // array argument
                     36: 
                     37: echo "Done\n";
                     38: ?>
                     39: --EXPECTF--
                     40: *** Testing lstat() for error conditions ***
                     41: 
                     42: Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d
                     43: NULL
                     44: 
                     45: Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d
                     46: NULL
                     47: 
                     48: Warning: lstat(): Lstat failed for %s in %s on line %d
                     49: bool(false)
                     50: 
                     51: Warning: lstat(): Lstat failed for 22 in %s on line %d
                     52: bool(false)
                     53: 
1.1.1.2 ! misho      54: Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d
1.1       misho      55: NULL
                     56: 
                     57: *** Testing stat() for error conditions ***
                     58: 
                     59: Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
                     60: NULL
                     61: 
                     62: Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
                     63: NULL
                     64: 
                     65: Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
                     66: NULL
                     67: 
                     68: Warning: stat(): stat failed for %s in %s on line %d
                     69: bool(false)
                     70: 
                     71: Warning: stat(): stat failed for %s in %s on line %d
                     72: bool(false)
                     73: 
                     74: Warning: stat(): stat failed for 22 in %s on line %d
                     75: bool(false)
                     76: 
1.1.1.2 ! misho      77: Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
1.1       misho      78: NULL
                     79: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>