summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
blob: 87f70b87172bf1b894cc9c658467b21348f28684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--TEST--
Test fseek(), ftell() & rewind() functions : error conditions - ftell()
--FILE--
<?php

/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
   Description: Seeks on a file pointer

   Prototype: bool rewind ( resource $handle );
   Description: Rewind the position of a file pointer

   Prototype: int ftell ( resource $handle );
   Description: Tells file pointer read/write position
*/

echo "*** Testing ftell() : error conditions ***\n";

// ftell on a file handle which is already closed
echo "-- Testing ftell with closed/unset file handle --";
$fp = fopen(__FILE__, "r");
fclose($fp);
var_dump(ftell($fp));

echo "Done\n";
?>
--EXPECTF--
*** Testing ftell() : error conditions ***
-- Testing ftell with closed/unset file handle --
Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
bool(false)
Done