Skip to content

Stdlib: mb_ereg*() — multibyte POSIX regex API (ext/mbstring/mbregex.c parity) #4635

Description

@PurHur

Category

stdlib

Problem

The mbregex subset of ext/mbstring is entirely absent. Only mb_strlen() (and a few other mb_* helpers) exist under ext/types/. Legacy apps and some frameworks still call mb_ereg(), mb_eregi(), mb_ereg_replace(), mb_split(), etc.

php-src reference

Repro (failure today)

<?php
var_dump(function_exists('mb_ereg'));
var_dump(function_exists('mb_regex_encoding'));
if (mb_ereg('^[a-z]+$', 'hello')) {
    echo "match\n";
}
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php'
Runtime mb_ereg('^[a-z]+$', 'hello')
Zend (ext/mbstring) 1 + match
This compiler undefined function

Scope (this repo)

Area Path
v1 surface mb_ereg, mb_eregi, mb_ereg_replace, mb_split, mb_regex_encoding, mb_regex_set_options
VM Delegate to host \mb_* when ext/mbstring loaded; clear error when unavailable
Module ext/mbstring/Module.php or extend ext/types/Module.php
JIT/AOT VM-first; document matrix as VM-only v1
Tests test/compliance/cases/stdlib/mb_ereg.phpt (skip when host lacks mbregex)

Done when

  • Repro prints match on VM when host mbstring is available (Docker php-compiler:22.04-dev)
  • mb_regex_encoding() get/set matches Zend for UTF-8 default
  • No-match returns false (not exception) per Zend
  • ./script/ci-fast.sh --filter mb_ereg green
  • Capability matrix rows for each implemented function

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 apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions