Skip to content

Update ext/imap parameter names #6299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 122 additions & 123 deletions ext/imap/php_imap.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,251 +5,250 @@
/**
* @return resource|false
*/
function imap_open(string $mailbox, string $user, string $password, int $options = 0, int $n_retries = 0, array $params = []) {}
function imap_open(string $mailbox, string $user, string $password, int $flags = 0, int $retries = 0, array $options = []) {}

/**
* @param resource $stream_id
* @param resource $imap
*/
function imap_reopen($stream_id, string $mailbox, int $options = 0, int $n_retries = 0): bool {}
function imap_reopen($imap, string $mailbox, int $flags = 0, int $retries = 0): bool {}

/**
* @param resource $stream_id
* @param resource $imap
*/
function imap_close($stream_id, int $options = 0): bool {}
function imap_close($imap, int $flags = 0): bool {}

/** @param resource $stream_id */
function imap_num_msg($stream_id): int|false {}
/** @param resource $imap */
function imap_num_msg($imap): int|false {}

/** @param resource $stream_id */
function imap_num_recent($stream_id): int|false {}
/** @param resource $imap */
function imap_num_recent($imap): int|false {}

/** @param resource $stream_id */
function imap_headers($stream_id): array|false {}
/** @param resource $imap */
function imap_headers($imap): array|false {}

/** @param resource $stream_id */
function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0): stdClass|false {}
/** @param resource $imap */
function imap_headerinfo($imap, int $message_num, int $from_length = 0, int $subject_length = 0): stdClass|false {}

function imap_rfc822_parse_headers(string $headers, string $default_host = "UNKNOWN"): stdClass {}
function imap_rfc822_parse_headers(string $headers, string $default_hostname = "UNKNOWN"): stdClass {}

function imap_rfc822_write_address(string $mailbox, string $host, string $personal): string|false {}
function imap_rfc822_write_address(string $mailbox, string $hostname, string $personal): string|false {}

function imap_rfc822_parse_adrlist(string $address_string, string $default_host): array {}
function imap_rfc822_parse_adrlist(string $string, string $default_hostname): array {}

/** @param resource $stream_id */
function imap_body($stream_id, int $msg_no, int $options = 0): string|false {}
/** @param resource $imap */
function imap_body($imap, int $message_num, int $flags = 0): string|false {}

/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_body
*/
function imap_fetchtext($stream_id, int $msg_no, int $options = 0): string|false {}
function imap_fetchtext($imap, int $message_num, int $flags = 0): string|false {}

/**
* @param resource $stream_id
* @param resource $imap
* @return stdClass|false
*/
function imap_bodystruct($stream_id, int $msg_no, string $section) {}
function imap_bodystruct($imap, int $message_num, string $section) {}

/** @param resource $stream_id */
function imap_fetchbody($stream_id, int $msg_no, string $section, int $options = 0): string|false {}
/** @param resource $imap */
function imap_fetchbody($imap, int $message_num, string $section, int $flags = 0): string|false {}

/** @param resource $stream_id */
function imap_fetchmime($stream_id, int $msg_no, string $section, int $options = 0): string|false {}
/** @param resource $imap */
function imap_fetchmime($imap, int $message_num, string $section, int $flags = 0): string|false {}

/**
* @param resource $stream_id
* @param resource $imap
* @param resource|string|int $file
*/
function imap_savebody($stream_id, $file, int $msg_no, string $section = "", int $options = 0): bool {}
function imap_savebody($imap, $file, int $message_num, string $section = "", int $flags = 0): bool {}

/** @param resource $stream_id */
function imap_fetchheader($stream_id, int $msg_no, int $options = 0): string|false {}
/** @param resource $imap */
function imap_fetchheader($imap, int $message_num, int $flags = 0): string|false {}

/** @param resource $stream_id */
function imap_fetchstructure($stream_id, int $msg_no, int $options = 0): stdClass|false {}
/** @param resource $imap */
function imap_fetchstructure($imap, int $message_num, int $flags = 0): stdClass|false {}

/**
* @param resource $stream_id
* @param resource $imap
*/
function imap_gc($stream_id, int $flags): bool {}
function imap_gc($imap, int $flags): bool {}

/**
* @param resource $stream_id
* @param resource $imap
*/
function imap_expunge($stream_id): bool {}
function imap_expunge($imap): bool {}

/**
* @param resource $stream_id
* @param resource $imap
*/
function imap_delete($stream_id, string $msg_no, int $options = 0): bool {}
function imap_delete($imap, string $message_num, int $flags = 0): bool {}

/**
* @param resource $stream_id
* @param resource $imap
*/
function imap_undelete($stream_id, string $msg_no, int $options = 0): bool {}
function imap_undelete($imap, string $message_num, int $flags = 0): bool {}

