Skip to content

Regression: grapheme_levenshtein() phantom on all profiles — Zend/php-src never ships it (ext/intl/grapheme) #22661

Description

@PurHur

Category

Regression · php-src-strict · ext/intl grapheme · phantom builtin

Problem

function_exists('grapheme_levenshtein') is true on default / 8.2 / 8.3 / 8.4 / 8.5 profiles. Zend/php-src does not ship this function (ICU levenshtein RFC never landed; absent from ext/intl/grapheme/grapheme.stub.php on php-src master). Same class of phantom as mb_ucwords (#21458).

Verified 2026-07-23:

Profile function_exists('grapheme_levenshtein')
default / 8.2 / 8.3 / 8.4 / 8.5 yes (wrong)
Zend 8.2 host no
php-src grapheme.stub.php no grapheme_levenshtein

Prior impl tracker: #6998 (closed) — should have stayed ungated/unregistered like Zend.

php-src reference

PHP implementation target

  • ext/intl/Module.php — stop registering grapheme_levenshtein (or gate always-false like mb_ucwords / CompilerVersion advertisement)
  • Keep ext/intl/grapheme_levenshtein.php / VmGrapheme::levenshtein only if useful internally; must not appear in function_exists / call tables
  • PHP-in-PHP; no new C

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_grapheme_levenshtein_phantom.php'
PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_grapheme_levenshtein_phantom.php
<?php
echo function_exists('grapheme_levenshtein') ? "fail\n" : "ok\n";

Done when

  • function_exists('grapheme_levenshtein') === false on every profile (match Zend)
  • Compliance/phantom guard under test/compliance/cases/
  • 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 machinebugSomething isn't workingimplementation-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