Skip to content

Stdlib: grapheme_strimwidth() missing — PHP 8.4 intl width trim (ext/intl/grapheme_string.c) #9793

Description

@PurHur

Category

stdlib · php-src-strict

Problem

PHP 8.4 adds grapheme_strimwidth() — grapheme-cluster-aware string trim by display width (intl). Closed umbrella #6081 tracked both grapheme_strimwidth() and mb_str_pad(); mb_str_pad() is now registered on VM (function_exists → true, verified 2026-06-18) but grapheme_strimwidth() remains absent (function_exists → false).

php-src reference

Repro

<?php
var_dump(function_exists('grapheme_strimwidth'));
echo grapheme_strimwidth('こんにちは', 0, 3, '...'), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_dump(function_exists(\"grapheme_strimwidth\"));"
php bin/vm.php repro_grapheme_strimwidth.php
'
Engine function_exists Output
Zend PHP 8.4+ true grapheme-trimmed string with ellipsis
VM today (verified 2026-06-18) false undefined function

Scope (this repo)

Path Work
ext/intl/ or ext/standard/ grapheme_strimwidth.php VM handler
Width logic reuse Utf8JitHelper / mbstring width helpers where possible
Registration ext/intl/Module.php or ext/standard/Module.php
Tests test/compliance/cases/stdlib/grapheme_strimwidth.phpt

PHP-in-PHP first: implement width trim in PHP; thin ICU/libc only if proven necessary.

Done when

Related

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