/** @param resource $stream_id */
function imap_check($stream_id): stdClass|false {}
/** @param resource $imap */
function imap_check($imap): stdClass|false {}

/** @param resource $stream_id */
function imap_listscan($stream_id, string $ref, string $pattern, string $content): array|false {}
/** @param resource $imap */
function imap_listscan($imap, string $reference, string $pattern, string $content): array|false {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to track the $ref parameter all the way down to https://github.com/uw-imap/imap/blob/22f316e36dc00e445408f7a47750b7fa9c3ce369/src/c-client/imap4r1.c#L518, and I still have no clue what it does. The docs say:

ref should normally be just the server specification as described in imap_open()

So maybe it is the "server part" of $mailbox? I have no idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to be another IMAP mailbox, but that doesn't make a lot of sense as we are already passing a mailbox.. I have no idea either.


/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_listscan
*/
function imap_scan($stream_id, string $ref, string $pattern, string $content): array|false {}
function imap_scan($imap, string $reference, string $pattern, string $content): array|false {}

/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_listscan
*/
function imap_scanmailbox($stream_id, string $ref, string $pattern, string $content): array|false {}
function imap_scanmailbox($imap, string $reference, string $pattern, string $content): array|false {}

/** @param resource $stream_id */
function imap_mail_copy($stream_id, string $msglist, string $mailbox, int $options = 0): bool {}
/** @param resource $imap */
function imap_mail_copy($imap, string $message_nums, string $mailbox, int $flags = 0): bool {}

/** @param resource $stream_id */
function imap_mail_move($stream_id, string $sequence, string $mailbox, int $options = 0): bool {}
/** @param resource $imap */
function imap_mail_move($imap, string $message_nums, string $mailbox, int $flags = 0): bool {}

function imap_mail_compose(array $envelope, array $body): string|false {}

/** @param resource $stream_id */
function imap_createmailbox($stream_id, string $mailbox): bool {}
/** @param resource $imap */
function imap_createmailbox($imap, string $mailbox): bool {}

/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_createmailbox
*/
function imap_create($stream_id, string $mailbox): bool {}
function imap_create($imap, string $mailbox): bool {}

/** @param resource $stream_id */
function imap_renamemailbox($stream_id, string $old_name, string $new_name): bool {}
/** @param resource $imap */
function imap_renamemailbox($imap, string $from, string $to): bool {}

/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_renamemailbox
*/
function imap_rename($stream_id, string $old_name, string $new_name): bool {}
function imap_rename($imap, string $from, string $to): bool {}

/** @param resource $stream_id */
function imap_deletemailbox($stream_id, string $mailbox): bool {}
/** @param resource $imap */
function imap_deletemailbox($imap, string $mailbox): bool {}

/** @param resource $stream_id */
function imap_subscribe($stream_id, string $mailbox): bool {}
/** @param resource $imap */
function imap_subscribe($imap, string $mailbox): bool {}

/** @param resource $stream_id */
function imap_unsubscribe($stream_id, string $mailbox): bool {}
/** @param resource $imap */
function imap_unsubscribe($imap, string $mailbox): bool {}

/** @param resource $stream_id */
function imap_append($stream_id, string $folder, string $message, ?string $options = null, ?string $internal_date = null): bool {}
/** @param resource $imap */
function imap_append($imap, string $folder, string $message, ?string $options = null, ?string $internal_date = null): bool {}

/** @param resource $stream_id */
function imap_ping($stream_id): bool {}
/** @param resource $imap */
function imap_ping($imap): bool {}

function imap_base64(string $text): string|false {}
function imap_base64(string $string): string|false {}

function imap_qprint(string $text): string|false {}
function imap_qprint(string $string): string|false {}

function imap_8bit(string $text): string|false {}

function imap_binary(string $text): string|false {}
function imap_8bit(string $string): string|false {}

function imap_binary(string $string): string|false {}

function imap_utf8(string $mime_encoded_text): string {}

/**
* @param resource $stream_id
* @param resource $imap
* @return stdClass|false
*/
function imap_status($stream_id, string $mailbox, int $options) {}
function imap_status($imap, string $mailbox, int $flags) {}

/** @param resource $stream_id */
function imap_mailboxmsginfo($stream_id): stdClass {}
/** @param resource $imap */
function imap_mailboxmsginfo($imap): stdClass {}

/** @param resource $stream_id */
function imap_setflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
/** @param resource $imap */
function imap_setflag_full($imap, string $sequence, string $flag, int $options = 0): bool {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dilemma: This has an integer flags argument, but also a $flag argument ... I kept the $options name to avoid confusion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem like a big problem, so I agree with the approach taken


/** @param resource $stream_id */
function imap_clearflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
/** @param resource $imap */
function imap_clearflag_full($imap, 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 = null, ?string $charset = null): array|false {}
/** @param resource $imap */
function imap_sort($imap, int $criteria, int $reverse, int $flags = 0, ?string $search_criteria = null, ?string $charset = null): array|false {}

/** @param resource $stream_id */
function imap_uid($stream_id, int $msg_no): int|false {}
/** @param resource $imap */
function imap_uid($imap, int $message_num): int|false {}

/** @param resource $stream_id */
function imap_msgno($stream_id, int $unique_msg_id): int|false {}
/** @param resource $imap */
function imap_msgno($imap, int $message_uid): int|false {}

/** @param resource $stream_id */
function imap_list($stream_id, string $ref, string $pattern): array|false {}
/** @param resource $imap */
function imap_list($imap, string $reference, string $pattern): array|false {}

/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_list
*/
function imap_listmailbox($stream_id, string $ref, string $pattern): array|false {}
function imap_listmailbox($imap, string $reference, string $pattern): array|false {}

/** @param resource $stream_id */
function imap_lsub($stream_id, string $ref, string $pattern): array|false {}
/** @param resource $imap */
function imap_lsub($imap, string $reference, string $pattern): array|false {}

/**
* @param resource $stream_id
* @param resource $imap
* @alias imap_lsub
*/
function imap_listsubscribed($stream_id, string $ref, string $pattern): array|false {}
function imap_listsubscribed($imap, string $reference, string $pattern): array|false {}

/** @param resource $stream_id */
function imap_getsubscribed($stream_id, string $ref, string $pattern): array|false {}
/** @param resource $imap */
function imap_getsubscribed($imap, string $reference, string $pattern): array|false {}

/** @param resource $stream_id */
function imap_getmailboxes($stream_id, string $ref, string $pattern): array|false {}
/** @param resource $imap */
function imap_getmailboxes($imap, string $reference, string $pattern): array|false {}

/** @param resource $stream_id */
function imap_fetch_overview($stream_id, string $sequence, int $options = 0): array|false {}
/** @param resource $imap */
function imap_fetch_overview($imap, string $sequence, int $flags = 0): array|false {}

function imap_alerts(): array|false {}

function imap_errors(): array|false {}

function imap_last_error(): string|false {}

/** @param resource $stream_id */
function imap_search($stream_id, string $criteria, int $options = SE_FREE, string $charset = ""): array|false {}
/** @param resource $imap */
function imap_search($imap, string $criteria, int $flags = SE_FREE, string $charset = ""): array|false {}

function imap_utf7_decode(string $buf): string|false {}
function imap_utf7_decode(string $string): string|false {}

function imap_utf7_encode(string $buf): string {}
function imap_utf7_encode(string $string): string {}

#ifdef HAVE_IMAP_MUTF7
function imap_utf8_to_mutf7(string $in): string|false {}
function imap_utf8_to_mutf7(string $string): string|false {}

function imap_mutf7_to_utf8(string $in): string|false {}
function imap_mutf7_to_utf8(string $string): string|false {}
#endif

function imap_mime_header_decode(string $str): array|false {}
function imap_mime_header_decode(string $string): array|false {}

/** @param resource $stream_id */
function imap_thread($stream_id, int $options = SE_FREE): array|false {}
/** @param resource $imap */
function imap_thread($imap, int $flags = SE_FREE): array|false {}

function imap_timeout(int $timeout_type, int $timeout = -1): int|bool {}

#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
/** @param resource $stream_id */
function imap_get_quota($stream_id, string $qroot): array|false {}
/** @param resource $imap */
function imap_get_quota($imap, string $quota_root): array|false {}

/** @param resource $stream_id */
function imap_get_quotaroot($stream_id, string $mbox): array|false {}
/** @param resource $imap */
function imap_get_quotaroot($imap, string $mailbox): array|false {}

/** @param resource $stream_id */
function imap_set_quota($stream_id, string $qroot, int $mailbox_size): bool {}
/** @param resource $imap */
function imap_set_quota($imap, string $quota_root, int $mailbox_size): bool {}

/** @param resource $stream_id */
function imap_setacl($stream_id, string $mailbox, string $id, string $rights): bool {}
/** @param resource $imap */
function imap_setacl($imap, string $mailbox, string $user_id, string $rights): bool {}

/** @param resource $stream_id */
function imap_getacl($stream_id, string $mailbox): array|false {}
/** @param resource $imap */
function imap_getacl($imap, string $mailbox): array|false {}
#endif

function imap_mail(string $to, string $subject, string $message, ?string $additional_headers = null, ?string $cc = null, ?string $bcc = null, ?string $rpath = null): bool {}
function imap_mail(string $to, string $subject, string $message, ?string $additional_headers = null, ?string $cc = null, ?string $bcc = null, ?string $return_path = null): bool {}
Loading