Skip to content

Stdlib: imap_mail_compose() missing when IMAP advertised (ext/imap/php_imap.stub.php) #27765

Description

@PurHur

Category

enhancement · php-src-strict · IMAP surface · pillar 4

Problem

IMAP is advertised (extension_loaded("imap"), imap_open), but imap_mail_compose() is missing. php-src builds MIME message text from envelope + body-section arrays — needed for outbound mail composition without shelling out.

Verified 2026-08-05 on tip 49577690f. Sibling gaps already tracked: #27681 utf7, #27674 imap_is_open, #27680 imap_timeout; mutf7 filed separately. Also missing nearby: imap_mail_copy / imap_mail_move (file follow-ups if still absent after this lands).

Repro php-src stub VM (IMAP on)
function_exists("imap_mail_compose") true false

php-src reference

PHP implementation target

  • ext/imap/ PHP MIME compose helper matching Zend envelope/body keys (at least a documented subset: from/to/subject + text body section)
  • Register in IMAP Module.php; Reflection parity with stubs
  • PHP-in-PHP; no new C runtime

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/imap_mail_compose.php <<'"'"'PHP'"'"'
<?php
echo "ext=", extension_loaded("imap") ? "Y" : "N", "\n";
echo "compose=", function_exists("imap_mail_compose") ? "Y" : "N", "\n";
if (function_exists("imap_mail_compose")) {
  $envelope = ["from" => "a@example.com", "to" => "b@example.com", "subject" => "Hi"];
  $body = [["type" => TYPEMULTIPART], ["type" => TYPETEXT, "subtype" => "plain", "contents.data" => "hello"]];
  $msg = imap_mail_compose($envelope, $body);
  echo is_string($msg) && str_contains($msg, "hello") ? "OK\n" : "BAD\n";
}
PHP
php bin/vm.php /tmp/imap_mail_compose.php
'

Done when

  • function_exists("imap_mail_compose") true when IMAP advertised
  • Minimal envelope+text body compose matches Zend structure closely enough for a compliance .phpt (document unsupported keys)
  • Reflection matches stub; VM+JIT; php-src-strict

Gate context (2026-08-05)

  • user_release_ready: no — spine / north-star5-fast red (SscanfStrtolApply.php)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions