Skip to content

Stdlib: imap_timeout() + IMAP_*TIMEOUT constants missing when IMAP advertised (ext/imap/php_imap.stub.php) #27680

Description

@PurHur

Category

stdlib · php-src-strict · IMAP side-load / PROFILE≥8.4 (or PHP_COMPILER_ENABLE_IMAP=1)

Problem

When IMAP is advertised (extension_loaded('imap') true under PHP_COMPILER_PROFILE=8.4+, or with PHP_COMPILER_ENABLE_IMAP=1), imap_open / imap_close / … register, but imap_timeout() and the IMAP_OPENTIMEOUT / IMAP_READTIMEOUT / IMAP_WRITETIMEOUT / IMAP_CLOSETIMEOUT constants are absent. php-src ships imap_timeout(int $timeout_type, int $timeout = -1): int|bool for get/set of c-client timeouts. ext/imap/Module.php only lists eight procedural APIs.

Repro Zend 8.3+ (ext/imap) VM (2026-08-04, IMAP advertised)
function_exists('imap_timeout') true false
defined('IMAP_OPENTIMEOUT') (and READ/WRITE/CLOSE) true false
imap_timeout(IMAP_OPENTIMEOUT) int (current) Error: Call to undefined function

php-src reference

Note: core php-src unbundled imap after 8.3; PHP-8.3 / PECL stub remains the reference for in-tree ext/imap. Sibling gap: #27674 (imap_is_open).

PHP implementation target

  • ext/imap/imap_timeout.php — new Internal (process-wide timeout table is fine for v1 local-mbox)
  • ext/imap/Module.php — register + define IMAP_*TIMEOUT when ImapExtensionPolicy::advertisesBuiltins()
  • Prefer PHP-in-PHP; JIT may stay VM-only like other imap_* v1 helpers

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_ENABLE_IMAP=1 PHP_COMPILER_PROFILE=8.3 php bin/vm.php -r "
echo function_exists(\"imap_timeout\") ? \"Y\" : \"N\", PHP_EOL;
echo defined(\"IMAP_OPENTIMEOUT\") ? \"Y\" : \"N\", PHP_EOL;
"'

Done when

  • function_exists('imap_timeout') and IMAP_*TIMEOUT defined when IMAP advertised
  • Get/set semantics match php-src for the four timeout types (including $timeout = -1 get)
  • Compliance .phpt under test/compliance/cases/ with IMAP enabled
  • php-src-strict; no php-compiler-strict shortcut

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