Skip to content

Stdlib: zend_thread_id() phantom — function_exists true on PHP 8.2 reference (ext/standard/basic_functions.c) #11842

Description

@PurHur

Category

stdlib · php-src-strict

Problem

zend_thread_id() is a PHP 8.4+ builtin. On PHP 8.2 reference profiles function_exists('zend_thread_id') is false. This compiler registers the function unconditionally (function_exists true, callable returns an int).

php-src reference

Repro

test/repro/maintainer_gap_zend_thread_id_phantom.php

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_zend_thread_id_phantom.php; echo exit:$?'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_zend_thread_id_phantom.php; echo exit:$?'
Runtime Output
Zend 8.2 ok
VM fail: function_exists('zend_thread_id') true on reference profile

Implementation hints (PHP-in-PHP)

  • Gate registration on target PHP version / capability matrix (same pattern as other 8.4-only builtins)
  • When enabled (8.4 profile), return OS thread id via thin POSIX/FFI helper — no permanent C builtin table growth
  • Update script/capability-matrix.php notes

Done when

  • Repro ok on VM when reference profile is PHP 8.2
  • Function available and matches Zend when project targets PHP 8.4
  • function_exists / get_defined_functions agree with php-src for active profile

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