File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / dir / closedir_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 closedir() function : usage variations - close a file pointer
--FILE--
<?php
/* Prototype  : void closedir([resource $dir_handle])
 * Description: Close directory connection identified by the dir_handle 
 * Source code: ext/standard/dir.c
 * Alias to functions: close
 */

/*
 * Create a file pointer using fopen() then try to close it using closedir()
 */

echo "*** Testing closedir() : usage variations ***\n";

echo "\n-- Open a file using fopen() --\n";
var_dump($fp = fopen(__FILE__, 'r'));

echo "\n-- Try to close the file pointer using closedir() --\n";
var_dump(closedir($fp));

echo "\n-- Check file pointer: --\n";
var_dump($fp);

if(is_resource($fp)) {
	fclose($fp);
}
?>
===DONE===
--EXPECTF--
*** Testing closedir() : usage variations ***

-- Open a file using fopen() --
resource(%d) of type (stream)

-- Try to close the file pointer using closedir() --

Warning: closedir(): %d is not a valid Directory resource in %s on line %d
bool(false)

-- Check file pointer: --
resource(%d) of type (stream)
===DONE===

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