diff options
Diffstat (limited to 'ext/imap')
69 files changed, 221 insertions, 2272 deletions
diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 index 50492182f9..5086a312d0 100644 --- a/ext/imap/config.m4 +++ b/ext/imap/config.m4 @@ -1,5 +1,3 @@ -dnl config.m4 for extension imap - AC_DEFUN([IMAP_INC_CHK],[if test -r "$i$1/c-client.h"; then AC_DEFINE(HAVE_IMAP2000, 1, [ ]) IMAP_DIR=$i @@ -48,15 +46,12 @@ AC_DEFUN([PHP_IMAP_TEST_BUILD], [ AC_DEFUN([PHP_IMAP_KRB_CHK], [ if test "$PHP_KERBEROS" != "no"; then - PHP_SETUP_KERBEROS(IMAP_SHARED_LIBADD, - [ - AC_DEFINE(HAVE_IMAP_KRB,1,[ ]) - ], [ - AC_MSG_ERROR([Kerberos libraries not found. + PKG_CHECK_MODULES([KERBEROS], [krb5-gssapi krb5]) - Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr ) - ]) - ]) + PHP_EVAL_INCLINE($KERBEROS_CFLAGS) + PHP_EVAL_LIBLINE($KERBEROS_LIBS, IMAP_SHARED_LIBADD) + + AC_DEFINE(HAVE_IMAP_KRB, 1, [Whether IMAP extension has Kerberos support]) else AC_EGREP_HEADER(auth_gss, $IMAP_INC_DIR/linkage.h, [ AC_MSG_ERROR([This c-client library is built with Kerberos support. @@ -78,7 +73,7 @@ AC_DEFUN([PHP_IMAP_SSL_CHK], [ ], [ AC_MSG_ERROR([OpenSSL libraries not found. - Check the path given to --with-openssl-dir and output in config.log) + Check whether openssl is on your PKG_CONFIG_PATH and the output in config.log) ]) ]) elif test -f "$IMAP_INC_DIR/linkage.c"; then @@ -91,20 +86,28 @@ AC_DEFUN([PHP_IMAP_SSL_CHK], [ fi ]) - -PHP_ARG_WITH(imap,for IMAP support, -[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix]) - -PHP_ARG_WITH(kerberos,for IMAP Kerberos support, -[ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix], no, no) - -PHP_ARG_WITH(imap-ssl,for IMAP SSL support, -[ --with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix], no, no) - +PHP_ARG_WITH([imap], + [for IMAP support], + [AS_HELP_STRING([[--with-imap[=DIR]]], + [Include IMAP support. DIR is the c-client install prefix])]) + +PHP_ARG_WITH([kerberos], + [for IMAP Kerberos support], + [AS_HELP_STRING([--with-kerberos], + [IMAP: Include Kerberos support])], + [no], + [no]) + +PHP_ARG_WITH([imap-ssl], + [for IMAP SSL support], + [AS_HELP_STRING([[--with-imap-ssl]], + [IMAP: Include SSL support])], + [no], + [no]) if test "$PHP_IMAP" != "no"; then PHP_SUBST(IMAP_SHARED_LIBADD) - PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared) + PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) AC_DEFINE(HAVE_IMAP,1,[ ]) for i in $PHP_IMAP /usr/local /usr; do diff --git a/ext/imap/config.w32 b/ext/imap/config.w32 index 0f79659b77..fec2931052 100644 --- a/ext/imap/config.w32 +++ b/ext/imap/config.w32 @@ -13,11 +13,10 @@ if (PHP_IMAP == "yes") { CHECK_LIB("ws2_32.lib", "imap"); CHECK_LIB("Secur32.lib", "imap"); CHECK_LIB("crypt32.lib", "imap"); - EXTENSION("imap", "php_imap.c", true); + EXTENSION("imap", "php_imap.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); ADD_FLAG("CFLAGS_IMAP", "/D HAVE_IMAP2000=1 /D HAVE_IMAP2004=1 /D HAVE_IMAP2007a=1 /D HAVE_IMAP2007b=1 /D HAVE_IMAP_SSL=1"); AC_DEFINE('HAVE_IMAP', 1, 'Have IMAP support', true); - AC_DEFINE('HAVE_NEW_MIME2TEXT', 1, 'Have utf8_mime2text', true); AC_DEFINE('HAVE_RFC822_OUTPUT_ADDRESS_LIST', 1, 'Have rfc822_output_address_list', true); AC_DEFINE('HAVE_IMAP_MUTF7', 1, 'Have modified utf7 support', true); AC_DEFINE('HAVE_NEW_MIME2TEXT', 1, 'Whether utf8_mime2text() has new signature'); diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index cf8ed7bcf2..c605866ef3 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -592,6 +592,9 @@ zend_module_entry imap_module_entry = { /* }}} */ #ifdef COMPILE_DL_IMAP +#ifdef ZTS +ZEND_TSRMLS_CACHE_DEFINE() +#endif ZEND_GET_MODULE(imap) #endif @@ -808,6 +811,9 @@ void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist) */ static PHP_GINIT_FUNCTION(imap) { +#if defined(COMPILE_DL_IMAP) && defined(ZTS) + ZEND_TSRMLS_CACHE_UPDATE(); +#endif imap_globals->imap_user = NIL; imap_globals->imap_password = NIL; @@ -1251,7 +1257,9 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } #endif + ZEND_IGNORE_LEAKS_BEGIN(); imap_stream = mail_open(NIL, ZSTR_VAL(mailbox), flags); + ZEND_IGNORE_LEAKS_END(); if (imap_stream == NIL) { php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", ZSTR_VAL(mailbox)); @@ -1345,12 +1353,12 @@ PHP_FUNCTION(imap_append) /* Make sure the given internal_date string matches the RFC specifiedformat */ if ((pce = pcre_get_compiled_regex_cache(regex))== NULL) { - zend_string_free(regex); + zend_string_release(regex); RETURN_FALSE; } - zend_string_free(regex); - php_pcre_match_impl(pce, ZSTR_VAL(internal_date), ZSTR_LEN(internal_date), return_value, subpats, global, + zend_string_release(regex); + php_pcre_match_impl(pce, internal_date, return_value, subpats, global, 0, Z_L(0), Z_L(0)); if (!Z_LVAL_P(return_value)) { @@ -2054,7 +2062,9 @@ PHP_FUNCTION(imap_delete) RETURN_FALSE; } - convert_to_string_ex(sequence); + if (!try_convert_to_string(sequence)) { + return; + } mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_P(sequence), "\\DELETED", (argc == 3 ? flags : NIL)); RETVAL_TRUE; @@ -2078,7 +2088,9 @@ PHP_FUNCTION(imap_undelete) RETURN_FALSE; } - convert_to_string_ex(sequence); + if (!try_convert_to_string(sequence)) { + return; + } mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_P(sequence), "\\DELETED", (argc == 3 ? flags : NIL)); RETVAL_TRUE; @@ -2217,7 +2229,9 @@ PHP_FUNCTION(imap_lsub) IMAPG(folderlist_style) = FLIST_ARRAY; IMAPG(imap_sfolders) = NIL; + ZEND_IGNORE_LEAKS_BEGIN(); mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); + ZEND_IGNORE_LEAKS_END(); if (IMAPG(imap_sfolders) == NIL) { RETURN_FALSE; } @@ -2256,7 +2270,9 @@ PHP_FUNCTION(imap_lsub_full) IMAPG(folderlist_style) = FLIST_OBJECT; IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL; + ZEND_IGNORE_LEAKS_BEGIN(); mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); + ZEND_IGNORE_LEAKS_END(); if (IMAPG(imap_sfolder_objects) == NIL) { RETURN_FALSE; } @@ -2497,7 +2513,9 @@ PHP_FUNCTION(imap_savebody) break; default: - convert_to_string_ex(out); + if (!try_convert_to_string(out)) { + return; + } writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS, NULL); break; } @@ -3359,13 +3377,13 @@ PHP_FUNCTION(imap_bodystruct) RETURN_FALSE; } - object_init(return_value); body=mail_body(imap_le_struct->imap_stream, msg, (unsigned char*)ZSTR_VAL(section)); if (body == NULL) { - zval_ptr_dtor(return_value); RETURN_FALSE; } + + object_init(return_value); if (body->type <= TYPEMAX) { add_property_long(return_value, "type", body->type); } @@ -4110,11 +4128,8 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char * } fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); - if (ret == -1) { - return 0; - } else { - return 1; - } + + return ret != -1; } else { php_error_docref(NULL, E_WARNING, "Could not execute mail delivery program"); return 0; @@ -5136,12 +5151,3 @@ PHP_IMAP_EXPORT void mm_fatal(char *str) { } /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h index 6e5cfdb31c..c23799976c 100644 --- a/ext/imap/php_imap.h +++ b/ext/imap/php_imap.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -232,12 +232,13 @@ ZEND_BEGIN_MODULE_GLOBALS(imap) zend_bool enable_rsh; ZEND_END_MODULE_GLOBALS(imap) -#ifdef ZTS -# define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v) -#else -# define IMAPG(v) (imap_globals.v) +#if defined(ZTS) && defined(COMPILE_DL_IMAP) +ZEND_TSRMLS_CACHE_EXTERN() #endif +ZEND_EXTERN_MODULE_GLOBALS(imap) +#define IMAPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(imap, v) + #else #define imap_module_ptr NULL diff --git a/ext/imap/tests/README b/ext/imap/tests/README deleted file mode 100644 index 99424b3995..0000000000 --- a/ext/imap/tests/README +++ /dev/null @@ -1,40 +0,0 @@ -Many of the tests in this directory require a mail server to be running, if there is no mail server the test will skip and warn, see skipif.inc for details. - -To make the tests run parameters in the skipif.inc and imap_include.inc file will need to be changed to match the local mailserver configuration. - - -The tests have been checked using dovecot (on Linux 32 and 64 bit systems) and hMailServer on Windows. The tests are intended to be mailserver agnostic. - -The tests can be run without modification with a fairly minimal dovecot installation. For information, the dovecot.conf file used in running the tests is given below (after -----). The dovecot password file (dovecotpass) requires a password for one user, webmaster@something.com. It's also necessary to set up one additional user ID (vmail) to own the mail directory. - --------------------------------------------------- -protocols = imap imaps - -listen = * - -ssl_disable = yes - -disable_plaintext_auth=yes - -## Mailbox locations and namespaces - -mail_location = maildir:/home/vmail/mail/%d/%n/Maildir - -auth_verbose = yes - -auth_debug = yes - -auth default { - - mechanisms = login - - passdb passwd-file { - args = /etc/dovecot/dovecotpass - } - - userdb static { - args = uid=11459 gid=1002 home=/home/vmail/dovecot/mail/%d/%n - } - - user = root -} diff --git a/ext/imap/tests/README.md b/ext/imap/tests/README.md new file mode 100644 index 0000000000..381cdc2e8e --- /dev/null +++ b/ext/imap/tests/README.md @@ -0,0 +1,48 @@ +# The imap extension tests + +Many of the tests in this directory require a mail server to be running, if +there is no mail server the test will skip and warn, see skipif.inc for details. + +To make the tests run parameters in the `skipif.inc` and `imap_include.inc` +files will need to be changed to match the local mailserver configuration. + +The tests have been checked using dovecot (on Linux 32 and 64 bit systems) and +hMailServer on Windows. The tests are intended to be mailserver agnostic. + +The tests can be run without modification with a fairly minimal dovecot +installation. For information, the dovecot.conf file used in running the tests +is given below. The dovecot password file (dovecotpass) requires a password for +one user, `webmaster@something.com`. It's also necessary to set up one +additional user ID (vmail) to own the mail directory. + +```txt +protocols = imap imaps + +listen = * + +ssl_disable = yes + +disable_plaintext_auth=yes + +## Mailbox locations and namespaces + +mail_location = maildir:/home/vmail/mail/%d/%n/Maildir + +auth_verbose = yes + +auth_debug = yes + +auth default { + mechanisms = login + + passdb passwd-file { + args = /etc/dovecot/dovecotpass + } + + userdb static { + args = uid=11459 gid=1002 home=/home/vmail/dovecot/mail/%d/%n + } + + user = root +} +``` diff --git a/ext/imap/tests/bug63126.phpt b/ext/imap/tests/bug63126.phpt index b046c46b55..94c618730c 100644 --- a/ext/imap/tests/bug63126.phpt +++ b/ext/imap/tests/bug63126.phpt @@ -4,7 +4,7 @@ imap_open() DISABLE_AUTHENTICATOR ignores array param <?php extension_loaded('imap') or die('skip imap extension not available in this build'); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1); if (!$in) { @@ -28,7 +28,7 @@ $tests = array( 'Array' => array('DISABLE_AUTHENTICATOR' => array('GSSAPI','NTLM')), 'String' => array('DISABLE_AUTHENTICATOR' => 'GSSAPI'), ); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); foreach ($tests as $name => $testparams) { echo "Test for $name\n"; $in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1, $testparams); diff --git a/ext/imap/tests/imap_alerts_error.phpt b/ext/imap/tests/imap_alerts_error.phpt index 2baefc3da1..546d193c8f 100644 --- a/ext/imap/tests/imap_alerts_error.phpt +++ b/ext/imap/tests/imap_alerts_error.phpt @@ -2,7 +2,7 @@ Test imap_alerts() function : error conditions --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_append_basic.phpt b/ext/imap/tests/imap_append_basic.phpt index 06b0c1d4a4..500d3afb69 100644 --- a/ext/imap/tests/imap_append_basic.phpt +++ b/ext/imap/tests/imap_append_basic.phpt @@ -2,7 +2,7 @@ Test imap_append() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_append() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 0); diff --git a/ext/imap/tests/imap_body.phpt b/ext/imap/tests/imap_body.phpt index 77747c8d8a..a9b3bcd6e5 100644 --- a/ext/imap/tests/imap_body.phpt +++ b/ext/imap/tests/imap_body.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ imap_body(); echo "Checking with incorrect parameter type\n"; imap_body(''); imap_body(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_body($stream_id); diff --git a/ext/imap/tests/imap_body_basic.phpt b/ext/imap/tests/imap_body_basic.phpt index 3cfe3e3d6b..bc9f789c6a 100644 --- a/ext/imap/tests/imap_body_basic.phpt +++ b/ext/imap/tests/imap_body_basic.phpt @@ -2,7 +2,7 @@ Test imap_body() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_body() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 1); diff --git a/ext/imap/tests/imap_bodystruct_basic.phpt b/ext/imap/tests/imap_bodystruct_basic.phpt index a5db378c00..07b552de96 100644 --- a/ext/imap/tests/imap_bodystruct_basic.phpt +++ b/ext/imap/tests/imap_bodystruct_basic.phpt @@ -2,7 +2,7 @@ Test imap_bodystruct() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -12,7 +12,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing string imap_bodystruct : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test and add a multipart msgs\n"; $imap_stream = setup_test_mailbox("", 1, $mailbox, "multipart"); diff --git a/ext/imap/tests/imap_clearflag_full_basic.phpt b/ext/imap/tests/imap_clearflag_full_basic.phpt index 359c3af28c..017ca1b71e 100644 --- a/ext/imap/tests/imap_clearflag_full_basic.phpt +++ b/ext/imap/tests/imap_clearflag_full_basic.phpt @@ -2,7 +2,7 @@ Test imap_clearflag_full() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_clearflag_full() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; $imap_stream = setup_test_mailbox("", 10); diff --git a/ext/imap/tests/imap_close_basic.phpt b/ext/imap/tests/imap_close_basic.phpt index bbb78bfbf9..4a3f5d683f 100644 --- a/ext/imap/tests/imap_close_basic.phpt +++ b/ext/imap/tests/imap_close_basic.phpt @@ -2,7 +2,7 @@ Test imap_close() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -14,7 +14,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_close() : basic functionality ***\n"; // include file for required variables in imap_open() -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Initialize required variables $stream_id = setup_test_mailbox('', 3, $mailbox); // set up temp mailbox with 3 messages @@ -40,7 +40,7 @@ var_dump( imap_close($stream_id) ); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_close() : basic functionality *** diff --git a/ext/imap/tests/imap_close_error.phpt b/ext/imap/tests/imap_close_error.phpt index 89cafab3ba..8bb43e6a3b 100644 --- a/ext/imap/tests/imap_close_error.phpt +++ b/ext/imap/tests/imap_close_error.phpt @@ -2,7 +2,7 @@ Test imap_close() function : error conditions - incorrect number of args --SKIPIF-- <?php -require_once (dirname(__FILE__).'/skipif.inc'); +require_once (__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -16,7 +16,7 @@ require_once (dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_close() : error conditions ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Zero arguments echo "\n-- Testing imap_close() function with Zero arguments --\n"; diff --git a/ext/imap/tests/imap_close_variation1.phpt b/ext/imap/tests/imap_close_variation1.phpt deleted file mode 100644 index eb649b0d5a..0000000000 --- a/ext/imap/tests/imap_close_variation1.phpt +++ /dev/null @@ -1,214 +0,0 @@ ---TEST-- -Test imap_close() function : usage variations - different data types as $stream_id arg ---SKIPIF-- -<?php -extension_loaded('imap') or die('skip imap extension not available in this build'); -?> ---FILE-- -<?php -/* Prototype : bool imap_close(resource $stream_id [, int $options]) - * Description: Close an IMAP stream - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $stream_id argument to test behaviour of imap_close() - */ - -echo "*** Testing imap_close() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed to $stream_id argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_close() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( imap_close($input) ); - $iterator++; -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imap_close() : usage variations *** - --- Iteration 1 -- - -Warning: imap_close() expects parameter 1 to be resource, int given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 2 -- - -Warning: imap_close() expects parameter 1 to be resource, int given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 3 -- - -Warning: imap_close() expects parameter 1 to be resource, int given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 4 -- - -Warning: imap_close() expects parameter 1 to be resource, int given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 5 -- - -Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 6 -- - -Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 7 -- - -Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 8 -- - -Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 9 -- - -Warning: imap_close() expects parameter 1 to be resource, float given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 10 -- - -Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 11 -- - -Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 12 -- - -Warning: imap_close() expects parameter 1 to be resource, bool given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 13 -- - -Warning: imap_close() expects parameter 1 to be resource, bool given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 14 -- - -Warning: imap_close() expects parameter 1 to be resource, bool given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 15 -- - -Warning: imap_close() expects parameter 1 to be resource, bool given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 16 -- - -Warning: imap_close() expects parameter 1 to be resource, string given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 17 -- - -Warning: imap_close() expects parameter 1 to be resource, string given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 18 -- - -Warning: imap_close() expects parameter 1 to be resource, array given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 19 -- - -Warning: imap_close() expects parameter 1 to be resource, string given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 20 -- - -Warning: imap_close() expects parameter 1 to be resource, string given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 21 -- - -Warning: imap_close() expects parameter 1 to be resource, string given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 22 -- - -Warning: imap_close() expects parameter 1 to be resource, object given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 23 -- - -Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80 -NULL - --- Iteration 24 -- - -Warning: imap_close() expects parameter 1 to be resource, null given in %simap_close_variation1.php on line 80 -NULL -===DONE=== diff --git a/ext/imap/tests/imap_close_variation2.phpt b/ext/imap/tests/imap_close_variation2.phpt deleted file mode 100644 index 652c4260a0..0000000000 --- a/ext/imap/tests/imap_close_variation2.phpt +++ /dev/null @@ -1,227 +0,0 @@ ---TEST-- -Test imap_close() function : usage variations - different data types as $options arg ---SKIPIF-- -<?php -require_once(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -<?php -/* Prototype : bool imap_close(resource $stream_id [, int $options]) - * Description: Close an IMAP stream - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $options argument to test behaviour of imap_close() - */ - -echo "*** Testing imap_close() : usage variations ***\n"; - -// include file for imap_stream -require_once(dirname(__FILE__).'/imap_include.inc'); - -// create mailbox to test whether options has been set to CL_EXPUNGE -$stream_id = setup_test_mailbox('', 3, $mailbox); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -32768 -EOT; - -// unexpected values to be passed to $options argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 32768, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "32768", - '32768', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_close() -$iterator = 1; -foreach($inputs as $input) { - - // mark added messages for deletion - for ($i = 1; $i < 4; $i++) { - imap_delete($stream_id, $i); - } - echo "\n-- Iteration $iterator --\n"; - var_dump( $check = imap_close($stream_id, $input) ); - - // check that imap_close was successful, if not call imap_close and explicitly set CL_EXPUNGE - if(false === $check) { - imap_close($stream_id, CL_EXPUNGE); - } else { - // if imap_close was successful test whether CL_EXPUNGE was set by doing a message count - $imap_stream = imap_open($mailbox, $username, $password); - $num_msg = imap_num_msg($imap_stream); - if ($num_msg != 0) { - echo "CL_EXPUNGE was not set, $num_msg msgs in mailbox\n"; - } else { - echo "CL_EXPUNGE was set\n"; - } - // call imap_close with CL_EXPUNGE explicitly set in case mailbox not empty - imap_close($imap_stream, CL_EXPUNGE); - } - $iterator++; - - // get $stream_id for next iteration - $stream_id = imap_open($mailbox, $username, $password); - populate_mailbox($stream_id, $mailbox, 3); - -}; - -?> -===DONE=== ---CLEAN-- -<?php -require_once(dirname(__FILE__).'/clean.inc'); -?> ---EXPECTF-- -*** Testing imap_close() : usage variations *** -Create a temporary mailbox and add 3 msgs -.. mailbox '{%s}%s' created - --- Iteration 1 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 2 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 3 -- -bool(true) -CL_EXPUNGE was set - --- Iteration 4 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 5 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 6 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 7 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 8 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 9 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 10 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 11 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 12 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 13 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 14 -- - -Warning: imap_close(): invalid value for the flags parameter in %s on line %d -bool(false) - --- Iteration 15 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 16 -- - -Warning: imap_close() expects parameter 2 to be int, string given in %s on line %d -NULL -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 17 -- - -Warning: imap_close() expects parameter 2 to be int, string given in %s on line %d -NULL -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 18 -- - -Warning: imap_close() expects parameter 2 to be int, array given in %s on line %d -NULL -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 19 -- -bool(true) -CL_EXPUNGE was set - --- Iteration 20 -- -bool(true) -CL_EXPUNGE was set - --- Iteration 21 -- -bool(true) -CL_EXPUNGE was set - --- Iteration 22 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox - --- Iteration 23 -- -bool(true) -CL_EXPUNGE was not set, 3 msgs in mailbox -===DONE=== diff --git a/ext/imap/tests/imap_close_variation3.phpt b/ext/imap/tests/imap_close_variation3.phpt index 777ca07124..d282ba1dfd 100644 --- a/ext/imap/tests/imap_close_variation3.phpt +++ b/ext/imap/tests/imap_close_variation3.phpt @@ -23,7 +23,7 @@ var_dump(imap_close($file_handle)); var_dump($file_handle); echo "\n-- Directory Resource opened with opendir() --\n"; -var_dump($dir_handle = opendir(dirname(__FILE__))); +var_dump($dir_handle = opendir(__DIR__)); var_dump(imap_close($dir_handle)); var_dump($dir_handle); ?> diff --git a/ext/imap/tests/imap_close_variation4.phpt b/ext/imap/tests/imap_close_variation4.phpt index 7a2d59b9b1..d71113ca85 100644 --- a/ext/imap/tests/imap_close_variation4.phpt +++ b/ext/imap/tests/imap_close_variation4.phpt @@ -2,7 +2,7 @@ Test imap_close() function : usage variations - different ints as $options arg --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_close() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $inputs = array (0, 3.2768e4, -32768, PHP_INT_MAX, -PHP_INT_MAX); @@ -61,7 +61,7 @@ foreach($inputs as $input) { ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_close() : usage variations *** diff --git a/ext/imap/tests/imap_createmailbox_basic.phpt b/ext/imap/tests/imap_createmailbox_basic.phpt index e827af5960..9d3cb83058 100644 --- a/ext/imap/tests/imap_createmailbox_basic.phpt +++ b/ext/imap/tests/imap_createmailbox_basic.phpt @@ -2,7 +2,7 @@ Test imap_createmailbox() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_createmailbox() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $imap_stream = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); diff --git a/ext/imap/tests/imap_errors_basic.phpt b/ext/imap/tests/imap_errors_basic.phpt index e4c7721393..0a42e95e1f 100644 --- a/ext/imap/tests/imap_errors_basic.phpt +++ b/ext/imap/tests/imap_errors_basic.phpt @@ -2,7 +2,7 @@ Test imap_errors() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -12,7 +12,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_errors() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $password = "bogus"; // invalid password to use in this test echo "Issue open with invalid password with normal default number of retries, i.e 3\n"; diff --git a/ext/imap/tests/imap_expunge_error.phpt b/ext/imap/tests/imap_expunge_error.phpt index f844cdcf11..f1298843bb 100644 --- a/ext/imap/tests/imap_expunge_error.phpt +++ b/ext/imap/tests/imap_expunge_error.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_fetch_overview_basic.phpt b/ext/imap/tests/imap_fetch_overview_basic.phpt index 152eaae9da..03aa9ae0a5 100644 --- a/ext/imap/tests/imap_fetch_overview_basic.phpt +++ b/ext/imap/tests/imap_fetch_overview_basic.phpt @@ -2,7 +2,7 @@ Test imap_fetch_overview() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -14,7 +14,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetch_overview() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // create a new mailbox and add two new messages to it $stream_id = setup_test_mailbox('', 2, $mailbox, 'notSimple'); @@ -47,7 +47,7 @@ imap_close($stream_id); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetch_overview() : basic functionality *** diff --git a/ext/imap/tests/imap_fetch_overview_error.phpt b/ext/imap/tests/imap_fetch_overview_error.phpt index 78510d6bd1..629535b0bf 100644 --- a/ext/imap/tests/imap_fetch_overview_error.phpt +++ b/ext/imap/tests/imap_fetch_overview_error.phpt @@ -2,7 +2,7 @@ Test imap_fetch_overview() function : error conditions - incorrect number of args --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetch_overview() : error conditions ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); //Test imap_fetch_overview with one more than the expected number of arguments echo "\n-- Testing imap_fetch_overview() function with more than expected no. of arguments --\n"; @@ -35,7 +35,7 @@ var_dump( imap_fetch_overview($stream_id) ); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetch_overview() : error conditions *** diff --git a/ext/imap/tests/imap_fetch_overview_variation1.phpt b/ext/imap/tests/imap_fetch_overview_variation1.phpt deleted file mode 100644 index a0508e6d0d..0000000000 --- a/ext/imap/tests/imap_fetch_overview_variation1.phpt +++ /dev/null @@ -1,221 +0,0 @@ ---TEST-- -Test imap_fetch_overview() function : usage variations - diff data types as $stream_id arg ---SKIPIF-- -<?php -extension_loaded('imap') or die('skip imap extension not available in this build'); -?> ---FILE-- -<?php -/* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options]) - * Description: Read an overview of the information in the headers - * of the given message sequence - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $stream_id argument to imap_fetch_overview() to test behaviour - */ - -echo "*** Testing imap_fetch_overview() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$msg_no = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed to $stream_id argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_fetch_overview() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Testing with first argument value: "; - var_dump($input); - var_dump( imap_fetch_overview($input, $msg_no) ); - $iterator++; -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imap_fetch_overview() : usage variations *** - --- Testing with first argument value: int(0) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Testing with first argument value: int(1) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Testing with first argument value: int(12345) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Testing with first argument value: int(-2345) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Testing with first argument value: float(10.5) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Testing with first argument value: float(-10.5) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Testing with first argument value: float(123456789000) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Testing with first argument value: float(1.23456789E-9) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Testing with first argument value: float(0.5) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Testing with first argument value: NULL - -Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- Testing with first argument value: NULL - -Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- Testing with first argument value: bool(true) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Testing with first argument value: bool(false) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Testing with first argument value: bool(true) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Testing with first argument value: bool(false) - -Warning: imap_fetch_overview() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Testing with first argument value: string(0) "" - -Warning: imap_fetch_overview() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Testing with first argument value: string(0) "" - -Warning: imap_fetch_overview() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Testing with first argument value: array(0) { -} - -Warning: imap_fetch_overview() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- Testing with first argument value: string(6) "string" - -Warning: imap_fetch_overview() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Testing with first argument value: string(6) "string" - -Warning: imap_fetch_overview() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Testing with first argument value: string(11) "hello world" - -Warning: imap_fetch_overview() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Testing with first argument value: object(classA)#1 (0) { -} - -Warning: imap_fetch_overview() expects parameter 1 to be resource, object given in %s on line %d -NULL - --- Testing with first argument value: NULL - -Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- Testing with first argument value: NULL - -Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d -NULL -===DONE=== diff --git a/ext/imap/tests/imap_fetch_overview_variation2.phpt b/ext/imap/tests/imap_fetch_overview_variation2.phpt deleted file mode 100644 index 4baa93ae06..0000000000 --- a/ext/imap/tests/imap_fetch_overview_variation2.phpt +++ /dev/null @@ -1,230 +0,0 @@ ---TEST-- -Test imap_fetch_overview() function : usage variations - diff data types as $msg_no arg ---SKIPIF-- -<?php -require_once(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -<?php -/* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options]) - * Description: Read an overview of the information in the headers - * of the given message sequence - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $msg_no argument to imap_fetch_overview() to test behaviour - */ - -echo "*** Testing imap_fetch_overview() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); - -// Initialise function arguments not being substituted -$stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to <<<ARGUMENT HERE>>> argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of imap_fetch_overview() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Testing with second argument value: "; - var_dump($input); - $overview = imap_fetch_overview($stream_id, $input); - if (!$overview) { - echo imap_last_error() . "\n"; - } else { - displayOverviewFields($overview[0]); - } - $iterator++; -}; - -fclose($fp); - -// clear the error stack -imap_errors(); -?> -===DONE=== ---CLEAN-- -<?php -require_once(dirname(__FILE__).'/clean.inc'); -?> ---EXPECTF-- -*** Testing imap_fetch_overview() : usage variations *** -Create a temporary mailbox and add 1 msgs -.. mailbox '{%s}%s' created - --- Testing with second argument value: int(0) -Sequence out of range - --- Testing with second argument value: int(1) -size is %d -uid is %d -msgno is 1 -recent is %d -flagged is 0 -answered is 0 -deleted is 0 -seen is 0 -draft is 0 -udate is OK - --- Testing with second argument value: int(12345) -Sequence out of range - --- Testing with second argument value: int(-2345) -Syntax error in sequence - --- Testing with second argument value: float(10.5) -Sequence out of range - --- Testing with second argument value: float(-10.5) -Syntax error in sequence - --- Testing with second argument value: float(123456789000) -Sequence out of range - --- Testing with second argument value: float(1.23456789E-9) -Sequence syntax error - --- Testing with second argument value: float(0.5) -Sequence out of range - --- Testing with second argument value: NULL -Sequence out of range - --- Testing with second argument value: NULL -Sequence out of range - --- Testing with second argument value: bool(true) -size is %d -uid is %d -msgno is 1 -recent is %d -flagged is 0 -answered is 0 -deleted is 0 -seen is 0 -draft is 0 -udate is OK - --- Testing with second argument value: bool(false) -Sequence out of range - --- Testing with second argument value: bool(true) -size is %d -uid is %d -msgno is 1 -recent is %d -flagged is 0 -answered is 0 -deleted is 0 -seen is 0 -draft is 0 -udate is OK - --- Testing with second argument value: bool(false) -Sequence out of range - --- Testing with second argument value: string(0) "" -Sequence out of range - --- Testing with second argument value: string(0) "" -Sequence out of range - --- Testing with second argument value: array(0) { -} - -Warning: imap_fetch_overview() expects parameter 2 to be string, array given in %s on line %d -Sequence out of range - --- Testing with second argument value: string(6) "string" -Syntax error in sequence - --- Testing with second argument value: string(6) "string" -Syntax error in sequence - --- Testing with second argument value: string(11) "hello world" -Syntax error in sequence - --- Testing with second argument value: object(classA)#1 (0) { -} -Syntax error in sequence - --- Testing with second argument value: NULL -Syntax error in sequence - --- Testing with second argument value: NULL -Syntax error in sequence - --- Testing with second argument value: resource(%d) of type (stream) - -Warning: imap_fetch_overview() expects parameter 2 to be string, resource given in %s on line %d -Syntax error in sequence -===DONE=== diff --git a/ext/imap/tests/imap_fetch_overview_variation3.phpt b/ext/imap/tests/imap_fetch_overview_variation3.phpt index a73845d1d6..3c52c73d90 100644 --- a/ext/imap/tests/imap_fetch_overview_variation3.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation3.phpt @@ -2,7 +2,7 @@ Test imap_fetch_overview() function : usage variations - FT_UID option --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -19,7 +19,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetch_overview() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Initialise required variables $stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message @@ -51,7 +51,7 @@ foreach($options as $option) { ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** diff --git a/ext/imap/tests/imap_fetch_overview_variation4.phpt b/ext/imap/tests/imap_fetch_overview_variation4.phpt index 4798344830..2aa89b75b6 100644 --- a/ext/imap/tests/imap_fetch_overview_variation4.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation4.phpt @@ -24,7 +24,7 @@ var_dump(imap_fetch_overview($file_pointer, 1)); fclose($file_pointer); echo "\n-- Directory Resource opened with opendir() --\n"; -var_dump($dir_handle = opendir(dirname(__FILE__))); +var_dump($dir_handle = opendir(__DIR__)); var_dump(imap_fetch_overview($dir_handle, 1)); closedir($dir_handle); ?> diff --git a/ext/imap/tests/imap_fetch_overview_variation5.phpt b/ext/imap/tests/imap_fetch_overview_variation5.phpt index d713a33934..c052b39384 100644 --- a/ext/imap/tests/imap_fetch_overview_variation5.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation5.phpt @@ -2,7 +2,7 @@ Test imap_fetch_overview() function : usage variations - $msg_no argument --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_fetch_overview() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs @@ -45,7 +45,7 @@ imap_errors(); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** diff --git a/ext/imap/tests/imap_fetch_overview_variation6.phpt b/ext/imap/tests/imap_fetch_overview_variation6.phpt index 4c2d3234f7..d284f9bf94 100644 --- a/ext/imap/tests/imap_fetch_overview_variation6.phpt +++ b/ext/imap/tests/imap_fetch_overview_variation6.phpt @@ -2,7 +2,7 @@ Test imap_fetch_overview() function : usage variations - multipart message --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -17,7 +17,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetch_overview() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 0, $mailbox); // setup temp mailbox create_multipart_message($stream_id, $mailbox); @@ -88,7 +88,7 @@ function create_multipart_message($imap_stream, $mailbox) { ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetch_overview() : usage variations *** diff --git a/ext/imap/tests/imap_fetchbody_basic.phpt b/ext/imap/tests/imap_fetchbody_basic.phpt index 2986f0e89e..66fa345535 100644 --- a/ext/imap/tests/imap_fetchbody_basic.phpt +++ b/ext/imap/tests/imap_fetchbody_basic.phpt @@ -2,7 +2,7 @@ Test imap_fetchbody() function : basic functionality --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_fetchbody() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Initialise all required variables @@ -59,7 +59,7 @@ var_dump( $overview[0]->seen ); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchbody() : basic functionality *** diff --git a/ext/imap/tests/imap_fetchbody_error.phpt b/ext/imap/tests/imap_fetchbody_error.phpt index a91599a305..c45371a813 100644 --- a/ext/imap/tests/imap_fetchbody_error.phpt +++ b/ext/imap/tests/imap_fetchbody_error.phpt @@ -2,7 +2,7 @@ Test imap_fetchbody() function : error conditions - incorrect number of args --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -17,7 +17,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_fetchbody() : error conditions ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); //Test imap_fetchbody with one more than the expected number of arguments echo "\n-- Testing imap_fetchbody() function with more than expected no. of arguments --\n"; @@ -38,7 +38,7 @@ var_dump( imap_fetchbody($stream_id, $msg_no) ); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchbody() : error conditions *** diff --git a/ext/imap/tests/imap_fetchbody_variation1.phpt b/ext/imap/tests/imap_fetchbody_variation1.phpt deleted file mode 100644 index 03bbfc782c..0000000000 --- a/ext/imap/tests/imap_fetchbody_variation1.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test imap_fetchbody() function : usage variation - diff data types as $stream_id arg ---SKIPIF-- -<?php -extension_loaded('imap') or die('skip imap extension not available in this build'); -?> ---FILE-- -<?php -/* Prototype : string imap_fetchbody(resource $stream_id, int $msg_no, string $section - * [, int $options]) - * Description: Get a specific body section - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $stream_id argument to test behaviour of imap_fetchbody() - */ - -echo "*** Testing imap_fetchbody() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$msg_no = 1; -$section = '2'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed to $stream_id argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_fetchbody() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( imap_fetchbody($input, $msg_no, $section) ); - $iterator++; -} -?> -===DONE=== ---EXPECTF-- -*** Testing imap_fetchbody() : usage variations *** - --- Iteration 1 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, int given in %s on line 85 -NULL - --- Iteration 2 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, int given in %s on line 85 -NULL - --- Iteration 3 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, int given in %s on line 85 -NULL - --- Iteration 4 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, int given in %s on line 85 -NULL - --- Iteration 5 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, float given in %s on line 85 -NULL - --- Iteration 6 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, float given in %s on line 85 -NULL - --- Iteration 7 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, float given in %s on line 85 -NULL - --- Iteration 8 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, float given in %s on line 85 -NULL - --- Iteration 9 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, float given in %s on line 85 -NULL - --- Iteration 10 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, null given in %s on line 85 -NULL - --- Iteration 11 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, null given in %s on line 85 -NULL - --- Iteration 12 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, bool given in %s on line 85 -NULL - --- Iteration 13 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, bool given in %s on line 85 -NULL - --- Iteration 14 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, bool given in %s on line 85 -NULL - --- Iteration 15 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, bool given in %s on line 85 -NULL - --- Iteration 16 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, string given in %s on line 85 -NULL - --- Iteration 17 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, string given in %s on line 85 -NULL - --- Iteration 18 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, array given in %s on line 85 -NULL - --- Iteration 19 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, string given in %s on line 85 -NULL - --- Iteration 20 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, string given in %s on line 85 -NULL - --- Iteration 21 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, string given in %s on line 85 -NULL - --- Iteration 22 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, object given in %s on line 85 -NULL - --- Iteration 23 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, null given in %s on line 85 -NULL - --- Iteration 24 -- - -Warning: imap_fetchbody() expects parameter 1 to be resource, null given in %s on line 85 -NULL -===DONE=== diff --git a/ext/imap/tests/imap_fetchbody_variation2.phpt b/ext/imap/tests/imap_fetchbody_variation2.phpt deleted file mode 100644 index 342c9cc5e6..0000000000 --- a/ext/imap/tests/imap_fetchbody_variation2.phpt +++ /dev/null @@ -1,221 +0,0 @@ ---TEST-- -Test imap_fetchbody() function : usage variation - diff data types as $msg_no arg ---SKIPIF-- -<?php -require_once(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -<?php -/* Prototype : string imap_fetchbody(resource $stream_id, int $msg_no, string $section - * [, int $options]) - * Description: Get a specific body section - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $msg_no argument to test behaviour of imap_fetchbody() - */ - -echo "*** Testing imap_fetchbody() : usage variations ***\n"; - -require_once(dirname(__FILE__).'/imap_include.inc'); - -// Initialise function arguments not being substituted -$stream_id = setup_test_mailbox('', 1); // set up temp mailbox with 1 simple msg -$section = '1'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed to $msg_no argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_fetchbody() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( imap_fetchbody($stream_id, $input, $section) ); - $iterator++; -}; -?> -===DONE=== ---CLEAN-- -<?php -require_once(dirname(__FILE__).'/clean.inc'); -?> ---EXPECTF-- -*** Testing imap_fetchbody() : usage variations *** -Create a temporary mailbox and add 1 msgs -.. mailbox '{%s}%s' created - --- Iteration 1 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 2 -- -string(%d) "1: this is a test message, please ignore%a" - --- Iteration 3 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 4 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 5 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 6 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 7 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 8 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 9 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 10 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 12 -- -string(%d) "1: this is a test message, please ignore%a" - --- Iteration 13 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 14 -- -string(%d) "1: this is a test message, please ignore%a" - --- Iteration 15 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 16 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: imap_fetchbody() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) - --- Iteration 24 -- - -Warning: imap_fetchbody(): Bad message number in %s on line %d -bool(false) -===DONE=== diff --git a/ext/imap/tests/imap_fetchbody_variation3.phpt b/ext/imap/tests/imap_fetchbody_variation3.phpt deleted file mode 100644 index 6a75e356b6..0000000000 --- a/ext/imap/tests/imap_fetchbody_variation3.phpt +++ /dev/null @@ -1,217 +0,0 @@ ---TEST-- -Test imap_fetchbody() function : usage variation - diff data types as $section arg ---SKIPIF-- -<?php -require_once(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -<?php -/* Prototype : string imap_fetchbody(resource $stream_id, int $msg_no, string $section - * [, int $options]) - * Description: Get a specific body section - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $section argument to test behaviour of imap_fetchbody() - */ - -echo "*** Testing imap_fetchbody() : usage variations ***\n"; - -require_once(dirname(__FILE__).'/imap_include.inc'); - -// Initialise function arguments not being substituted -$stream_id = setup_test_mailbox('', 1); // set up temp mailbox with 1 simple msg -$msg_no = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed to $section argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_fetchbody() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( imap_fetchbody($stream_id, $msg_no, $input) ); - $iterator++; -}; -?> -===DONE=== ---CLEAN-- -<?php -require_once(dirname(__FILE__).'/clean.inc'); -?> ---EXPECTF-- -*** Testing imap_fetchbody() : usage variations *** -Create a temporary mailbox and add 1 msgs -.. mailbox '%s.phpttest' created - --- Iteration 1 -- -string(%d) "From: %s -To: %s -Subject: test1 - -" - --- Iteration 2 -- -string(%d) "1: this is a test message, please ignore%a" - --- Iteration 3 -- -string(0) "" - --- Iteration 4 -- -string(0) "" - --- Iteration 5 -- -string(0) "" - --- Iteration 6 -- -string(0) "" - --- Iteration 7 -- -string(0) "" - --- Iteration 8 -- -string(0) "" - --- Iteration 9 -- -string(0) "" - --- Iteration 10 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 11 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 12 -- -string(%d) "1: this is a test message, please ignore%a" - --- Iteration 13 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 14 -- -string(%d) "1: this is a test message, please ignore%a" - --- Iteration 15 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 16 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 17 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 18 -- - -Warning: imap_fetchbody() expects parameter 3 to be string, array given in %s on line 87 -NULL - --- Iteration 19 -- -string(0) "" - --- Iteration 20 -- -string(0) "" - --- Iteration 21 -- -string(0) "" - --- Iteration 22 -- -string(0) "" - --- Iteration 23 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" - --- Iteration 24 -- -string(%d) "From: %s -To: %s -Subject: test1 - -1: this is a test message, please ignore%a" -===DONE=== diff --git a/ext/imap/tests/imap_fetchbody_variation4.phpt b/ext/imap/tests/imap_fetchbody_variation4.phpt index de336e4d50..3259ed9321 100644 --- a/ext/imap/tests/imap_fetchbody_variation4.phpt +++ b/ext/imap/tests/imap_fetchbody_variation4.phpt @@ -2,7 +2,7 @@ Test imap_fetchbody() function : usage variations - FT_UID option --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_fetchbody() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Initialise required variables $stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message @@ -48,7 +48,7 @@ foreach($options as $option) { ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchbody() : usage variations *** diff --git a/ext/imap/tests/imap_fetchbody_variation5.phpt b/ext/imap/tests/imap_fetchbody_variation5.phpt index 50589e4d0b..fa32d0e995 100644 --- a/ext/imap/tests/imap_fetchbody_variation5.phpt +++ b/ext/imap/tests/imap_fetchbody_variation5.phpt @@ -24,7 +24,7 @@ var_dump(imap_fetchbody($file_pointer, 1)); fclose($file_pointer); echo "\n-- Directory Resource opened with opendir() --\n"; -var_dump($dir_handle = opendir(dirname(__FILE__))); +var_dump($dir_handle = opendir(__DIR__)); var_dump(imap_fetchbody($dir_handle, 1)); closedir($dir_handle); ?> diff --git a/ext/imap/tests/imap_fetchbody_variation6.phpt b/ext/imap/tests/imap_fetchbody_variation6.phpt index ba3f788935..18f7d3a40d 100644 --- a/ext/imap/tests/imap_fetchbody_variation6.phpt +++ b/ext/imap/tests/imap_fetchbody_variation6.phpt @@ -2,7 +2,7 @@ Test imap_fetchbody() function : usage variations - $msg_no arg --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetchbody() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); //Initialise required variables $stream_id = setup_test_mailbox('', 3); // set up temp mailbox with simple msgs @@ -39,7 +39,7 @@ foreach($sequences as $msg_no) { ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchbody() : usage variations *** diff --git a/ext/imap/tests/imap_fetchheader_basic.phpt b/ext/imap/tests/imap_fetchheader_basic.phpt index 70bb66b2bd..4ffa34c09e 100644 --- a/ext/imap/tests/imap_fetchheader_basic.phpt +++ b/ext/imap/tests/imap_fetchheader_basic.phpt @@ -2,7 +2,7 @@ Test imap_fetchheader() function : basic function --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -12,7 +12,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_fetchheader() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Initialise all required variables $stream_id = setup_test_mailbox('', 1, $mailbox, 'multiPart'); // setup temp mailbox with 1 msg @@ -39,7 +39,7 @@ var_dump( imap_fetchheader($stream_id, $msg_no) ); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchheader() : basic functionality *** diff --git a/ext/imap/tests/imap_fetchheader_error.phpt b/ext/imap/tests/imap_fetchheader_error.phpt index 77f6002eb5..82a47b64f1 100644 --- a/ext/imap/tests/imap_fetchheader_error.phpt +++ b/ext/imap/tests/imap_fetchheader_error.phpt @@ -2,7 +2,7 @@ Test imap_fetchheader() function : error conditions - incorrect number of args --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -16,7 +16,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); */ echo "*** Testing imap_fetchheader() : error conditions ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); //Test imap_fetchheader with one more than the expected number of arguments echo "\n-- Testing imap_fetchheader() function with more than expected no. of arguments --\n"; diff --git a/ext/imap/tests/imap_fetchheader_variation1.phpt b/ext/imap/tests/imap_fetchheader_variation1.phpt deleted file mode 100644 index ff828832f6..0000000000 --- a/ext/imap/tests/imap_fetchheader_variation1.phpt +++ /dev/null @@ -1,245 +0,0 @@ ---TEST-- -Test imap_fetchheader() function : usage variations - diff data types as $stream_id arg ---SKIPIF-- -<?php -extension_loaded('imap') or die('skip imap extension not available in this build'); -?> ---FILE-- -<?php -/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) - * Description: Get the full unfiltered header for a message - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $stream_id argument to test behaviour of imap_fetchheader() - */ - -echo "*** Testing imap_fetchheader() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$msg_no = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get different types of array -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $stream_id argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // array data -/*21*/ array(), - $index_array, - $assoc_array, - array('foo', $index_array, $assoc_array), - - - // object data -/*25*/ new classA(), - - // undefined data -/*26*/ @$undefined_var, - - // unset data -/*27*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of imap_fetchheader() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( imap_fetchheader($input, $msg_no) ); - $iterator++; -}; -?> -===DONE=== ---EXPECTF-- -*** Testing imap_fetchheader() : usage variations *** - --- Iteration 1 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, object given in %s on line %d -NULL - --- Iteration 26 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d -NULL - --- Iteration 27 -- - -Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d -NULL -===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_variation2.phpt b/ext/imap/tests/imap_fetchheader_variation2.phpt deleted file mode 100644 index cba0d9061a..0000000000 --- a/ext/imap/tests/imap_fetchheader_variation2.phpt +++ /dev/null @@ -1,274 +0,0 @@ ---TEST-- -Test imap_fetchheader() function : usage variations - diff data types for $msg_no arg ---SKIPIF-- -<?php -require_once(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -<?php -/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options]) - * Description: Get the full unfiltered header for a message - * Source code: ext/imap/php_imap.c - */ - -/* - * Pass different data types as $msg_no argument to test behaviour of imap_fetchheader() - */ - -echo "*** Testing imap_fetchheader() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); - -// Initialise function arguments not being substituted -$stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $msg_no argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - - // string data -/*18*/ "string", - 'string', - $heredoc, - - // array data -/*21*/ array(), - $index_array, - $assoc_array, - array('foo', $index_array, $assoc_array), - - - // object data -/*25*/ new classA(), - - // undefined data -/*26*/ @$undefined_var, - - // unset data -/*27*/ @$unset_var, - - // resource variable -/*28*/ $fp -); - -// loop through each element of $inputs to check the behavior of imap_fetchheader() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( imap_fetchheader($stream_id, $input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---CLEAN-- -<?php -require_once(dirname(__FILE__).'/clean.inc'); -?> -===DONE=== ---EXPECTF-- -*** Testing imap_fetchheader() : usage variations *** -Create a temporary mailbox and add 1 msgs -.. mailbox '{%s}%s' created - --- Iteration 1 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 2 -- -string(%d) "From: foo@anywhere.com -Subject: Test msg 1 -To: %s -MIME-Version: 1.0 -Content-Type: MULTIPART/mixed; BOUNDARY="%s" - -" - --- Iteration 3 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 4 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 5 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 6 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 7 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 8 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 9 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 10 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 11 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 12 -- -string(%d) "From: foo@anywhere.com -Subject: Test msg 1 -To: %s -MIME-Version: 1.0 -Content-Type: MULTIPART/mixed; BOUNDARY="%s" - -" - --- Iteration 13 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 14 -- -string(%d) "From: foo@anywhere.com -Subject: Test msg 1 -To: %s -MIME-Version: 1.0 -Content-Type: MULTIPART/mixed; BOUNDARY="%s" - -" - --- Iteration 15 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 16 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, object given in %s on line %d -NULL - --- Iteration 26 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 27 -- - -Warning: imap_fetchheader(): Bad message number in %s on line %d -bool(false) - --- Iteration 28 -- - -Warning: imap_fetchheader() expects parameter 2 to be int, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/imap/tests/imap_fetchheader_variation3.phpt b/ext/imap/tests/imap_fetchheader_variation3.phpt index 728f8c3899..8230fdcf3e 100644 --- a/ext/imap/tests/imap_fetchheader_variation3.phpt +++ b/ext/imap/tests/imap_fetchheader_variation3.phpt @@ -2,7 +2,7 @@ Test imap_fetchheader() function : usage variations - FT_UID option --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -19,7 +19,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetchheader() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); // Initialise required variables $stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message @@ -46,7 +46,7 @@ foreach($options as $option) { ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchheader() : usage variations *** diff --git a/ext/imap/tests/imap_fetchheader_variation4.phpt b/ext/imap/tests/imap_fetchheader_variation4.phpt index 67c63077f4..05322f1527 100644 --- a/ext/imap/tests/imap_fetchheader_variation4.phpt +++ b/ext/imap/tests/imap_fetchheader_variation4.phpt @@ -23,7 +23,7 @@ var_dump(imap_fetchheader($file_pointer, 1)); fclose($file_pointer); echo "\n-- Directory Resource opened with opendir() --\n"; -var_dump($dir_handle = opendir(dirname(__FILE__))); +var_dump($dir_handle = opendir(__DIR__)); var_dump(imap_fetchheader($dir_handle, 1)); closedir($dir_handle); ?> diff --git a/ext/imap/tests/imap_fetchheader_variation5.phpt b/ext/imap/tests/imap_fetchheader_variation5.phpt index bdd6f6de60..8773621b09 100644 --- a/ext/imap/tests/imap_fetchheader_variation5.phpt +++ b/ext/imap/tests/imap_fetchheader_variation5.phpt @@ -2,7 +2,7 @@ Test imap_fetchheader() function : usage variations - $msg_no argument --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_fetchheader() : usage variations ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs @@ -40,7 +40,7 @@ imap_errors(); ===DONE=== --CLEAN-- <?php -require_once(dirname(__FILE__).'/clean.inc'); +require_once(__DIR__.'/clean.inc'); ?> --EXPECTF-- *** Testing imap_fetchheader() : usage variations *** diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt index dcf6148a1e..5d83a27427 100644 --- a/ext/imap/tests/imap_fetchstructure_basic.phpt +++ b/ext/imap/tests/imap_fetchstructure_basic.phpt @@ -4,7 +4,7 @@ imap_fetchstructure() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ echo "Checking with incorrect parameter type\n"; imap_fetchstructure(''); imap_fetchstructure(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); imap_fetchstructure($stream_id); diff --git a/ext/imap/tests/imap_gc_error.phpt b/ext/imap/tests/imap_gc_error.phpt index 7bfd95b8c0..e9b2222778 100644 --- a/ext/imap/tests/imap_gc_error.phpt +++ b/ext/imap/tests/imap_gc_error.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -16,7 +16,7 @@ echo "Checking with incorrect parameter type\n"; imap_gc('', false); imap_gc(false, false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); imap_gc($stream_id, -1); diff --git a/ext/imap/tests/imap_getsubscribed_basic.phpt b/ext/imap/tests/imap_getsubscribed_basic.phpt index cfe526844b..666203a8c2 100644 --- a/ext/imap/tests/imap_getsubscribed_basic.phpt +++ b/ext/imap/tests/imap_getsubscribed_basic.phpt @@ -4,7 +4,7 @@ imap_getsubscribed() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ echo "Checking with incorrect parameter type\n"; imap_getsubscribed(''); imap_getsubscribed(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); diff --git a/ext/imap/tests/imap_headerinfo_basic.phpt b/ext/imap/tests/imap_headerinfo_basic.phpt index 4334b62e8e..c13e62f8bf 100644 --- a/ext/imap/tests/imap_headerinfo_basic.phpt +++ b/ext/imap/tests/imap_headerinfo_basic.phpt @@ -4,12 +4,12 @@ imap_headerinfo() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); $z = imap_headerinfo($stream_id, 1); diff --git a/ext/imap/tests/imap_headerinfo_error.phpt b/ext/imap/tests/imap_headerinfo_error.phpt index 9869c3472e..8d67b70130 100644 --- a/ext/imap/tests/imap_headerinfo_error.phpt +++ b/ext/imap/tests/imap_headerinfo_error.phpt @@ -4,7 +4,7 @@ imap_headerinfo() incorrect parameter count Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ echo "Checking with incorrect parameter type\n"; imap_headerinfo(''); imap_headerinfo(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); diff --git a/ext/imap/tests/imap_headers.phpt b/ext/imap/tests/imap_headers.phpt index 60c04d406e..cd9d6d387f 100644 --- a/ext/imap/tests/imap_headers.phpt +++ b/ext/imap/tests/imap_headers.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc index ccb1685d73..369a560a5f 100644 --- a/ext/imap/tests/imap_include.inc +++ b/ext/imap/tests/imap_include.inc @@ -31,7 +31,7 @@ $mandatory_overview_fields = array( * * Special handling for 'udate', which will vary run-to-run; assumes an IMAP * server with its clock synced to the current system, which is consistent with - * setup instructions in ext/imap/tests/README + * setup instructions in ext/imap/tests/README.md * * @param array resp element from the return value of imap_fetch_overview() */ @@ -178,7 +178,7 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s } /** - * Get the mailbox name from a mailbox decription, i.e strip off server details. + * Get the mailbox name from a mailbox description, i.e strip off server details. * * @param string mailbox complete mailbox name * @return mailbox name diff --git a/ext/imap/tests/imap_list_basic.phpt b/ext/imap/tests/imap_list_basic.phpt index edd899c921..21f8a63894 100644 --- a/ext/imap/tests/imap_list_basic.phpt +++ b/ext/imap/tests/imap_list_basic.phpt @@ -4,7 +4,7 @@ imap_list() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ echo "Checking with incorrect parameter type\n"; imap_list(''); imap_list(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); diff --git a/ext/imap/tests/imap_lsub_basic.phpt b/ext/imap/tests/imap_lsub_basic.phpt index 0f7149917e..638479ca80 100644 --- a/ext/imap/tests/imap_lsub_basic.phpt +++ b/ext/imap/tests/imap_lsub_basic.phpt @@ -4,7 +4,7 @@ imap_lsub() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ echo "Checking with incorrect parameter type\n"; imap_lsub(''); imap_lsub(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); diff --git a/ext/imap/tests/imap_mail_copy.phpt b/ext/imap/tests/imap_mail_copy.phpt index c2aae5b176..12a85a1804 100644 --- a/ext/imap/tests/imap_mail_copy.phpt +++ b/ext/imap/tests/imap_mail_copy.phpt @@ -4,7 +4,7 @@ Test imap_mail_copy() incorrect parameters Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ imap_mail_copy(false); // more tests -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Test with IMAP server\n"; diff --git a/ext/imap/tests/imap_mail_copy_basic.phpt b/ext/imap/tests/imap_mail_copy_basic.phpt index 2171403cd1..a05951e8f6 100644 --- a/ext/imap/tests/imap_mail_copy_basic.phpt +++ b/ext/imap/tests/imap_mail_copy_basic.phpt @@ -4,7 +4,7 @@ Test imap_mail_copy() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_mail_copy() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; diff --git a/ext/imap/tests/imap_mail_move.phpt b/ext/imap/tests/imap_mail_move.phpt index 7d8e489557..122960b78c 100644 --- a/ext/imap/tests/imap_mail_move.phpt +++ b/ext/imap/tests/imap_mail_move.phpt @@ -4,7 +4,7 @@ Test imap_mail_move() incorrect parameters Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -18,7 +18,7 @@ imap_mail_move(false); // more tests -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Test with IMAP server\n"; diff --git a/ext/imap/tests/imap_mail_move_basic.phpt b/ext/imap/tests/imap_mail_move_basic.phpt index f33f4963fa..380d288d9b 100644 --- a/ext/imap/tests/imap_mail_move_basic.phpt +++ b/ext/imap/tests/imap_mail_move_basic.phpt @@ -4,7 +4,7 @@ Test imap_mail_move() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ require_once(dirname(__FILE__).'/skipif.inc'); echo "*** Testing imap_mail_move() : basic functionality ***\n"; -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); echo "Create a new mailbox for test\n"; diff --git a/ext/imap/tests/imap_num_msg_error.phpt b/ext/imap/tests/imap_num_msg_error.phpt index 69fb23f55b..fffa3ae951 100644 --- a/ext/imap/tests/imap_num_msg_error.phpt +++ b/ext/imap/tests/imap_num_msg_error.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_num_recent_error.phpt b/ext/imap/tests/imap_num_recent_error.phpt index 8929c46297..b0ad5cefa0 100644 --- a/ext/imap/tests/imap_num_recent_error.phpt +++ b/ext/imap/tests/imap_num_recent_error.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_open_error.phpt b/ext/imap/tests/imap_open_error.phpt index 83b0eba80e..b94c11d797 100644 --- a/ext/imap/tests/imap_open_error.phpt +++ b/ext/imap/tests/imap_open_error.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -20,7 +20,7 @@ echo "Checking with incorrect parameters\n" ; imap_open('', '', ''); imap_open('', '', '', -1); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); imap_open($default_mailbox, $username, $password, NIL, -1); ?> diff --git a/ext/imap/tests/imap_ping_error.phpt b/ext/imap/tests/imap_ping_error.phpt index 4757967d02..5c2498c302 100644 --- a/ext/imap/tests/imap_ping_error.phpt +++ b/ext/imap/tests/imap_ping_error.phpt @@ -5,7 +5,7 @@ Paul Sohier #phptestfest utrecht --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_renamemailbox_basic.phpt b/ext/imap/tests/imap_renamemailbox_basic.phpt index d8b3f485e5..91f99d13e3 100644 --- a/ext/imap/tests/imap_renamemailbox_basic.phpt +++ b/ext/imap/tests/imap_renamemailbox_basic.phpt @@ -4,7 +4,7 @@ imap_renamemailbox() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -16,7 +16,7 @@ imap_renamemailbox(''); imap_renamemailbox(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); diff --git a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt index ee17fb39b9..36fcc7f077 100644 --- a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt +++ b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt @@ -4,12 +4,12 @@ imap_rfc822_parse_headers() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); $z = imap_headerinfo($stream_id, 1); diff --git a/ext/imap/tests/imap_savebody_basic.phpt b/ext/imap/tests/imap_savebody_basic.phpt index 0c03d0033d..2be987a361 100644 --- a/ext/imap/tests/imap_savebody_basic.phpt +++ b/ext/imap/tests/imap_savebody_basic.phpt @@ -4,7 +4,7 @@ imap_savebody() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,12 +15,12 @@ echo "Checking with incorrect parameter type\n"; imap_savebody(''); imap_savebody(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); imap_savebody($stream_id); -$file = dirname(__FILE__).'/tmpsavebody.txt'; +$file = __DIR__.'/tmpsavebody.txt'; //with URL $z = imap_savebody($stream_id, $file, 1); @@ -38,7 +38,7 @@ imap_close($stream_id); ?> --CLEAN-- <?php -@unlink(dirname(__FILE__).'/tmpsavebody.txt'); +@unlink(__DIR__.'/tmpsavebody.txt'); require_once('clean.inc'); ?> --EXPECTF-- diff --git a/ext/imap/tests/imap_timeout_basic.phpt b/ext/imap/tests/imap_timeout_basic.phpt index 92c43bded7..a69b86b595 100644 --- a/ext/imap/tests/imap_timeout_basic.phpt +++ b/ext/imap/tests/imap_timeout_basic.phpt @@ -4,7 +4,7 @@ imap_timeout() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php diff --git a/ext/imap/tests/imap_undelete_basic.phpt b/ext/imap/tests/imap_undelete_basic.phpt index 1ec02600d7..7cc9ff3847 100644 --- a/ext/imap/tests/imap_undelete_basic.phpt +++ b/ext/imap/tests/imap_undelete_basic.phpt @@ -4,12 +4,12 @@ imap_undelete() function : basic functionality Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = setup_test_mailbox('', 1); imap_delete($stream_id, 1); diff --git a/ext/imap/tests/imap_undelete_error.phpt b/ext/imap/tests/imap_undelete_error.phpt index 3366c04f05..0eae8033eb 100644 --- a/ext/imap/tests/imap_undelete_error.phpt +++ b/ext/imap/tests/imap_undelete_error.phpt @@ -4,7 +4,7 @@ imap_undelete() incorrect parameter count Olivier Doucet --SKIPIF-- <?php -require_once(dirname(__FILE__).'/skipif.inc'); +require_once(__DIR__.'/skipif.inc'); ?> --FILE-- <?php @@ -15,7 +15,7 @@ echo "Checking with incorrect parameter type\n"; imap_undelete(''); imap_undelete(false); -require_once(dirname(__FILE__).'/imap_include.inc'); +require_once(__DIR__.'/imap_include.inc'); $stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox $default_mailbox: " . imap_last_error()); diff --git a/ext/imap/tests/skipif.inc b/ext/imap/tests/skipif.inc index 19ad7893bd..12b1408634 100644 --- a/ext/imap/tests/skipif.inc +++ b/ext/imap/tests/skipif.inc @@ -6,7 +6,7 @@ $mailbox = '{localhost/norsh}'; $username = 'webmaster@something.com'; $password = 'p4ssw0rd'; $options = OP_HALFOPEN; // this should be enough to verify server present -$retries = 0; // dont retry connect on failure +$retries = 0; // don't retry connect on failure $mbox = @imap_open($mailbox, $username, $password, $options, $retries); if (!$mbox) { |