Skip to content

Stdlib: mb_encode_mimeheader()/mb_decode_mimeheader() — MIME header encoding missing (ext/mbstring/mbstring.c) #6038

Description

@PurHur

Category

stdlib

Problem

ext/mbstring provides mb_encode_mimeheader() and mb_decode_mimeheader() for RFC 2047 encoded-word headers (mail subjects, HTTP headers with non-ASCII). This compiler has partial mbstring (mb_strlen yes) but function_exists('mb_encode_mimeheader') / mb_decode_mimeheader() → false on VM.

Mail and i18n code targeting PHP 8.x expects these alongside mb_convert_encoding() (tracked #3075).

php-src reference

Repro

./script/docker-exec.sh -- php bin/vm.php -r '
echo function_exists("mb_encode_mimeheader") ? "yes" : "no", PHP_EOL;
echo function_exists("mb_decode_mimeheader") ? "yes" : "no", PHP_EOL;
'

Observed (VM):

mb_encode_mimeheader: no
mb_decode_mimeheader: no

Zend PHP expected: both exist; round-trip non-ASCII subject lines per php-src tests.

Scope (this repo)

Done when

  • Both functions registered; function_exists → true
  • Round-trip: mb_decode_mimeheader(mb_encode_mimeheader("日本語", "UTF-8")) matches Zend for UTF-8 fixtures
  • Enum case string operands throw catchable TypeError, not silent coerce / VM fatal
  • test/compliance/cases/stdlib/mb_encode_mimeheader.phpt green on VM
  • ./script/docker-exec.sh -- vendor/bin/phpunit --filter MbEncodeMimeheader

Implementation hints (PHP-in-PHP)

Verification

  • test/compliance/cases/stdlib/mb_encode_mimeheader.phpt

Links

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 apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions