Annotation of embedaddon/php/ext/standard/tests/file/readfile_variation10.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test readfile() function : variation - various invalid paths
! 3: --CREDITS--
! 4: Dave Kelsey <d_kelsey@uk.ibm.com>
! 5: --SKIPIF--
! 6: <?php
! 7: if(substr(PHP_OS, 0, 3) == "WIN")
! 8: die("skip Not for Windows");
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: /* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
! 13: * Description: Output a file or a URL
! 14: * Source code: ext/standard/file.c
! 15: * Alias to functions:
! 16: */
! 17:
! 18: echo "*** Testing readfile() : variation ***\n";
! 19:
! 20:
! 21: /* An array of files */
! 22: $names_arr = array(
! 23: /* Invalid args */
! 24: -1,
! 25: TRUE,
! 26: FALSE,
! 27: NULL,
! 28: "",
! 29: " ",
! 30: "\0",
! 31: array(),
! 32:
! 33: /* prefix with path separator of a non existing directory*/
! 34: "/no/such/file/dir",
! 35: "php/php"
! 36:
! 37: );
! 38:
! 39: for( $i=0; $i<count($names_arr); $i++ ) {
! 40: $name = $names_arr[$i];
! 41: echo "-- testing '$name' --\n";
! 42: var_dump(readfile($name));
! 43: }
! 44:
! 45: echo "\n*** Done ***\n";
! 46: ?>
! 47: --EXPECTF--
! 48: *** Testing readfile() : variation ***
! 49: -- testing '-1' --
! 50:
! 51: Warning: readfile(-1): failed to open stream: %s in %s on line %d
! 52: bool(false)
! 53: -- testing '1' --
! 54:
! 55: Warning: readfile(1): failed to open stream: %s in %s on line %d
! 56: bool(false)
! 57: -- testing '' --
! 58:
! 59: Warning: readfile(): Filename cannot be empty in %s on line %d
! 60: bool(false)
! 61: -- testing '' --
! 62:
! 63: Warning: readfile(): Filename cannot be empty in %s on line %d
! 64: bool(false)
! 65: -- testing '' --
! 66:
! 67: Warning: readfile(): Filename cannot be empty in %s on line %d
! 68: bool(false)
! 69: -- testing ' ' --
! 70:
! 71: Warning: readfile( ): failed to open stream: %s in %s on line %d
! 72: bool(false)
! 73: -- testing ' ' --
! 74: bool(false)
! 75: -- testing 'Array' --
! 76:
! 77: Warning: readfile() expects parameter 1 to be string, array given in %s on line %d
! 78: bool(false)
! 79: -- testing '%sdir' --
! 80:
! 81: Warning: readfile(%sdir): failed to open stream: %s in %s on line %d
! 82: bool(false)
! 83: -- testing '%sphp' --
! 84:
! 85: Warning: readfile(%sphp): failed to open stream: %s in %s on line %d
! 86: bool(false)
! 87:
! 88: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>