diff --git a/azure/apt.yml b/azure/apt.yml index bd3ba3308e01b..71f58ce8da2ad 100644 --- a/azure/apt.yml +++ b/azure/apt.yml @@ -42,5 +42,6 @@ steps: snmp-mibs-downloader \ unixodbc-dev \ llvm \ + libc-client-dev libkrb5-dev dovecot-core dovecot-pop3d dovecot-imapd \ ${{ parameters.packages }} displayName: 'APT' diff --git a/azure/configure.yml b/azure/configure.yml index dc7f754eae425..0bfbf6d92e0ec 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -58,6 +58,9 @@ steps: --enable-dba \ --with-snmp \ --with-unixODBC \ + --with-imap \ + --with-kerberos \ + --with-imap-ssl \ --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d diff --git a/azure/setup.yml b/azure/setup.yml index 825ca4d5f6c01..e0b4dc79da991 100644 --- a/azure/setup.yml +++ b/azure/setup.yml @@ -16,4 +16,12 @@ steps: sudo cp ext/snmp/tests/bigtest /etc/snmp sudo service snmpd restart displayName: 'Configure snmpd' + - script: | + set -e + sudo groupadd -g 5000 vmail + sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail + sudo cp ext/imap/tests/dovecot.conf /etc/dovecot/dovecot.conf + sudo cp ext/imap/tests/dovecotpass /etc/dovecot/dovecotpass + sudo service dovecot restart + displayName: 'Configure IMAP' diff --git a/ext/imap/tests/CONFLICTS b/ext/imap/tests/CONFLICTS new file mode 100644 index 0000000000000..c301c0ffaca1d --- /dev/null +++ b/ext/imap/tests/CONFLICTS @@ -0,0 +1 @@ +imap diff --git a/ext/imap/tests/bug75774.phpt b/ext/imap/tests/bug75774.phpt index 42f5a842c3469..08883ad8f0ab5 100644 --- a/ext/imap/tests/bug75774.phpt +++ b/ext/imap/tests/bug75774.phpt @@ -8,12 +8,12 @@ extension_loaded('imap') or die('skip imap extension not available in this build getMessage() . "\n"; +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; } fclose($var1); @@ -22,5 +22,4 @@ unlink($fn); ?> --EXPECTF-- Warning: imap_append(): Internal date not correctly formatted in %s on line %d - -Exception: imap_append(): Supplied resource is not a valid imap resource +imap_append(): supplied resource is not a valid imap resource diff --git a/ext/imap/tests/dovecot.conf b/ext/imap/tests/dovecot.conf new file mode 100644 index 0000000000000..c465ba3ce9121 --- /dev/null +++ b/ext/imap/tests/dovecot.conf @@ -0,0 +1,33 @@ +# 2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf +# Pigeonhole version 0.4.21 (92477967) +listen = *, :: + +# To make authentication work +ssl = no +disable_plaintext_auth = no + +auth_mechanisms = plain cram-md5 +auth_username_format = %u +auth_debug = yes +auth_verbose = yes +#log +log_path = /var/log/dovecot.log +# If not set, use the value from log_path +info_log_path = /var/log/dovecot-info.log +# If not set, use the value from info_log_path +debug_log_path = /var/log/dovecot-debug.log +## Mailbox locations and namespaces +mail_location = maildir:/var/vmail/dovecot/mail/%d/%n/Maildir +passdb { + args = scheme=cram-md5 /etc/dovecot/dovecotpass + driver = passwd-file +} +protocols = imap +service auth { + user = root +} +userdb { + args = /etc/dovecot/dovecotpass + driver = passwd-file + override_fields = home=/var/vmail/dovecot/mail/%d/%n +} diff --git a/ext/imap/tests/dovecotpass b/ext/imap/tests/dovecotpass new file mode 100644 index 0000000000000..86a069fc4f699 --- /dev/null +++ b/ext/imap/tests/dovecotpass @@ -0,0 +1 @@ +webmaster@something.com:{CRAM-MD5}be5f3177e9c7c06403272f25d983ba630df4ef40476b353bb3087a8401713451:vmail:vmail diff --git a/ext/imap/tests/imap_body.phpt b/ext/imap/tests/imap_body.phpt index a4e8069d040d9..4d4133c343fc7 100644 --- a/ext/imap/tests/imap_body.phpt +++ b/ext/imap/tests/imap_body.phpt @@ -9,16 +9,11 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_body() expects at least 2 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d - -Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d - -Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d - Warning: imap_body(): Bad message number in %s on line %d Warning: imap_body(): Invalid value for the options parameter in %s on line %d diff --git a/ext/imap/tests/imap_fetch_overview_variation3.phpt b/ext/imap/tests/imap_fetch_overview_variation3.phpt index 13b5591dc5b0e..419de4c95152f 100644 --- a/ext/imap/tests/imap_fetch_overview_variation3.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation3.phpt @@ -58,7 +58,7 @@ imap_fetch_overview() returns an object Testing with option value:bool(true) imap_fetch_overview() returns an object -Testing with option value:float(1) +Testing with option value:float(1.000000000000001) imap_fetch_overview() returns an object Testing with option value:float(1) diff --git a/ext/imap/tests/imap_fetchbody_variation6.phpt b/ext/imap/tests/imap_fetchbody_variation6.phpt index 20ac49edc8a38..75516f8381454 100644 --- a/ext/imap/tests/imap_fetchbody_variation6.phpt +++ b/ext/imap/tests/imap_fetchbody_variation6.phpt @@ -19,9 +19,7 @@ require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 3); // set up temp mailbox with simple msgs $section = 1; -$sequences = array (0, 4, // out of range - '1,3', '1:3', // message sequences instead of numbers - ); +$sequences = [0, /* out of range */ 4, 1]; foreach($sequences as $msg_no) { echo "\n-- \$msg_no is $msg_no --\n"; @@ -52,12 +50,6 @@ Warning: imap_fetchbody(): Bad message number in %s on line %d bool(false) --- $msg_no is 1,3 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(%d) "1: this is a test message, please ignore%a" - --- $msg_no is 1:3 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(%d) "1: this is a test message, please ignore%a" +-- $msg_no is 1 -- +string(42) "1: this is a test message, please ignore +" diff --git a/ext/imap/tests/imap_fetchheader_variation5.phpt b/ext/imap/tests/imap_fetchheader_variation5.phpt index 7ff8ca697e777..2283861df8e8a 100644 --- a/ext/imap/tests/imap_fetchheader_variation5.phpt +++ b/ext/imap/tests/imap_fetchheader_variation5.phpt @@ -17,9 +17,7 @@ require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs -$sequences = array (0, 4, // out of range - '1,3', '1:3', // message sequences instead of numbers - ); +$sequences = [0, /* out of range */ 4, 1]; foreach($sequences as $msg_no) { echo "\n-- \$msg_no is $msg_no --\n"; @@ -53,24 +51,11 @@ Warning: imap_fetchheader(): Bad message number in %s on line %d bool(false) --- $msg_no is 1,3 -- - -Notice: A non well formed numeric value encountered in %s on line %d -string(%d) "From: foo@anywhere.com -Subject: Test msg 1 -To: %s -MIME-Version: 1.0 -Content-Type: MULTIPART/mixed; BOUNDARY="%s" - -" - --- $msg_no is 1:3 -- - -Notice: A non well formed numeric value encountered in %s on line %d +-- $msg_no is 1 -- string(%d) "From: foo@anywhere.com Subject: Test msg 1 -To: %s +To: webmaster@something.com MIME-Version: 1.0 -Content-Type: MULTIPART/mixed; BOUNDARY="%s" +Content-Type: MULTIPART/mixed; BOUNDARY="%s=:%d" " diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt index 0ff266a390c83..572556e6e13d1 100644 --- a/ext/imap/tests/imap_fetchstructure_basic.phpt +++ b/ext/imap/tests/imap_fetchstructure_basic.phpt @@ -8,17 +8,10 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_fetchstructure() expects at least 2 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d - -Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d Create a temporary mailbox and add 1 msgs -.. mailbox '{%s}%s' created - -Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d +.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created bool(true) bool(true) bool(true) diff --git a/ext/imap/tests/imap_gc_error.phpt b/ext/imap/tests/imap_gc_error.phpt index 2d825ce1fdf19..072af103930cb 100644 --- a/ext/imap/tests/imap_gc_error.phpt +++ b/ext/imap/tests/imap_gc_error.phpt @@ -9,12 +9,6 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_gc() Expects exactly 2 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_gc(): Argument #1 must be of type resource, string given in %s on line %d - -Warning: imap_gc(): Argument #1 must be of type resource, bool given in %s on line %d - Warning: imap_gc(): Invalid value for the flags parameter in %s on line %d diff --git a/ext/imap/tests/imap_getsubscribed_basic.phpt b/ext/imap/tests/imap_getsubscribed_basic.phpt index 8995eadd05289..bba82271c7ca3 100644 --- a/ext/imap/tests/imap_getsubscribed_basic.phpt +++ b/ext/imap/tests/imap_getsubscribed_basic.phpt @@ -8,19 +8,11 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_getsubscribed() expects exactly 3 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_getsubscribed() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_getsubscribed() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_getsubscribed() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_getsubscribed() expects exactly 3 parameters, 2 given in %s on line %d bool(false) Checking OK bool(true) diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc index 7de634075a295..e57d6516979f2 100644 --- a/ext/imap/tests/imap_include.inc +++ b/ext/imap/tests/imap_include.inc @@ -1,6 +1,6 @@ --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_list() expects exactly 3 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_list() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_list() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_list() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_list() expects exactly 3 parameters, 2 given in %s on line %d bool(true) string(%s) "{%s}%s" diff --git a/ext/imap/tests/imap_lsub_basic.phpt b/ext/imap/tests/imap_lsub_basic.phpt index 591a023ed8696..98875266d7406 100644 --- a/ext/imap/tests/imap_lsub_basic.phpt +++ b/ext/imap/tests/imap_lsub_basic.phpt @@ -8,19 +8,11 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_lsub() expects exactly 3 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_lsub() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_lsub() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_lsub() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_lsub() expects exactly 3 parameters, 2 given in %s on line %d bool(false) Checking OK bool(true) diff --git a/ext/imap/tests/imap_open_error.phpt b/ext/imap/tests/imap_open_error.phpt index b94c11d797afd..f9410519f2159 100644 --- a/ext/imap/tests/imap_open_error.phpt +++ b/ext/imap/tests/imap_open_error.phpt @@ -9,12 +9,6 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_open() expects at least 3 parameters, 0 given in %s on line %d - -Warning: imap_open() expects at least 3 parameters, 1 given in %s on line %d - -Warning: imap_open() expects at least 3 parameters, 2 given in %s on line %d - -Warning: imap_open() expects at least 3 parameters, 1 given in %s on line %d - -Warning: imap_open() expects at least 3 parameters, 2 given in %s on line %d Checking with incorrect parameters Warning: imap_open(): Couldn't open stream in %s on line %d diff --git a/ext/imap/tests/imap_renamemailbox_basic.phpt b/ext/imap/tests/imap_renamemailbox_basic.phpt index ee5ccb2be7234..c6b1812d165b5 100644 --- a/ext/imap/tests/imap_renamemailbox_basic.phpt +++ b/ext/imap/tests/imap_renamemailbox_basic.phpt @@ -8,13 +8,6 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_renamemailbox() expects exactly 3 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_renamemailbox() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: imap_renamemailbox() expects exactly 3 parameters, 1 given in %s on line %d Create a temporary mailbox and add 1 msgs .. mailbox '{%s}%s' created - -Warning: imap_renamemailbox() expects exactly 3 parameters, 2 given in %s on line %d - -Warning: imap_renamemailbox() expects exactly 3 parameters, 2 given in %s on line %d Checking OK bool(true) bool(true) diff --git a/ext/imap/tests/imap_savebody_basic.phpt b/ext/imap/tests/imap_savebody_basic.phpt index 2be987a3617c3..ccbaa1ba66cc4 100644 --- a/ext/imap/tests/imap_savebody_basic.phpt +++ b/ext/imap/tests/imap_savebody_basic.phpt @@ -8,18 +8,10 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_savebody() expects at least 3 parameters, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d - -Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d Create a temporary mailbox and add 1 msgs -.. mailbox '{%s}%s' created - -Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d +.. mailbox '{127.0.0.1:143/norsh}INBOX.phpttest' created bool(true) Size: %d bool(true) diff --git a/ext/imap/tests/imap_timeout_basic.phpt b/ext/imap/tests/imap_timeout_basic.phpt index e1b958b3c77ef..f9618c3e3a33d 100644 --- a/ext/imap/tests/imap_timeout_basic.phpt +++ b/ext/imap/tests/imap_timeout_basic.phpt @@ -8,12 +8,6 @@ require_once(__DIR__.'/skipif.inc'); ?> --FILE-- --EXPECTF-- -Checking with no parameters - -Warning: imap_timeout() expects at least 1 argument, 0 given in %s on line %d -Checking with incorrect parameter type - -Warning: imap_timeout(): Argument #1 must be of type int, %s given in %s on line %d GET values: int(%d) int(%d) diff --git a/ext/imap/tests/setup.sh b/ext/imap/tests/setup.sh new file mode 100644 index 0000000000000..5cb18334a3f95 --- /dev/null +++ b/ext/imap/tests/setup.sh @@ -0,0 +1,6 @@ +sudo service dovecot stop +sudo groupadd -g 5000 vmail +sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail +sudo cp ext/imap/tests/dovecot.conf /etc/dovecot/dovecot.conf +sudo cp ext/imap/tests/dovecotpass /etc/dovecot/dovecotpass +sudo service dovecot start diff --git a/ext/imap/tests/skipif.inc b/ext/imap/tests/skipif.inc index 2820bff5c69f4..2167ad1d0cd65 100644 --- a/ext/imap/tests/skipif.inc +++ b/ext/imap/tests/skipif.inc @@ -2,7 +2,7 @@ extension_loaded('imap') or die('skip imap extension not available in this build'); // Change these to make tests run successfully -$mailbox = '{localhost/norsh}'; +$mailbox = '{127.0.0.1:143/debug/norsh}'; $username = 'webmaster@something.com'; $password = 'p4ssw0rd'; $options = OP_HALFOPEN; // this should be enough to verify server present