1--TEST--
2Test imap_close() function : usage variations - different streams
3--SKIPIF--
4<?php
5extension_loaded('imap') or die('skip imap extension not available in this build');
6?>
7--FILE--
8<?php
9/* Prototype  : bool imap_close(resource $stream_id [, int $options])
10 * Description: Close an IMAP stream
11 * Source code: ext/imap/php_imap.c
12 */
13
14/*
15 * Pass different stream types to imap_close() to test whether it can close them
16 */
17
18echo "*** Testing imap_close() : usage variations ***\n";
19
20echo "\n-- File Resource opened with fopen() --\n";
21var_dump($file_handle = fopen(__FILE__, 'r'));
22var_dump(imap_close($file_handle));
23var_dump($file_handle);
24
25echo "\n-- Directory Resource opened with opendir() --\n";
26var_dump($dir_handle = opendir(dirname(__FILE__)));
27var_dump(imap_close($dir_handle));
28var_dump($dir_handle);
29?>
30===DONE===
31--EXPECTF--
32*** Testing imap_close() : usage variations ***
33
34-- File Resource opened with fopen() --
35resource(%d) of type (stream)
36
37Warning: imap_close(): supplied resource is not a valid imap resource in %s on line %d
38bool(false)
39resource(%d) of type (stream)
40
41-- Directory Resource opened with opendir() --
42resource(%d) of type (stream)
43
44Warning: imap_close(): supplied resource is not a valid imap resource in %s on line %d
45bool(false)
46resource(%d) of type (stream)
47===DONE===
48