Skip to content
PHP News
Search
Implemented PHP 8.6

Oniguruma maintenance end and end of mbregex

Deprecates the mb_ereg* regex functions in PHP 8.6 and removes them in PHP 9.0, since the Oniguruma library behind them is no longer maintained.

Drop support the mbregex functions, Deprecate 8.6 and delete 9.0

Primary vote · 2/3 majority

24 Yes 0 No 100% approval

This poll has closed.

Accepted. Voting closed on April 25, 2026 with 24 in favor, none against and no abstentions, clearing the two-thirds majority it needed. The deprecation has been merged for PHP 8.6.

Summary

PHP's mb_ereg* functions rely on a library called Oniguruma to run regular expressions on multibyte strings, and that library stopped being maintained on April 24, 2025. This RFC from Yuya Hamada deprecates the mbregex functions in PHP 8.6 and removes them in PHP 9.0.

Why change it

PHP can't keep shipping features that depend on an unmaintained library. The RFC also notes that FreeBSD plans to drop Oniguruma on December 1, 2026, which affects the machines php-src uses for testing.

Ruby uses an Oniguruma fork called Onigmo, but the RFC points out that it has different features and targets a different Unicode version, so it isn't a drop-in replacement.

What goes away

These functions are deprecated in 8.6 and removed in 9.0:

  • mb_ereg, mb_eregi, mb_ereg_match
  • mb_ereg_replace, mb_eregi_replace, mb_ereg_replace_callback
  • mb_ereg_search and the other mb_ereg_search_* functions
  • mb_regex_encoding, mb_regex_set_options, mb_split

The MB_ONIGURUMA_VERSION constant goes as well, along with the mbstring.regex_retry_limit and mbstring.regex_stack_limit ini settings.

In PHP 8.6, calling one of these functions emits a message like this:

Deprecated: Function mb_ereg_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

What it means for existing code

If you use any of these functions, you'll see deprecation notices in PHP 8.6, and the functions stop working in PHP 9.0. PHP 8.2 through 8.5 keep them unchanged.

A scan of public code found 147 uses across 13 sources, and the author expects private code uses them more. The change hits hardest for people working with multibyte text that isn't UTF-8.

To ease the transition, the author published a separate extension called mb_onig that keeps the functions available. You can install it with PIE, PHP's extension installer:

pie install mb_onig/mb_onig

On PHP 8.x, you need to build PHP with --disable-mbregex first so the two don't clash.