Skip to content

Stdlib: imap_mutf7_to_utf8()/imap_utf8_to_mutf7() missing when IMAP advertised (ext/imap/php_imap.stub.php) #27764

Description

@PurHur

Category

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

Problem

extension_loaded("imap") / imap_open are advertised, but Modified UTF-7 mailbox-name converters from php-src are absent. Distinct from #27681 (imap_utf7_decode / imap_utf7_encode — different API) and from #27674 / #27680 (imap_is_open / imap_timeout).

Verified 2026-08-05 on tip 49577690f inside ./script/docker-exec.sh.

Symbol Zend (php-src stub) VM (IMAP advertised)
extension_loaded("imap") (host may lack ext) true
function_exists("imap_open") — true
function_exists("imap_mutf7_to_utf8") present in stubs false
function_exists("imap_utf8_to_mutf7") present in stubs false

php-src reference

PHP implementation target

  • ext/imap/ PHP implementations + Module registration + Reflection stubs matching php-src
  • Prefer pure PHP Modified UTF-7 codec (no new runtime/*.c); wire JIT/AOT via existing Internal pattern
  • PHP-in-PHP first

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/imap_mutf7.php <<'"'"'PHP'"'"'
<?php
echo "ext=", extension_loaded("imap") ? "Y" : "N", "\n";
echo "open=", function_exists("imap_open") ? "Y" : "N", "\n";
echo "mutf7_to_utf8=", function_exists("imap_mutf7_to_utf8") ? "Y" : "N", "\n";
echo "utf8_to_mutf7=", function_exists("imap_utf8_to_mutf7") ? "Y" : "N", "\n";
if (function_exists("imap_utf8_to_mutf7") && function_exists("imap_mutf7_to_utf8")) {
  $m = imap_utf8_to_mutf7("Test");
  echo "round=", imap_mutf7_to_utf8($m), "\n";
}
PHP
php bin/vm.php /tmp/imap_mutf7.php
'

Done when

  • Both functions exist when IMAP is advertised; Reflection names/types match php-src stubs
  • Round-trip / known Modified UTF-7 vectors match Zend (or documented subset with compliance .phpt)
  • VM + JIT agree; php-src-strict; no php-compiler-strict shortcut

Gate context (2026-08-05)

  • user_release_ready: no — spine coverage missing SscanfStrtolApply.php; north-star5-fast red

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