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