Skip to content

Stdlib: grapheme_str_split() without ext/intl — function_exists true, Zend false (ext/intl/grapheme) #11825

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

When ext/intl is not loaded, Zend reports function_exists('grapheme_str_split') as false. This compiler registers the grapheme helper unconditionally, so function_exists is true and callers invoke stub/ICU-less behavior.

Sibling: #11803 (grapheme_extract, grapheme_substr, grapheme_strpos), #11815 (grapheme_stripos, grapheme_stristr, grapheme_strrpos), #11768 (grapheme_strlen). Same policy — gate intl grapheme surface on extension availability.

Function Zend (no intl.so) VM today
grapheme_str_split() false true ❌

php-src reference

Repro

test/repro/maintainer_gap_grapheme_str_split_without_intl.php

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_grapheme_str_split_without_intl.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_grapheme_str_split_without_intl.php'
Runtime Output
Zend ok: absent
VM fail: grapheme_str_split advertised without intl

Implementation hints (PHP-in-PHP)

  • Gate grapheme_str_split registration on extension_loaded('intl') (or equivalent capability probe), matching php-src php_intl.c
  • Do not leave function_exists true with no matching Zend behavior on the reference runtime
  • Implement real ICU semantics in ext/intl/ when intl is enabled

Done when

  • Repro ok on VM when intl is not loaded (no phantom symbol)
  • When intl is loaded, grapheme_str_split() matches php-src cluster boundaries
  • Targeted compliance guard committed

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 Jun 25, 2026
  2. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-c — batch (issues #13748, #11825, #11551)

  3. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    claim released: worker-lane-c — already green on master (2026-06-29).

    php test/repro/maintainer_gap_grapheme_str_split_without_intl.php  # ok: absent
    php bin/vm.php test/repro/maintainer_gap_grapheme_str_split_without_intl.php  # ok: absent
    

    Recommend close — IntlExtensionPolicy already withholds grapheme/intl_* symbols when ext/intl is not loaded.

  4. PurHur commented on Jul 6, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  5. PurHur commented on Jul 6, 2026

    @PurHur
    OwnerAuthor

    Merged via #16966.

    Fix: grapheme_str_contains / grapheme_strimwidth now use IntlExtensionPolicy::advertisesBuiltins() for function_exists() — same gate as other grapheme_* helpers. Forward-profile registration stays callable; introspection matches Zend (no phantom intl surface without ext/intl).

    Verification: maintainer_gap_grapheme_str_split_without_intl.php → ok: absent; VM compliance grapheme_phantom + grapheme_profile_84 green; AOT -l on repro + grapheme_strimwidth_literals.php exit 0.

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