diff options
| -rw-r--r-- | UPGRADING | 4 | ||||
| -rw-r--r-- | ext/imap/php_imap.c | 28 | ||||
| -rw-r--r-- | ext/imap/php_imap.stub.php | 16 | ||||
| -rw-r--r-- | ext/imap/php_imap_arginfo.h | 24 |
4 files changed, 31 insertions, 41 deletions
@@ -325,6 +325,10 @@ PHP 8.0 UPGRADE NOTES . iconv() implementations which do not properly set errno in case of errors are no longer supported. +- IMAP: + . The unused default_host argument of imap_headerinfo() has been removed. + . The imap_header() function which is an alias of imap_headerinfo() has been removed. + - Intl: . The deprecated constant INTL_IDNA_VARIANT_2003 has been removed. RFC: https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 6549f3f6fc..d8c07a86dd 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -702,10 +702,10 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) zend_long retries = 0, flags = NIL, cl_flags = NIL; MAILSTREAM *imap_stream; pils *imap_le_struct; - zval *params = NULL; + HashTable *params = NULL; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc, "PSS|lla", &mailbox, &user, + if (zend_parse_parameters(argc, "PSS|llh", &mailbox, &user, &passwd, &flags, &retries, ¶ms) == FAILURE) { RETURN_THROWS(); } @@ -723,7 +723,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (params) { zval *disabled_auth_method; - if ((disabled_auth_method = zend_hash_str_find(Z_ARRVAL_P(params), "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR") - 1)) != NULL) { + if ((disabled_auth_method = zend_hash_str_find(params, "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR") - 1)) != NULL) { switch (Z_TYPE_P(disabled_auth_method)) { case IS_STRING: if (Z_STRLEN_P(disabled_auth_method) > 1) { @@ -866,7 +866,7 @@ PHP_FUNCTION(imap_append) pils *imap_le_struct; STRING st; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS|SS", &streamind, &folder, &message, &flags, &internal_date) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS|S!S!", &streamind, &folder, &message, &flags, &internal_date) == FAILURE) { RETURN_THROWS(); } @@ -1603,7 +1603,6 @@ PHP_FUNCTION(imap_undelete) PHP_FUNCTION(imap_headerinfo) { zval *streamind; - zend_string *defaulthost = NULL; int argc = ZEND_NUM_ARGS(); zend_long msgno, fromlength, subjectlength; pils *imap_le_struct; @@ -1611,7 +1610,7 @@ PHP_FUNCTION(imap_headerinfo) ENVELOPE *en; char dummy[2000], fulladdress[MAILTMPLEN + 1]; - if (zend_parse_parameters(argc, "rl|llS", &streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) { + if (zend_parse_parameters(argc, "rl|ll", &streamind, &msgno, &fromlength, &subjectlength) == FAILURE) { RETURN_THROWS(); } @@ -2645,9 +2644,8 @@ PHP_FUNCTION(imap_sort) char *search_criteria; SORTPGM *mypgm=NIL; SEARCHPGM *spg=NIL; - int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc, "rll|lSS", &streamind, &pgm, &rev, &flags, &criteria, &charset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll|lS!S!", &streamind, &pgm, &rev, &flags, &criteria, &charset) == FAILURE) { RETURN_THROWS(); } @@ -2659,13 +2657,11 @@ PHP_FUNCTION(imap_sort) php_error_docref(NULL, E_WARNING, "Unrecognized sort criteria"); RETURN_FALSE; } - if (argc >= 4) { - if (flags < 0) { - php_error_docref(NULL, E_WARNING, "Search options parameter has to be greater than or equal to 0"); - RETURN_FALSE; - } + if (flags < 0) { + php_error_docref(NULL, E_WARNING, "Search options parameter has to be greater than or equal to 0"); + RETURN_FALSE; } - if (argc >= 5) { + if (criteria) { search_criteria = estrndup(ZSTR_VAL(criteria), ZSTR_LEN(criteria)); spg = mail_criteria(search_criteria); efree(search_criteria); @@ -2678,7 +2674,7 @@ PHP_FUNCTION(imap_sort) mypgm->function = (short) pgm; mypgm->next = NIL; - slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? ZSTR_VAL(charset) : NIL), spg, mypgm, (argc >= 4 ? flags : NIL)); + slst = mail_sort(imap_le_struct->imap_stream, (charset ? ZSTR_VAL(charset) : NIL), spg, mypgm, flags); if (spg && !(flags & SE_FREE)) { mail_free_searchpgm(&spg); @@ -3579,7 +3575,7 @@ PHP_FUNCTION(imap_mail) zend_string *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *cc=NULL, *bcc=NULL, *rpath=NULL; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc, "PPP|PPPP", &to, &subject, &message, + if (zend_parse_parameters(argc, "PPP|P!P!P!P!", &to, &subject, &message, &headers, &cc, &bcc, &rpath) == FAILURE) { RETURN_THROWS(); } diff --git a/ext/imap/php_imap.stub.php b/ext/imap/php_imap.stub.php index 9d2e1082c1..0a7adc2736 100644 --- a/ext/imap/php_imap.stub.php +++ b/ext/imap/php_imap.stub.php @@ -5,7 +5,7 @@ /** * @return resource|false */ -function imap_open(string $mailbox, string $user, string $password, int $options = 0, int $n_retries = 0, array $params = UNKNOWN) {} +function imap_open(string $mailbox, string $user, string $password, int $options = 0, int $n_retries = 0, array $params = []) {} /** * @param resource $stream_id @@ -27,13 +27,7 @@ function imap_num_recent($stream_id): int|false {} function imap_headers($stream_id): array|false {} /** @param resource $stream_id */ -function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {} - -/** - * @param resource $stream_id - * @alias imap_headerinfo - */ -function imap_header($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {} +function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0): stdClass|false {} function imap_rfc822_parse_headers(string $headers, string $default_host = "UNKNOWN"): stdClass {} @@ -148,7 +142,7 @@ function imap_subscribe($stream_id, string $mailbox): bool {} function imap_unsubscribe($stream_id, string $mailbox): bool {} /** @param resource $stream_id */ -function imap_append($stream_id, string $folder, string $message, string $options = UNKNOWN, string $internal_date = UNKNOWN): bool {} +function imap_append($stream_id, string $folder, string $message, ?string $options = null, ?string $internal_date = null): bool {} /** @param resource $stream_id */ function imap_ping($stream_id): bool {} @@ -180,7 +174,7 @@ function imap_setflag_full($stream_id, string $sequence, string $flag, int $opti function imap_clearflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {} /** @param resource $stream_id */ -function imap_sort($stream_id, int $criteria, int $reverse, int $options = 0, string $search_criteria = UNKNOWN, string $charset = UNKNOWN): array|false {} +function imap_sort($stream_id, int $criteria, int $reverse, int $options = 0, ?string $search_criteria = null, ?string $charset = null): array|false {} /** @param resource $stream_id */ function imap_uid($stream_id, int $msg_no): int|false {} @@ -258,4 +252,4 @@ function imap_setacl($stream_id, string $mailbox, string $id, string $rights): b function imap_getacl($stream_id, string $mailbox): array|false {} #endif -function imap_mail(string $to, string $subject, string $message, string $additional_headers = UNKNOWN, string $cc = UNKNOWN, string $bcc = UNKNOWN, string $rpath = UNKNOWN): bool {} +function imap_mail(string $to, string $subject, string $message, ?string $additional_headers = null, ?string $cc = null, ?string $bcc = null, ?string $rpath = null): bool {} diff --git a/ext/imap/php_imap_arginfo.h b/ext/imap/php_imap_arginfo.h index 69fe25e4d0..ffb60a034f 100644 --- a/ext/imap/php_imap_arginfo.h +++ b/ext/imap/php_imap_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4991f82d78672ab23044864fa6dd75851952965c */ + * Stub hash: e501d6869d721ad720a1a7c8b597b96e9591d5ed */ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0) @@ -7,7 +7,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, n_retries, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, params, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_reopen, 0, 2, _IS_BOOL, 0) @@ -37,11 +37,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imap_headerinfo, 0, 2, stdCl ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, from_length, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, subject_length, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_imap_header arginfo_imap_headerinfo - ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_imap_rfc822_parse_headers, 0, 1, stdClass, 0) ZEND_ARG_TYPE_INFO(0, headers, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, default_host, IS_STRING, 0, "\"UNKNOWN\"") @@ -173,8 +170,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_append, 0, 3, _IS_BOOL, 0) ZEND_ARG_INFO(0, stream_id) ZEND_ARG_TYPE_INFO(0, folder, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, internal_date, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, internal_date, IS_STRING, 1, "null") ZEND_END_ARG_INFO() #define arginfo_imap_ping arginfo_imap_expunge @@ -217,8 +214,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_sort, 0, 3, MAY_BE_ARRAY|MA ZEND_ARG_TYPE_INFO(0, criteria, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, reverse, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO(0, search_criteria, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, search_criteria, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_uid, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) @@ -342,10 +339,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, additional_headers, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, cc, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, bcc, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, rpath, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_headers, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cc, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, bcc, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, rpath, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -440,7 +437,6 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(imap_num_recent, arginfo_imap_num_recent) ZEND_FE(imap_headers, arginfo_imap_headers) ZEND_FE(imap_headerinfo, arginfo_imap_headerinfo) - ZEND_FALIAS(imap_header, imap_headerinfo, arginfo_imap_header) ZEND_FE(imap_rfc822_parse_headers, arginfo_imap_rfc822_parse_headers) ZEND_FE(imap_rfc822_write_address, arginfo_imap_rfc822_write_address) ZEND_FE(imap_rfc822_parse_adrlist, arginfo_imap_rfc822_parse_adrlist) |
