1--TEST--
2Test imap_errors() function : basic functionality
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__).'/skipif.inc');
6?>
7--FILE--
8<?php
9/* Prototype  : array imap_errors  ( void  )
10 * Description: Returns all of the IMAP errors that have occurred.
11 * Source code: ext/imap/php_imap.c
12 */
13
14echo "*** Testing imap_errors() : basic functionality ***\n";
15require_once(dirname(__FILE__).'/imap_include.inc');
16$password = "bogus"; // invalid password to use in this test
17
18echo "Issue open with invalid password with normal default number of retries, i.e 3\n";
19$mbox = imap_open($default_mailbox, $username, $password, OP_READONLY, 3);
20
21echo "List any errors\n";
22var_dump(imap_errors());
23
24echo "\n\nIssue open with invalid password with retries == 1\n";
25$mbox = imap_open($default_mailbox, $username, $password, OP_READONLY, 1);
26
27echo "List any errors\n";
28var_dump(imap_errors());
29?>
30===Done===
31--EXPECTF--
32*** Testing imap_errors() : basic functionality ***
33Issue open with invalid password with normal default number of retries, i.e 3
34
35Warning: imap_open(): Couldn't open stream %s in %s on line %d
36List any errors
37array(%d) {
38  [0]=>
39  string(%d) "%s"
40  [1]=>
41  string(%d) "%s"
42  [2]=>
43  string(%d) "%a
44}
45
46
47Issue open with invalid password with retries == 1
48
49Warning: imap_open(): Couldn't open stream %s in %s on line %d
50List any errors
51array(%d) {
52  [0]=>
53  string(%d) "%a
54}
55===Done===
56