Skip to content

Stdlib: forward 8.4 grapheme_strlen()/grapheme_str_split() callable without function_exists() — partial intl introspection (ext/intl/grapheme, re-#11815) #17608

Closed

Description

@PurHur

Category

Stdlib · php-src-strict · forward-profile introspection

Problem

With PHP_COMPILER_PROFILE=8.4, the partial grapheme cluster implementation runs (grapheme_strlen, grapheme_str_split, etc.) but function_exists() remains false for those symbols and extension_loaded('intl') is false. Zend only exposes grapheme helpers when ext/intl is loaded; our forward profile should either advertise consistently or withhold callability.

Repro Zend 8.4 + intl VM forward 8.4 (2026-07-10)
function_exists('grapheme_strlen') true with ext/intl false
grapheme_strlen("a\xCC\x81b") 2 2 (callable)
function_exists('grapheme_str_split') true with ext/intl false
count(grapheme_str_split("a\xCC\x81b")) 2 2 (callable)

Closed #11815/#11825 fixed over-advertising grapheme_stripos without intl; this is the inverse gap on the forward profile core cluster API.

php-src reference

PHP implementation target

  • ext/intl/ or ext/standard/ grapheme PHP lowering already used by maintainer_gap_grapheme_forward_profile_partial.php
  • lib/CompilerVersion.php + BuiltinIntrospectionPolicy — align forward 8.4 advertisement with callability (or stop emitting direct calls when withheld)
  • No new C runtime — keep UTF-8 cluster logic in PHP (ext/ + VM builtins)

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_grapheme_forward84_phantom.php'
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_grapheme_forward_profile_partial.php'

Done when

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 10, 2026
  2. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-b — starting this run

  3. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Merged via #17625.

    Fix: IntlExtensionPolicy::advertisesGraphemeCore/StrContains/Strimwidth() + BuiltinIntrospectionPolicy routing so forward PHP_COMPILER_PROFILE=8.4 advertises the core grapheme cluster (grapheme_strlen, grapheme_substr, grapheme_strpos, grapheme_extract, grapheme_str_split, grapheme_str_contains, grapheme_strimwidth) in function_exists()/is_callable() without full ext/intl. grapheme_stripos/grapheme_stristr/grapheme_strrpos remain intl-gated (#11815).

    Verification: repros maintainer_gap_grapheme_forward84_phantom.php + maintainer_gap_grapheme_forward_profile_partial.php print ok; compliance grapheme_forward_profile_introspection.phpt, grapheme_profile_84.phpt, grapheme_stripos_intl_gated.phpt green (VM+JIT).

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