File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
dir /
rewinddir_variation3.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test rewinddir() function : usage variations - file pointers
--FILE--
<?php
/* Prototype : void rewinddir([resource $dir_handle])
* Description: Rewind dir_handle back to the start
* Source code: ext/standard/dir.c
* Alias to functions: rewind
*/
/*
* Pass a file pointer to rewinddir() to test behaviour
*/
echo "*** Testing rewinddir() : usage variations ***\n";
echo "\n-- Open a file using fopen --\n";
var_dump($fp = fopen(__FILE__, 'r'));
$result1 = fread($fp, 5);
var_dump(rewinddir($fp));
$result2 = fread($fp, 5);
echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
if ($result1 === $result2) {
echo "rewinddir() works on file pointers\n";
} else {
echo "rewinddir() does not work on file pointers\n";
}
?>
===DONE===
--EXPECTF--
*** Testing rewinddir() : usage variations ***
-- Open a file using fopen --
resource(%d) of type (stream)
Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
bool(false)
-- Check if rewinddir() has repositioned the file pointer --
rewinddir() does not work on file pointers
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>